本文整理汇总了Python中ga.Ga.sm方法的典型用法代码示例。如果您正苦于以下问题:Python Ga.sm方法的具体用法?Python Ga.sm怎么用?Python Ga.sm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ga.Ga
的用法示例。
在下文中一共展示了Ga.sm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Ga
# 需要导入模块: from ga import Ga [as 别名]
# 或者: from ga.Ga import sm [as 别名]
sp3d = Ga('e_r,e_th,e_ph', g=[1, r**2, r**2*sin(th)**2], coords=coords)
(er, eth, ephi) = sp3d.mv()
#Define coordinates for 2-d (u,v) and 1-d (s) manifolds
u,v,s,alpha = symbols('u v s alpha',real=True)
sub_coords = (u,v)
smap = [1, u, v] # Coordinate map for sphere of r = 1 in 3-d
print r'(u,v)\rightarrow (r,\theta,\phi) = ',smap
#Define unit sphere manifold
sph2d = sp3d.sm(smap,sub_coords)
print '#Unit Sphere Manifold:'
print 'g =',sph2d.g
(eu,ev) = sph2d.mv()
#Define vector and vector field on unit sphere tangent space
a = sph2d.mv('a','vector')
b = sph2d.mv('b','vector')
c = sph2d.mv('c','vector')
f = sph2d.mv('f','vector',f=True)
print 'a =', a
示例2: Format
# 需要导入模块: from ga import Ga [as 别名]
# 或者: from ga.Ga import sm [as 别名]
from sympy import symbols, sin, pi, latex
from ga import Ga
from printer import Format, xpdf
Format()
coords = (r, th, phi) = symbols('r,theta,phi', real=True)
sp3d = Ga('e_r e_th e_ph', g=[1, r**2, r**2*sin(th)**2], coords=coords, norm=True)
sph_uv = (u, v) = symbols('u,v', real=True)
sph_map = [1, u, v] # Coordinate map for sphere of r = 1
sph2d = sp3d.sm(sph_map,sph_uv)
print r'(u,v)\rightarrow (r,\theta,\phi) = ',latex(sph_map)
print 'g =',latex(sph2d.g)
F = sph2d.mv('F','vector',f=True) #scalar function
f = sph2d.mv('f','scalar',f=True) #vector function
print r'\nabla f =',sph2d.grad * f
print 'F =',F
print r'\nabla F = ',sph2d.grad * F
cir_s = s = symbols('s',real=True)
cir_map = [pi/8,s]
cir1d = sph2d.sm(cir_map,(cir_s,))
print 'g =',latex(cir1d.g)
h = cir1d.mv('h','scalar',f=True)
H = cir1d.mv('H','vector',f=True)
print r'(s)\rightarrow (u,v) = ',latex(cir_map)
print 'H =', H
print latex(H)
print r'\nabla h =', cir1d.grad * h