当前位置: 首页>>代码示例>>Python>>正文


Python ga.MV类代码示例

本文整理汇总了Python中sympy.galgebra.ga.MV的典型用法代码示例。如果您正苦于以下问题:Python MV类的具体用法?Python MV怎么用?Python MV使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MV类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_basic_multivector_operations

def test_basic_multivector_operations():
    with GA_Printer():
        (ex, ey, ez) = MV.setup('e*x|y|z')

        A = MV('A', 'mv')

        assert str(A) == 'A + A__x*e_x + A__y*e_y + A__z*e_z + A__xy*e_x^e_y + A__xz*e_x^e_z + A__yz*e_y^e_z + A__xyz*e_x^e_y^e_z'
        assert str(A) == 'A + A__x*e_x + A__y*e_y + A__z*e_z + A__xy*e_x^e_y + A__xz*e_x^e_z + A__yz*e_y^e_z + A__xyz*e_x^e_y^e_z'
        assert str(A) == 'A + A__x*e_x + A__y*e_y + A__z*e_z + A__xy*e_x^e_y + A__xz*e_x^e_z + A__yz*e_y^e_z + A__xyz*e_x^e_y^e_z'

        X = MV('X', 'vector')
        Y = MV('Y', 'vector')

        assert str(X) == 'X__x*e_x + X__y*e_y + X__z*e_z'
        assert str(Y) == 'Y__x*e_x + Y__y*e_y + Y__z*e_z'

        assert str((X*Y)) == '(e_x.e_x)*X__x*Y__x + (e_x.e_y)*X__x*Y__y + (e_x.e_y)*X__y*Y__x + (e_x.e_z)*X__x*Y__z + (e_x.e_z)*X__z*Y__x + (e_y.e_y)*X__y*Y__y + (e_y.e_z)*X__y*Y__z + (e_y.e_z)*X__z*Y__y + (e_z.e_z)*X__z*Y__z + (X__x*Y__y - X__y*Y__x)*e_x^e_y + (X__x*Y__z - X__z*Y__x)*e_x^e_z + (X__y*Y__z - X__z*Y__y)*e_y^e_z'
        assert str((X ^ Y)) == '(X__x*Y__y - X__y*Y__x)*e_x^e_y + (X__x*Y__z - X__z*Y__x)*e_x^e_z + (X__y*Y__z - X__z*Y__y)*e_y^e_z'
        assert str((X | Y)) == '(e_x.e_x)*X__x*Y__x + (e_x.e_y)*X__x*Y__y + (e_x.e_y)*X__y*Y__x + (e_x.e_z)*X__x*Y__z + (e_x.e_z)*X__z*Y__x + (e_y.e_y)*X__y*Y__y + (e_y.e_z)*X__y*Y__z + (e_y.e_z)*X__z*Y__y + (e_z.e_z)*X__z*Y__z'

        (ex, ey) = MV.setup('e*x|y')

        X = MV('X', 'vector')
        A = MV('A', 'spinor')

        assert str(X) == 'X__x*e_x + X__y*e_y'
        assert str(A) == 'A + A__xy*e_x^e_y'

        assert str((X | A)) == '(-A__xy*((e_x.e_y)*X__x + (e_y.e_y)*X__y))*e_x + (A__xy*((e_x.e_x)*X__x + (e_x.e_y)*X__y))*e_y'
        assert str((X < A)) == '(-A__xy*((e_x.e_y)*X__x + (e_y.e_y)*X__y))*e_x + (A__xy*((e_x.e_x)*X__x + (e_x.e_y)*X__y))*e_y'
        assert str((A > X)) == '(A__xy*((e_x.e_y)*X__x + (e_y.e_y)*X__y))*e_x + (-A__xy*((e_x.e_x)*X__x + (e_x.e_y)*X__y))*e_y'

        (ex, ey) = MV.setup('e*x|y', metric='[1,1]')

        X = MV('X', 'vector')
        A = MV('A', 'spinor')

        assert str(X) == 'X__x*e_x + X__y*e_y'
        assert str(A) == 'A + A__xy*e_x^e_y'

        assert str((X*A)) == '(A*X__x - A__xy*X__y)*e_x + (A*X__y + A__xy*X__x)*e_y'
        assert str((X | A)) == '-A__xy*X__y*e_x + A__xy*X__x*e_y'
        assert str((X < A)) == '-A__xy*X__y*e_x + A__xy*X__x*e_y'
        assert str((X > A)) == 'A*X__x*e_x + A*X__y*e_y'

        assert str((A*X)) == '(A*X__x + A__xy*X__y)*e_x + (A*X__y - A__xy*X__x)*e_y'
        assert str((A | X)) == 'A__xy*X__y*e_x - A__xy*X__x*e_y'
        assert str((A < X)) == 'A*X__x*e_x + A*X__y*e_y'
        assert str((A > X)) == 'A__xy*X__y*e_x - A__xy*X__x*e_y'

    return
