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


Python Ga.lt方法代码示例

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


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

示例1: general

# 需要导入模块: from ga import Ga [as 别名]
# 或者: from ga.Ga import lt [as 别名]
print '#2d general ($A,\\;B$ are linear transformations)'
A2d = g2d.lt('A')
print 'A =', A2d
print '\\f{\\det}{A} =', A2d.det()
#A2d.adj().Fmt(4,'\\overline{A}')
print '\\f{\\Tr}{A} =', A2d.tr()
print '\\f{A}{e_u^e_v} =', A2d(eu^ev)
print '\\f{A}{e_u}^\\f{A}{e_v} =', A2d(eu)^A2d(ev)
B2d = g2d.lt('B')
print 'B =', B2d
print 'A + B =', A2d + B2d
print 'AB =', A2d * B2d
print 'A - B =', A2d - B2d
a = g2d.mv('a','vector')
b = g2d.mv('b','vector')
print r'a|\f{\overline{A}}{b}-b|\f{\underline{A}}{a} =',((a|A2d.adj()(b))-(b|A2d(a))).simplify()

print '#4d Minkowski spaqce (Space Time)'
m4d = Ga('e_t e_x e_y e_z', g=[1, -1, -1, -1],coords=symbols('t,x,y,z',real=True))
T = m4d.lt('T')
print 'g =', m4d.g
print r'\underline{T} =',T
print r'\overline{T} =',T.adj()
#m4d.mv(T.det()).Fmt(4,r'\f{\det}{\underline{T}}')
print r'\f{\mbox{tr}}{\underline{T}} =',T.tr()
a = m4d.mv('a','vector')
b = m4d.mv('b','vector')
print r'a|\f{\overline{T}}{b}-b|\f{\underline{T}}{a} =',((a|T.adj()(b))-(b|T(a))).simplify()
xpdf(paper='landscape')
开发者ID:Ignat99,项目名称:galgebra,代码行数:31,代码来源:Ltrans.py

示例2: main

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

    (x, y, z) = xyz = symbols('x,y,z',real=True)
    (o3d, ex, ey, ez) = Ga.build('e_x e_y e_z', g=[1, 1, 1], coords=xyz)
    grad = o3d.grad

    (u, v) = uv = symbols('u,v',real=True)
    (g2d, eu, ev) = Ga.build('e_u e_v', coords=uv)
    grad_uv = g2d.grad

    v_xyz = o3d.mv('v','vector')
    A_xyz = o3d.mv('A','vector',f=True)
    A_uv = g2d.mv('A','vector',f=True)

    print '#3d orthogonal ($A$ is vector function)'
    print 'A =', A_xyz
    print '%A^{2} =', A_xyz * A_xyz
    print 'grad|A =', grad | A_xyz
    print 'grad*A =', grad * A_xyz

    print 'v|(grad*A) =',v_xyz|(grad*A_xyz)

    print '#2d general ($A$ is vector function)'
    print 'A =', A_uv
    print '%A^{2} =', A_uv * A_uv
    print 'grad|A =', grad_uv | A_uv
    print 'grad*A =', grad_uv * A_uv

    A = o3d.lt('A')

    print '#3d orthogonal ($A,\\;B$ are linear transformations)'
    print 'A =', A
    print r'\f{mat}{A} =', A.matrix()
    print '\\f{\\det}{A} =', A.det()
    print '\\overline{A} =', A.adj()
    print '\\f{\\Tr}{A} =', A.tr()
    print '\\f{A}{e_x^e_y} =', A(ex^ey)
    print '\\f{A}{e_x}^\\f{A}{e_y} =', A(ex)^A(ey)

    B = o3d.lt('B')

    print 'g =', o3d.g
    print '%g^{-1} =', o3d.g_inv


    print 'A + B =', A + B
    print 'AB =', A * B
    print 'A - B =', A - B

    print 'General Symmetric Linear Transformation'
    Asym = o3d.lt('A',mode='s')
    print 'A =', Asym
    print 'General Antisymmetric Linear Transformation'
    Aasym = o3d.lt('A',mode='a')
    print 'A =', Aasym

    print '#2d general ($A,\\;B$ are linear transformations)'

    A2d = g2d.lt('A')

    print 'g =', g2d.g
    print '%g^{-1} =', g2d.g_inv
    print '%gg^{-1} =', simplify(g2d.g * g2d.g_inv)

    print 'A =', A2d
    print r'\f{mat}{A} =', A2d.matrix()
    print '\\f{\\det}{A} =', A2d.det()
    A2d_adj = A2d.adj()
    print '\\overline{A} =', A2d_adj
    print '\\f{mat}{\\overline{A}} =', simplify(A2d_adj.matrix())
    print '\\f{\\Tr}{A} =', A2d.tr()
    print '\\f{A}{e_u^e_v} =', A2d(eu^ev)
    print '\\f{A}{e_u}^\\f{A}{e_v} =', A2d(eu)^A2d(ev)

    B2d = g2d.lt('B')



    print 'B =', B2d
    print 'A + B =', A2d + B2d
    print 'AB =', A2d * B2d
    print 'A - B =', A2d - B2d

    a = g2d.mv('a','vector')
    b = g2d.mv('b','vector')

    print r'a|\f{\overline{A}}{b}-b|\f{\underline{A}}{a} =',((a|A2d.adj()(b))-(b|A2d(a))).simplify()

    m4d = Ga('e_t e_x e_y e_z', g=[1, -1, -1, -1],coords=symbols('t,x,y,z',real=True))

    T = m4d.lt('T')

    print 'g =', m4d.g

    print r'\underline{T} =',T
    print r'\overline{T} =',T.adj()

    print r'\f{\det}{\underline{T}} =',T.det()
    print r'\f{\mbox{tr}}{\underline{T}} =',T.tr()
#.........这里部分代码省略.........
开发者ID:brombo,项目名称:galgebra,代码行数:103,代码来源:lin_tran_check.py


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