Esempio n. 1
0
import sys
import sympy
import sympy.galgebra.GAsympy as GA
import sympy.galgebra.latex_ex as tex

if __name__ == '__main__':

    metric = '1  0  0  0,' \
             '0 -1  0  0,' \
             '0  0 -1  0,' \
             '0  0  0 -1'

    vars = sympy.symbols('t x y z')
    gamma_t, gamma_x, gamma_y, gamma_z = GA.MV.setup(
        'gamma_t gamma_x gamma_y gamma_z', metric, True, vars)
    tex.Format()
    I = GA.MV(1, 'pseudo')
    I.convert_to_blades()
    print '$I$ Pseudo-Scalar'
    print 'I =', I
    B = GA.MV('B', 'vector', fct=True)
    E = GA.MV('E', 'vector', fct=True)
    B.set_coef(1, 0, 0)
    E.set_coef(1, 0, 0)
    B *= gamma_t
    E *= gamma_t
    B.convert_to_blades()
    E.convert_to_blades()
    J = GA.MV('J', 'vector', fct=True)
    print '$B$ Magnetic Field Bi-Vector'
    print 'B = Bvec gamma_0 =', B
Esempio n. 2
0
def generate_output_2(output):
    """ See sympy's GA module online """ 
    tex.Format()
    tex.sym_format(1)
    x = tex.print_LaTeX(output)
    print x