开发者ID:AALEKH,项目名称:sympy,代码行数:51,代码来源:test_ga.py

示例2: Distorted_manifold_with_scalar_function

def Distorted_manifold_with_scalar_function():
    Print_Function()
    coords = symbols('x y z')
    (ex, ey, ez, grad) = MV.setup('ex ey ez', metric='[1,1,1]', coords=coords)
    mfvar = (u, v) = symbols('u v')
    X = 2*u*ex + 2*v*ey + (u**3 + v**3/2)*ez
    MF = Manifold(X, mfvar, I=MV.I)

    (eu, ev) = MF.Basis()

    g = (v + 1)*log(u)
    dg = MF.Grad(g)
    print('g =', g)
    print('dg =', dg)
    print('dg(1,0) =', dg.subs({u: 1, v: 0}))
    G = u*eu + v*ev
    dG = MF.Grad(G)
    print('G =', G)
    print('P(G) =', MF.Proj(G))
    print('zcoef =', simplify(2*(u**2 + v**2)*(-4*u**2 - 4*v**2 - 1)))
    print('dG =', dG)
    print('P(dG) =', MF.Proj(dG))
    PS = u*v*eu ^ ev
    print('PS =', PS)
    print('dPS =', MF.Grad(PS))
    print('P(dPS) =', MF.Proj(MF.Grad(PS)))
    return
开发者ID:AdrianPotter,项目名称:sympy,代码行数:27,代码来源:manifold_check.py

示例3: test_vector_extraction

def test_vector_extraction():
    """
    Show that conformal bivector encodes two points. See D&L Section 10.4.1
    """
    metric = ' 0 -1 #,' + \
             '-1  0 #,' + \
             ' #  # #,'

    P1, P2, a = MV.setup('P1 P2 a', metric)
    """
    P1 and P2 are null vectors and hence encode points in conformal space.
    Show that P1 and P2 can be extracted from the bivector B = P1^P2. a is a
    third vector in the conformal space with a.B not 0.
    """
    B = P1 ^ P2
    Bsq = B*B
    ap = a - (a ^ B)*B
    Ap = ap + ap*B
    Am = ap - ap*B
    P1dota = Symbol('(P1.a)')
    P2dota = Symbol('(P2.a)')
    Ap_test = (-2*P2dota)*P1
    Am_test = (-2*P1dota)*P2
    assert Ap == Ap_test
    assert Am == Am_test
    Ap2 = Ap*Ap
    Am2 = Am*Am
    assert Ap2 == S.Zero
    assert Am2 == S.Zero
开发者ID:AALEKH,项目名称:sympy,代码行数:29,代码来源:test_ga.py

示例4: Test_Reciprocal_Frame

