本文整理汇总了Python中sympy.galgebra.ga.Ga.mv方法的典型用法代码示例。如果您正苦于以下问题:Python Ga.mv方法的具体用法?Python Ga.mv怎么用?Python Ga.mv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.galgebra.ga.Ga
的用法示例。
在下文中一共展示了Ga.mv方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: derivatives_in_rectangular_coordinates
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
def derivatives_in_rectangular_coordinates():
Print_Function()
X = (x, y, z) = symbols('x y z')
o3d = Ga('e_x e_y e_z', g=[1, 1, 1], coords=X)
(ex, ey, ez) = o3d.mv()
grad = o3d.grad
f = o3d.mv('f', 'scalar', f=True)
A = o3d.mv('A', 'vector', f=True)
B = o3d.mv('B', 'bivector', f=True)
C = o3d.mv('C', 'mv', f=True)
print 'f =', f
print 'A =', A
print 'B =', B
print 'C =', C
print 'grad*f =', grad * f
print 'grad|A =', grad | A
print 'grad*A =', grad * A
print '-I*(grad^A) =', -o3d.I() * (grad ^ A)
print 'grad*B =', grad * B
print 'grad^B =', grad ^ B
print 'grad|B =', grad | B
print 'grad<A =', grad < A
print 'grad>A =', grad > A
print 'grad<B =', grad < B
print 'grad>B =', grad > B
print 'grad<C =', grad < C
print 'grad>C =', grad > C
return
示例2: basic_multivector_operations_3D
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
def basic_multivector_operations_3D():
Print_Function()
g3d = Ga('e*x|y|z')
(ex,ey,ez) = g3d.mv()
A = g3d.mv('A','mv')
A.Fmt(1,'A')
A.Fmt(2,'A')
A.Fmt(3,'A')
A.even().Fmt(1,'%A_{+}')
A.odd().Fmt(1,'%A_{-}')
X = g3d.mv('X','vector')
Y = g3d.mv('Y','vector')
print 'g_{ij} = ',g3d.g
X.Fmt(1,'X')
Y.Fmt(1,'Y')
(X*Y).Fmt(2,'X*Y')
(X^Y).Fmt(2,'X^Y')
(X|Y).Fmt(2,'X|Y')
return
示例3: properties_of_geometric_objects
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
def properties_of_geometric_objects():
Print_Function()
global n, nbar
g = '# # # 0 0,'+ \
'# # # 0 0,'+ \
'# # # 0 0,'+ \
'0 0 0 0 2,'+ \
'0 0 0 2 0'
c3d = Ga('p1 p2 p3 n nbar',g=g)
(p1,p2,p3,n,nbar) = c3d.mv()
print 'g_{ij} =\n',c3d.g
P1 = F(p1)
P2 = F(p2)
P3 = F(p3)
print 'Extracting direction of line from L = P1^P2^n'
L = P1^P2^n
delta = (L|n)|nbar
print '(L|n)|nbar =',delta
print 'Extracting plane of circle from C = P1^P2^P3'
C = P1^P2^P3
delta = ((C^n)|n)|nbar
print '((C^n)|n)|nbar =',delta
print '(p2-p1)^(p3-p1) =',(p2-p1)^(p3-p1)
示例4: extracting_vectors_from_conformal_2_blade
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
def extracting_vectors_from_conformal_2_blade():
Print_Function()
g = '0 -1 #,'+ \
'-1 0 #,'+ \
'# # #'
e2b = Ga('P1 P2 a',g=g)
(P1,P2,a) = e2b.mv()
print 'g_{ij} =\n',e2b.g
B = P1^P2
Bsq = B*B
print 'B**2 =',Bsq
ap = a-(a^B)*B
print "a' = a-(a^B)*B =",ap
Ap = ap+ap*B
Am = ap-ap*B
print "A+ = a'+a'*B =",Ap
print "A- = a'-a'*B =",Am
print '(A+)^2 =',Ap*Ap
print '(A-)^2 =',Am*Am
aB = a|B
print 'a|B =',aB
return
示例5: test_reciprocal_frame
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
def test_reciprocal_frame():
"""
Test of formula for general reciprocal frame of three vectors.
Let three independent vectors be e1, e2, and e3. The reciprocal
vectors E1, E2, and E3 obey the relations:
e_i.E_j = delta_ij*(e1^e2^e3)**2
"""
g = '1 # #,'+ \
'# 1 #,'+ \
'# # 1'
g3dn = Ga('e1 e2 e3',g=g)
(e1,e2,e3) = g3dn.mv()
E = e1^e2^e3
Esq = (E*E).scalar()
Esq_inv = 1 / Esq
E1 = (e2^e3)*E
E2 = (-1)*(e1^e3)*E
E3 = (e1^e2)*E
w = (E1|e2)
w = w.expand()
assert w.scalar() == 0
w = (E1|e3)
w = w.expand()
assert w.scalar() == 0
w = (E2|e1)
w = w.expand()
assert w.scalar() == 0
w = (E2|e3)
w = w.expand()
assert w.scalar() == 0
w = (E3|e1)
w = w.expand()
assert w.scalar() == 0
w = (E3|e2)
w = w.expand()
assert w.scalar() == 0
w = (E1|e1)
w = (w.expand()).scalar()
Esq = expand(Esq)
assert simplify(w/Esq) == 1
w = (E2|e2)
w = (w.expand()).scalar()
assert simplify(w/Esq) == 1
w = (E3|e3)
w = (w.expand()).scalar()
assert simplify(w/Esq) == 1
示例6: basic_multivector_operations_2D
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
def basic_multivector_operations_2D():
Print_Function()
g2d = Ga('e*x|y')
(ex,ey) = g2d.mv()
print 'g_{ij} =',g2d.g
X = g2d.mv('X','vector')
A = g2d.mv('A','spinor')
X.Fmt(1,'X')
A.Fmt(1,'A')
(X|A).Fmt(2,'X|A')
(X<A).Fmt(2,'X<A')
(A>X).Fmt(2,'A>X')
return
示例7: derivatives_in_spherical_coordinates
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
def derivatives_in_spherical_coordinates():
Print_Function()
X = (r,th,phi) = symbols('r theta phi')
s3d = Ga('e_r e_theta e_phi',g=[1,r**2,r**2*sin(th)**2],coords=X,norm=True)
(er,eth,ephi) = s3d.mv()
grad = s3d.grad
f = s3d.mv('f','scalar',f=True)
A = s3d.mv('A','vector',f=True)
B = s3d.mv('B','bivector',f=True)
print 'f =',f
print 'A =',A
print 'B =',B
print 'grad*f =',grad*f
print 'grad|A =',grad|A
print '-I*(grad^A) =',(-s3d.i*(grad^A)).simplify()
print 'grad^B =',grad^B
示例8: rounding_numerical_components
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
def rounding_numerical_components():
Print_Function()
o3d = Ga('e_x e_y e_z',g=[1,1,1])
(ex,ey,ez) = o3d.mv()
X = 1.2*ex+2.34*ey+0.555*ez
Y = 0.333*ex+4*ey+5.3*ez
print 'X =',X
print 'Nga(X,2) =',Nga(X,2)
print 'X*Y =',X*Y
print 'Nga(X*Y,2) =',Nga(X*Y,2)
return
示例9: basic_multivector_operations_2D_orthogonal
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
def basic_multivector_operations_2D_orthogonal():
Print_Function()
o2d = Ga('e*x|y',g=[1,1])
(ex,ey) = o2d.mv()
print 'g_{ii} =',o2d.g
X = o2d.mv('X','vector')
A = o2d.mv('A','spinor')
X.Fmt(1,'X')
A.Fmt(1,'A')
(X*A).Fmt(2,'X*A')
(X|A).Fmt(2,'X|A')
(X<A).Fmt(2,'X<A')
(X>A).Fmt(2,'X>A')
(A*X).Fmt(2,'A*X')
(A|X).Fmt(2,'A|X')
(A<X).Fmt(2,'A<X')
(A>X).Fmt(2,'A>X')
return
示例10: LieAlgebra
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
class LieAlgebra(object):
def __init__(self,n):
self.n = n
e = ''
ebar = ''
for i in range(1,n+1):
e += ' e_' + str(i)
if GaLatexPrinter.latex_flg:
ebar += r' \bar{e}_' + str(i)
else:
ebar += ' ebar_' + str(i)
g = n * [1] + n * [-1]
basis = e[1:] + ebar
self.Ga = Ga(basis, g=g)
self.basis = self.Ga.mv()
self.e = self.basis[:n]
self.ebar = self.basis[n:]
self.w = []
self.wstar = []
for i in range(n):
self.w.append(self.e[i] + self.ebar[i])
self.wstar.append(self.e[i] - self.ebar[i])
self.Nu_bais = self.w + self.wstar
self.Eij = []
self.Fij = []
self.Ki = []
for i in range(n):
self.Ki.append(self.e[i] * self.ebar[i])
print r'%F_{'+str(i)+'} =',self.Ki[-1] * self.Ki[-1].rev()
for j in range(i):
self.Eij.append(self.e[i] * self.e[j] - self.ebar[i] * self.ebar[j])
self.Fij.append(self.e[i] * self.ebar[j] - self.ebar[i] * self.e[j])
print r'%E_{'+str(i)+str(j)+'} =',self.Eij[-1] * self.Eij[-1].rev()
print r'%F_{'+str(i)+str(j)+'} =',self.Fij[-1] * self.Fij[-1].rev()
print 'K_{i} =',self.Ki
print 'E_{ij} =',self.Eij
print 'F_{ij} =',self.Fij
E = self.Eij[0]/2
for i in range(2*n):
print E
E *= self.Eij[0]/2
示例11: check_generalized_BAC_CAB_formulas
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
def check_generalized_BAC_CAB_formulas():
Print_Function()
g4d = Ga('a b c d')
(a,b,c,d) = g4d.mv()
print 'g_{ij} =',g4d.g
print '\\bm{a|(b*c)} =',a|(b*c)
print '\\bm{a|(b^c)} =',a|(b^c)
print '\\bm{a|(b^c^d)} =',a|(b^c^d)
print '\\bm{a|(b^c)+c|(a^b)+b|(c^a)} =',(a|(b^c))+(c|(a^b))+(b|(c^a))
print '\\bm{a*(b^c)-b*(a^c)+c*(a^b)} =',a*(b^c)-b*(a^c)+c*(a^b)
print '\\bm{a*(b^c^d)-b*(a^c^d)+c*(a^b^d)-d*(a^b^c)} =',a*(b^c^d)-b*(a^c^d)+c*(a^b^d)-d*(a^b^c)
print '\\bm{(a^b)|(c^d)} =',(a^b)|(c^d)
print '\\bm{((a^b)|c)|d} =',((a^b)|c)|d
print '\\bm{(a^b)\\times (c^d)} =',Com(a^b,c^d)
return
示例12: LieBasis
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
def LieBasis(n):
g = n * [1] + n * [-1]
basis = ''
for i in range(1,n+1):
basis += 'e_' +str(i) + ' '
for i in range(1,n+1):
basis += r'\bar{e}_' +str(i) + ' '
basis = basis[:-1]
LieGA = Ga(basis,g=g)
bases = LieGA.mv()
e = bases[:n]
ebar = bases[n:]
print e
print ebar
print LieGA.g
E = []
F = []
K = []
indexes = []
for i in range(n):
K.append(e[i]*ebar[i])
for j in range(n):
if i < j:
indexes.append((i+1,j+1))
E.append(e[i]*e[j]-ebar[i]*ebar[j])
F.append(e[i]*ebar[j]-ebar[i]*e[j])
print indexes
print 'E =',E
print 'F =',F
print 'K =',K,'\n'
for k in range(len(indexes)):
k_i = indexes[k][0]
k_j = indexes[k][1]
for l in range(len(indexes)):
l_i = indexes[l][0]
l_j = indexes[l][1]
print 'E_'+str(k_i)+str(k_j)+' x F_'+str(l_i)+str(l_j)+' = '+str(Com(E[k],F[l]))
return
示例13: conformal_representations_of_circles_lines_spheres_and_planes
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
def conformal_representations_of_circles_lines_spheres_and_planes():
global n,nbar
Print_Function()
g = '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'
cnfml3d = Ga('e_1 e_2 e_3 n nbar',g=g)
(e1,e2,e3,n,nbar) = cnfml3d.mv()
print 'g_{ij} =\n',cnfml3d.g
e = n+nbar
#conformal representation of points
A = make_vector(e1,ga=cnfml3d) # point a = (1,0,0) A = F(a)
B = make_vector(e2,ga=cnfml3d) # point b = (0,1,0) B = F(b)
C = make_vector(-e1,ga=cnfml3d) # point c = (-1,0,0) C = F(c)
D = make_vector(e3,ga=cnfml3d) # point d = (0,0,1) D = F(d)
X = make_vector('x',3,ga=cnfml3d)
print 'F(a) =',A
print 'F(b) =',B
print 'F(c) =',C
print 'F(d) =',D
print 'F(x) =',X
print 'a = e1, b = e2, c = -e1, and d = e3'
print 'A = F(a) = 1/2*(a*a*n+2*a-nbar), etc.'
print 'Circle through a, b, and c'
print 'Circle: A^B^C^X = 0 =',(A^B^C^X)
print 'Line through a and b'
print 'Line : A^B^n^X = 0 =',(A^B^n^X)
print 'Sphere through a, b, c, and d'
print 'Sphere: A^B^C^D^X = 0 =',(((A^B)^C)^D)^X
print 'Plane through a, b, and d'
print 'Plane : A^B^n^D^X = 0 =',(A^B^n^D^X)
L = (A^B^e)^X
L.Fmt(3,'Hyperbolic Circle: (A^B^e)^X = 0 =')
return
示例14: basic_multivector_operations
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
def basic_multivector_operations():
Print_Function()
g3d = Ga('e*x|y|z')
(ex, ey, ez) = g3d.mv()
A = g3d.mv('A', 'mv')
A.Fmt(1, 'A')
A.Fmt(2, 'A')
A.Fmt(3, 'A')
X = g3d.mv('X', 'vector')
Y = g3d.mv('Y', 'vector')
print 'g_{ij} =\n', g3d.g
X.Fmt(1, 'X')
Y.Fmt(1, 'Y')
(X * Y).Fmt(2, 'X*Y')
(X ^ Y).Fmt(2, 'X^Y')
(X | Y).Fmt(2, 'X|Y')
g2d = Ga('e*x|y')
(ex, ey) = g2d.mv()
print 'g_{ij} =\n', g2d.g
X = g2d.mv('X', 'vector')
A = g2d.mv('A', 'spinor')
X.Fmt(1, 'X')
A.Fmt(1, 'A')
(X | A).Fmt(2, 'X|A')
(X < A).Fmt(2, 'X<A')
(A > X).Fmt(2, 'A>X')
o2d = Ga('e*x|y', g=[1, 1])
(ex, ey) = o2d.mv()
print 'g_{ii} =\n', o2d.g
X = o2d.mv('X', 'vector')
A = o2d.mv('A', 'spinor')
X.Fmt(1, 'X')
A.Fmt(1, 'A')
(X * A).Fmt(2, 'X*A')
(X | A).Fmt(2, 'X|A')
(X < A).Fmt(2, 'X<A')
(X > A).Fmt(2, 'X>A')
(A * X).Fmt(2, 'A*X')
(A | X).Fmt(2, 'A|X')
(A < X).Fmt(2, 'A<X')
(A > X).Fmt(2, 'A>X')
return
示例15: reciprocal_frame_test
# 需要导入模块: from sympy.galgebra.ga import Ga [as 别名]
# 或者: from sympy.galgebra.ga.Ga import mv [as 别名]
def reciprocal_frame_test():
Print_Function()
g = '1 # #,'+ \
'# 1 #,'+ \
'# # 1'
g3dn = Ga('e1 e2 e3',g=g)
(e1,e2,e3) = g3dn.mv()
print 'g_{ij} =\n',g3dn.g
E = e1^e2^e3
Esq = (E*E).scalar()
print 'E =',E
print 'E**2 =',Esq
Esq_inv = 1 / Esq
E1 = (e2^e3)*E
E2 = (-1)*(e1^e3)*E
E3 = (e1^e2)*E
print 'E1 = (e2^e3)*E =',E1
print 'E2 =-(e1^e3)*E =',E2
print 'E3 = (e1^e2)*E =',E3
w = (E1|e2)
w = w.expand()
print 'E1|e2 =',w
w = (E1|e3)
w = w.expand()
print 'E1|e3 =',w
w = (E2|e1)
w = w.expand()
print 'E2|e1 =',w
w = (E2|e3)
w = w.expand()
print 'E2|e3 =',w
w = (E3|e1)
w = w.expand()
print 'E3|e1 =',w
w = (E3|e2)
w = w.expand()
print 'E3|e2 =',w
w = (E1|e1)
w = (w.expand()).scalar()
Esq = expand(Esq)
print '(E1|e1)/E**2 =',simplify(w/Esq)
w = (E2|e2)
w = (w.expand()).scalar()
print '(E2|e2)/E**2 =',simplify(w/Esq)
w = (E3|e3)
w = (w.expand()).scalar()
print '(E3|e3)/E**2 =',simplify(w/Esq)
return