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


Python Ga.set_simp方法代码示例

本文整理汇总了Python中ga.Ga.set_simp方法的典型用法代码示例。如果您正苦于以下问题:Python Ga.set_simp方法的具体用法?Python Ga.set_simp怎么用?Python Ga.set_simp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ga.Ga的用法示例。


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

示例1: main

# 需要导入模块: from ga import Ga [as 别名]
# 或者: from ga.Ga import set_simp [as 别名]
def main():
    #Eprint()
    Format()

    o3d = Ga.preset('o3d')
    print 'I =',o3d.I
    x,y,z = o3d.coords

    (ex,ey,ez) = o3d.mv()

    u, v, w = o3d.mv('u v w', 'vector')

    print '# 3D Orthogonal Rectangular Coordinates'

    print 'u =',u
    print 'v =',v
    print 'w =',w

    uv = u^v
    print 'u^v =',uv
    uvw = u^v^w
    print 'u^v^w =',uvw

    print '(e_x+e_y)(e_y+e_z) =',(ex+ey)*(ey+ez)

    print r'\nabla =',o3d.grad
    print r'\dot{\nabla} =',o3d.grad

    f= o3d.mv('F', 'vector',f=True)
    print 'F =',f
    print r'\nabla F =',o3d.grad*f
    print r'F \dot{\nabla} =',f*o3d.rgrad
    print r'F \nabla =',f*o3d.grad
    print r'\dot{\nabla} F =',o3d.rgrad*f
    print r'F | \nabla =',f | o3d.grad

    G = y * z * ex + y ** 2 * ey + z ** 3 * ez

    print 'G =',G
    print r'\nabla G =', o3d.grad * G
    print r'\nabla ^ G =', o3d.grad ^ G
    print '#3D Orthogonal Spherical Coordinates'

    sp3d = Ga.preset('sph3d')
    r, th, phi = sp3d.coords
    er, eth, ephi = sp3d.mv()
    f, F = sp3d.mv('f F','scalar vector',f=True)

    print 'f =',f
    print r'\nabla =',sp3d.grad
    print r'\nabla f =',sp3d.grad*f
    print 'F =',F
    print r'\nabla | F =',sp3d.grad|F
    print r'-I\nabla ^ F =',-sp3d.I*(sp3d.grad^F)

    Lap = sp3d.grad|sp3d.grad

    print r'%\nabla^{2} =',Lap
    print r'%\nabla^{2} f =',Lap*f

    print '#Parabolic submanifold $[u,v,u^{2}+v^{2}]$ of o3d'

    sm_coords = (u,v) = symbols('u,v',real=True)

    Ga.set_simp(1,1,1)  # Additionally turn on combining fractions

    para = o3d.sm([u,v,u**2+v**2],sm_coords)

    print 'g_{parabolic} =', para.g

    (eu,ev) = para.mv()
    para_grad = para.grad

    print r'\nabla_{parabolic} =',para_grad

    f,F = para.mv('f F','scalar vector',f=True)

    print 'f = ', f
    print 'F = ', F

    print r'\nabla_{parabolic} f =',para_grad*f
    print r'\nabla_{parabolic} | F =',para_grad|F
    print r'\nabla_{parabolic} ^ F =',para_grad^F
    print r'\nabla_{parabolic}  F =',para_grad*F

    Ga.set_simp(1,1,0)  # Additionally turn off combining fractions

    sph = o3d.sm([sin(u)*cos(v),sin(u)*sin(v),cos(u)],sm_coords)

    print '#Spherical submanifold $[sin(u)*cos(v),sin(u)*sin(v),cos(u)]$ of o3d'

    (eu,ev) = sph.mv()
    sph_grad = sph.grad

    print 'g_{sphere} =', sph.g

    print r'\nabla_{spherical} =',sph_grad

    f,F = sph.mv('f F','scalar vector',f=True)

#.........这里部分代码省略.........
开发者ID:Ignat99,项目名称:galgebra,代码行数:103,代码来源:simple_check.py


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