def Test_Reciprocal_Frame():
    Print_Function()
    coords = symbols('x y z')
    (ex, ey, ez, grad) = MV.setup('ex ey ez', metric='[1,1,1]', coords=coords)

    mfvar = (u, v) = symbols('u v')

    eu = ex + ey
    ev = ex - ey

    (eu_r, ev_r) = ReciprocalFrame([eu, ev])

    oprint('Frame', (eu, ev), 'Reciprocal Frame', (eu_r, ev_r))

    print('eu.eu_r =', eu | eu_r)
    print('eu.ev_r =', eu | ev_r)
    print('ev.eu_r =', ev | eu_r)
    print('ev.ev_r =', ev | ev_r)

    eu = ex + ey + ez
    ev = ex - ey

    (eu_r, ev_r) = ReciprocalFrame([eu, ev])

    oprint('Frame', (eu, ev), 'Reciprocal Frame', (eu_r, ev_r))

    print('eu.eu_r =', eu | eu_r)
    print('eu.ev_r =', eu | ev_r)
    print('ev.eu_r =', ev | eu_r)
    print('ev.ev_r =', ev | ev_r)
    return
开发者ID:AdrianPotter,项目名称:sympy,代码行数:31,代码来源:manifold_check.py

示例5: test_conformal_representations_of_circles_lines_spheres_and_planes

def test_conformal_representations_of_circles_lines_spheres_and_planes():
    global n, nbar
    with GA_Printer():

        metric = '1 0 0 0 0,0 1 0 0 0,0 0 1 0 0,0 0 0 0 2,0 0 0 2 0'

        (e1, e2, e3, n, nbar) = MV.setup('e_1 e_2 e_3 n nbar', metric)

        e = n + nbar
        #conformal representation of points

        A = make_vector(e1)
        B = make_vector(e2)
        C = make_vector(-e1)
        D = make_vector(e3)
        X = make_vector('x', 3)

        assert str(A) == 'e_1 + 1/2*n - 1/2*nbar'
        assert str(B) == 'e_2 + 1/2*n - 1/2*nbar'
        assert str(C) == '-e_1 + 1/2*n - 1/2*nbar'
        assert str(D) == 'e_3 + 1/2*n - 1/2*nbar'
        assert str(X) == 'x1*e_1 + x2*e_2 + x3*e_3 + ((x1**2 + x2**2 + x3**2)/2)*n - 1/2*nbar'

        assert str((A ^ B ^ C ^ X)) == '-x3*e_1^e_2^e_3^n + x3*e_1^e_2^e_3^nbar + ((x1**2 + x2**2 + x3**2 - 1)/2)*e_1^e_2^n^nbar'
        assert str((A ^ B ^ n ^ X)) == '-x3*e_1^e_2^e_3^n + ((x1 + x2 - 1)/2)*e_1^e_2^n^nbar + x3/2*e_1^e_3^n^nbar - x3/2*e_2^e_3^n^nbar'
        assert str((((A ^ B) ^ C) ^ D) ^ X) == '((-x1**2 - x2**2 - x3**2 + 1)/2)*e_1^e_2^e_3^n^nbar'
        assert str((A ^ B ^ n ^ D ^ X)) == '((-x1 - x2 - x3 + 1)/2)*e_1^e_2^e_3^n^nbar'

        L = (A ^ B ^ e) ^ X

        assert str(L) == '-x3*e_1^e_2^e_3^n - x3*e_1^e_2^e_3^nbar + (-x1**2/2 + x1 - x2**2/2 + x2 - x3**2/2 - 1/2)*e_1^e_2^n^nbar + x3*e_1^e_3^n^nbar - x3*e_2^e_3^n^nbar'

    return
开发者ID:AALEKH,项目名称:sympy,代码行数:33,代码来源:test_ga.py

示例6: test_derivatives_in_spherical_coordinates

def test_derivatives_in_spherical_coordinates():
    with GA_Printer():
        X = (r, th, phi) = symbols("r theta phi")
        curv = [[r * cos(phi) * sin(th), r * sin(phi) * sin(th), r * cos(th)], [1, r, r * sin(th)]]
        (er, eth, ephi, grad) = MV.setup("e_r e_theta e_phi", metric="[1,1,1]", coords=X, curv=curv)

        f = MV("f", "scalar", fct=True)
        A = MV("A", "vector", fct=True)
        B = MV("B", "grade2", fct=True)

        assert str(f) == "f"
        assert str(A) == "A__r*e_r + A__theta*e_theta + A__phi*e_phi"
        assert str(B) == "B__rtheta*e_r^e_theta + B__rphi*e_r^e_phi + B__thetaphi*e_theta^e_phi"

        assert str(grad * f) == "D{r}f*e_r + D{theta}f/r*e_theta + D{phi}f/(r*sin(theta))*e_phi"
        assert (
            str(grad | A)
            == "D{r}A__r + 2*A__r/r + A__theta*cos(theta)/(r*sin(theta)) + D{theta}A__theta/r + D{phi}A__phi/(r*sin(theta))"
        )
        assert (
            str(-MV.I * (grad ^ A))
            == "((A__phi*cos(theta)/sin(theta) + D{theta}A__phi - D{phi}A__theta/sin(theta))/r)*e_r + (-D{r}A__phi - A__phi/r + D{phi}A__r/(r*sin(theta)))*e_theta + (D{r}A__theta + A__theta/r - D{theta}A__r/r)*e_phi"
        )
        assert (
            str(grad ^ B)
            == "(D{r}B__thetaphi - B__rphi*cos(theta)/(r*sin(theta)) + 2*B__thetaphi/r - D{theta}B__rphi/r + D{phi}B__rtheta/(r*sin(theta)))*e_r^e_theta^e_phi"
        )

    return
开发者ID:guanlongtianzi,项目名称:sympy,代码行数:29,代码来源:test_ga.py

示例7: test_extract_plane_and_line

def test_extract_plane_and_line():
    """
    Show that conformal trivector encodes planes and lines. See D&L section
    10.4.2
    """
    metric = '# # # 0 0,' + \
             '# # # 0 0,' + \
             '# # # 0 0,' + \
             '0 0 0 0 2,' + \
             '0 0 0 2 0'

    p1, p2, p3, n, nbar = MV.setup('p1 p2 p3 n nbar', metric, debug=0)

    P1 = F(p1, n, nbar)
    P2 = F(p2, n, nbar)
    P3 = F(p3, n, nbar)

    #Line through p1 and p2
    L = P1 ^ P2 ^ n
    delta = (L | n) | nbar
    delta_test = 2*p1 - 2*p2
    diff = delta - delta_test
    assert diff == S.Zero

    #Plane through p1, p2, and p3
    C = P1 ^ P2 ^ P3
    delta = ((C ^ n) | n) | nbar
    delta_test = 2*(p1 ^ p2) - 2*(p1 ^ p3) + 2*(p2 ^ p3)
    diff = delta - delta_test
    assert diff == S.Zero
开发者ID:AALEKH,项目名称:sympy,代码行数:30,代码来源:test_ga.py

示例8: test_extracting_vectors_from_conformal_2_blade

def test_extracting_vectors_from_conformal_2_blade():
    with GA_Printer():
        metric = ' 0 -1 #,' + \
                 '-1  0 #,' + \
                 ' #  # #,'

        (P1, P2, a) = MV.setup('P1 P2 a', metric)

        B = P1 ^ P2
        Bsq = B*B
        assert str(Bsq) == '1'
        ap = a - (a ^ B)*B
        assert str(ap) == '-(P2.a)*P1 - (P1.a)*P2'

        Ap = ap + ap*B
        Am = ap - ap*B

        assert str(Ap) == '-2*(P2.a)*P1'
        assert str(Am) == '-2*(P1.a)*P2'

        assert str(Ap*Ap) == '0'
        assert str(Am*Am) == '0'

        aB = a | B
        assert str(aB) == '-(P2.a)*P1 + (P1.a)*P2'

    return
开发者ID:AALEKH,项目名称:sympy,代码行数:27,代码来源:test_ga.py

示例9: test_extracting_vectors_from_conformal_2_blade

def test_extracting_vectors_from_conformal_2_blade():
    with GA_Printer():
        metric = " 0 -1 #," + "-1  0 #," + " #  # #,"

        (P1, P2, a) = MV.setup("P1 P2 a", metric)

        B = P1 ^ P2
        Bsq = B * B
        assert str(Bsq) == "1"
        ap = a - (a ^ B) * B
        assert str(ap) == "-(P2.a)*P1 - (P1.a)*P2"

        Ap = ap + ap * B
        Am = ap - ap * B

        assert str(Ap) == "-2*(P2.a)*P1"
        assert str(Am) == "-2*(P1.a)*P2"

        assert str(Ap * Ap) == "0"
        assert str(Am * Am) == "0"

        aB = a | B
        assert str(aB) == "-(P2.a)*P1 + (P1.a)*P2"

    return
开发者ID:guanlongtianzi,项目名称:sympy,代码行数:25,代码来源:test_ga.py

示例10: test_reciprocal_frame_test

def test_reciprocal_frame_test():
    with GA_Printer():
        metric = '1 # #,' + \
                 '# 1 #,' + \
                 '# # 1,'

        (e1, e2, e3) = MV.setup('e1 e2 e3', metric)

        E = e1 ^ e2 ^ e3
        Esq = (E*E).scalar()
        assert str(E) == 'e1^e2^e3'
        assert str(Esq) == '(e1.e2)**2 - 2*(e1.e2)*(e1.e3)*(e2.e3) + (e1.e3)**2 + (e2.e3)**2 - 1'
        Esq_inv = 1/Esq

        E1 = (e2 ^ e3)*E
        E2 = (-1)*(e1 ^ e3)*E
        E3 = (e1 ^ e2)*E

        assert str(E1) == '((e2.e3)**2 - 1)*e1 + ((e1.e2) - (e1.e3)*(e2.e3))*e2 + (-(e1.e2)*(e2.e3) + (e1.e3))*e3'
        assert str(E2) == '((e1.e2) - (e1.e3)*(e2.e3))*e1 + ((e1.e3)**2 - 1)*e2 + (-(e1.e2)*(e1.e3) + (e2.e3))*e3'
        assert str(E3) == '(-(e1.e2)*(e2.e3) + (e1.e3))*e1 + (-(e1.e2)*(e1.e3) + (e2.e3))*e2 + ((e1.e2)**2 - 1)*e3'

        w = (E1 | e2)
        w = w.expand()
        assert str(w) == '0'

        w = (E1 | e3)
        w = w.expand()
        assert str(w) == '0'

        w = (E2 | e1)
        w = w.expand()
        assert str(w) == '0'

        w = (E2 | e3)
        w = w.expand()
        assert str(w) == '0'

        w = (E3 | e1)
        w = w.expand()
        assert str(w) == '0'

        w = (E3 | e2)
        w = w.expand()
        assert str(w) == '0'

        w = (E1 | e1)
        w = (w.expand()).scalar()
        Esq = expand(Esq)
        assert str(simplify(w/Esq)) == '1'

        w = (E2 | e2)
        w = (w.expand()).scalar()
        assert str(simplify(w/Esq)) == '1'

        w = (E3 | e3)
        w = (w.expand()).scalar()
        assert str(simplify(w/Esq)) == '1'

    return
开发者ID:AALEKH,项目名称:sympy,代码行数:60,代码来源:test_ga.py

示例11: test_derivatives_in_rectangular_coordinates

def test_derivatives_in_rectangular_coordinates():
    with GA_Printer():
        X = (x, y, z) = symbols('x y z')
        (ex, ey, ez, grad) = MV.setup('e_x e_y e_z', metric='[1,1,1]', coords=X)

        f = MV('f', 'scalar', fct=True)
        A = MV('A', 'vector', fct=True)
        B = MV('B', 'grade2', fct=True)
        C = MV('C', 'mv', fct=True)

        assert str(f) == 'f'
        assert str(A) == 'A__x*e_x + A__y*e_y + A__z*e_z'
        assert str(B) == 'B__xy*e_x^e_y + B__xz*e_x^e_z + B__yz*e_y^e_z'
        assert str(C) == 'C + C__x*e_x + C__y*e_y + C__z*e_z + C__xy*e_x^e_y + C__xz*e_x^e_z + C__yz*e_y^e_z + C__xyz*e_x^e_y^e_z'

        assert str(grad*f) == 'D{x}f*e_x + D{y}f*e_y + D{z}f*e_z'
        assert str(grad | A) == 'D{x}A__x + D{y}A__y + D{z}A__z'
        assert str(grad*A) == 'D{x}A__x + D{y}A__y + D{z}A__z + (-D{y}A__x + D{x}A__y)*e_x^e_y + (-D{z}A__x + D{x}A__z)*e_x^e_z + (-D{z}A__y + D{y}A__z)*e_y^e_z'

        assert str(-MV.I*(grad ^ A)) == '(-D{z}A__y + D{y}A__z)*e_x + (D{z}A__x - D{x}A__z)*e_y + (-D{y}A__x + D{x}A__y)*e_z'
        assert str(grad*B) == '(-(D{y}B__xy + D{z}B__xz))*e_x + (D{x}B__xy - D{z}B__yz)*e_y + (D{x}B__xz + D{y}B__yz)*e_z + (D{z}B__xy - D{y}B__xz + D{x}B__yz)*e_x^e_y^e_z'
        assert str(grad ^ B) == '(D{z}B__xy - D{y}B__xz + D{x}B__yz)*e_x^e_y^e_z'
        assert str(grad | B) == '(-(D{y}B__xy + D{z}B__xz))*e_x + (D{x}B__xy - D{z}B__yz)*e_y + (D{x}B__xz + D{y}B__yz)*e_z'

        assert str(grad < A) == 'D{x}A__x + D{y}A__y + D{z}A__z'
        assert str(grad > A) == 'D{x}A__x + D{y}A__y + D{z}A__z'
        assert str(grad < B) == '(-(D{y}B__xy + D{z}B__xz))*e_x + (D{x}B__xy - D{z}B__yz)*e_y + (D{x}B__xz + D{y}B__yz)*e_z'
        assert str(grad > B) == '0'
        assert str(grad < C) == 'D{x}C__x + D{y}C__y + D{z}C__z + (-(D{y}C__xy + D{z}C__xz))*e_x + (D{x}C__xy - D{z}C__yz)*e_y + (D{x}C__xz + D{y}C__yz)*e_z + D{z}C__xyz*e_x^e_y - D{y}C__xyz*e_x^e_z + D{x}C__xyz*e_y^e_z'
        assert str(grad > C) == 'D{x}C__x + D{y}C__y + D{z}C__z + D{x}C*e_x + D{y}C*e_y + D{z}C*e_z'

    return
开发者ID:AALEKH,项目名称:sympy,代码行数:32,代码来源:test_ga.py

示例12: test_substitution

def test_substitution():

    e_x, e_y, e_z = MV.setup("e_x e_y e_z", "1 0 0, 0 1 0, 0 0 1")
    x, y, z = symbols("x y z")

    X = x * e_x + y * e_y + z * e_z
    Y = X.subs([(x, 2), (y, 3), (z, 4)])
    assert Y == 2 * e_x + 3 * e_y + 4 * e_z
开发者ID:guanlongtianzi,项目名称:sympy,代码行数:8,代码来源:test_ga.py

示例13: test_substitution

def test_substitution():

    e_x, e_y, e_z = MV.setup('e_x e_y e_z', '1 0 0, 0 1 0, 0 0 1')
    x, y, z = symbols('x y z')

    X = x*e_x + y*e_y + z*e_z
    Y = X.subs([(x, 2), (y, 3), (z, 4)])
    assert Y == 2*e_x + 3*e_y + 4*e_z
开发者ID:AALEKH,项目名称:sympy,代码行数:8,代码来源:test_ga.py

示例14: test_reciprocal_frame_test

def test_reciprocal_frame_test():
    with GA_Printer():
        metric = "1 # #," + "# 1 #," + "# # 1,"

        (e1, e2, e3) = MV.setup("e1 e2 e3", metric)

        E = e1 ^ e2 ^ e3
        Esq = (E * E).scalar()
        assert str(E) == "e1^e2^e3"
        assert str(Esq) == "(e1.e2)**2 - 2*(e1.e2)*(e1.e3)*(e2.e3) + (e1.e3)**2 + (e2.e3)**2 - 1"
        Esq_inv = 1 / Esq

        E1 = (e2 ^ e3) * E
        E2 = (-1) * (e1 ^ e3) * E
        E3 = (e1 ^ e2) * E

        assert str(E1) == "((e2.e3)**2 - 1)*e1 + ((e1.e2) - (e1.e3)*(e2.e3))*e2 + (-(e1.e2)*(e2.e3) + (e1.e3))*e3"
        assert str(E2) == "((e1.e2) - (e1.e3)*(e2.e3))*e1 + ((e1.e3)**2 - 1)*e2 + (-(e1.e2)*(e1.e3) + (e2.e3))*e3"
        assert str(E3) == "(-(e1.e2)*(e2.e3) + (e1.e3))*e1 + (-(e1.e2)*(e1.e3) + (e2.e3))*e2 + ((e1.e2)**2 - 1)*e3"

        w = E1 | e2
        w = w.expand()
        assert str(w) == "0"

        w = E1 | e3
        w = w.expand()
        assert str(w) == "0"

        w = E2 | e1
        w = w.expand()
        assert str(w) == "0"

        w = E2 | e3
        w = w.expand()
        assert str(w) == "0"

        w = E3 | e1
        w = w.expand()
        assert str(w) == "0"

        w = E3 | e2
        w = w.expand()
        assert str(w) == "0"

        w = E1 | e1
        w = (w.expand()).scalar()
        Esq = expand(Esq)
        assert str(simplify(w / Esq)) == "1"

        w = E2 | e2
        w = (w.expand()).scalar()
        assert str(simplify(w / Esq)) == "1"

        w = E3 | e3
        w = (w.expand()).scalar()
        assert str(simplify(w / Esq)) == "1"

    return
开发者ID:guanlongtianzi,项目名称:sympy,代码行数:58,代码来源:test_ga.py

示例15: Plot_Mobius_Strip_Manifold

def Plot_Mobius_Strip_Manifold():
    Print_Function()
    coords = symbols('x y z')
    (ex, ey, ez, grad) = MV.setup('ex ey ez', metric='[1,1,1]', coords=coords)
    mfvar = (u, v) = symbols('u v')
    X = (cos(u) + v*cos(u/2)*cos(u))*ex + (sin(u) + v*cos(u/2)*sin(u))*ey + v*sin(u/2)*ez
    MF = Manifold(X, mfvar, True, I=MV.I)
    MF.Plot2DSurface([0.0, 6.28, 48], [-0.3, 0.3, 12], surf=False, skip=[4, 4], tan=0.15)
    return
开发者ID:AdrianPotter,项目名称:sympy,代码行数:9,代码来源:manifold_check.py


注:本文中的sympy.galgebra.ga.MV类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。