atensor


atensor is an algebraic tensor manipulation package

the essence of atensor is a set of simplification rules for the noncommutative product operator   .  

to use atensor, type load(atensor), followed by a call to the init_atensor() function

atensor recognizes several algebra types; the corresponding simplification rules are put into effect when the init_atensor function is called:

--------------------------------------------------------
  algebra              commutator
--------------------------------------------------
  universal           no commutation rules 

  symmetric           u · v − v · u = 0 

  symplectic          u · v − v · u = 2 af (u , v) 

  lie_envelop         u · v − v · u = 2 av (u , v)

  grassmann           u · v + v · u = 0 

  clifford            u · v + v · u = 2 sf (u , v) 
--------------------------------------------------------
here,
sf - symmetric scalar valued function sf (u, v) = sf (v, u)
af - an antisymmetric scalar valued function af (u, v) = − af (v, u)
av - an antisymmetric vector valued function

the init_atensor function also recognizes several predefined algebra types:

functions

init_atensor (alg_type, opt_dims)
init_atensor (alg_type)
initializes the atensor package with the specified algebra type. alg_type can be one of the following:
asymbol
the symbol for base vectors. default value: v
abasep (v)
checks if its argument is an atensor base vector. that is, if it is an indexed symbol, with the symbol being the same as the value of asymbol, and the index having a numeric value between 1 and adim
adim
the dimensionality of the algebra. atensor uses the value of adim to determine if an indexed object is a valid base vector. default value: 0
aform
default values for the bilinear forms sf, af, and av. the default is the identity matrix ident(3)
sf (u, v)
a symmetric scalar function that is used in commutation relations. the default implementation checks if both arguments are base vectors using abasep and if that is the case, substitutes the corresponding value from the matrix aform
af (u, v)
an antisymmetric scalar function that is used in commutation relations. the default implementation checks if both arguments are base vectors using abasep and if that is the case, substitutes the corresponding value from the matrix aform
av (u, v)
an antisymmetric function that is used in commutation relations. the default implementation checks if both arguments are base vectors using abasep and if that is the case, substitutes the corresponding value from the matrix aform
atensimp (expr)
simplifies an algebraic tensor expression expr according to the rules configured by a call to init_atensor. simplification includes recursive application of commutation relations and resolving calls to sf, af and av where applicable

atensor recognizes as base vectors indexed symbols, where the symbol is that stored in asymbol and the index runs between 1 and adim

for indexed symbols only, the bilinear forms sf, af and av are evaluated. the evaluation substitutes the value of aform[i,j] in place of fun(v[i],v[j]) where


example
kill(all)$
load(atensor)$
init_atensor(complex)$
aform;
adim;

t : 1 + 2 * v[1] ;
s : 2 - 2 * v[1] ;
atensimp (t . s) ;
atensimp (s . t) ;
/* compare with */
a : 1 + 2 * %i ;
b : 2 - 2 * %i ;
c : a * b ;
realpart (c) ;
imagpart (c) ;
example: grassmann algebra simplifications
(%i3) init_atensor (grassmann,3)
(%o3)                                done
(%i4) adim
(%o4)                                  3
(%i5) aform
                                  [ 1  0  0 ]
                                  [         ]
(%o5)                             [ 0  1  0 ]
                                  [         ]
                                  [ 0  0  1 ]
(%i6) abasep (v[1])
(%o6)                                true
(%i7) abasep (v[2])
(%o7)                                true
(%i8) abasep (v[3])
(%o8)                                true

(%i9) s : 4*v[1] - 2*v[2]
(%o9)                             4 v  - 2 v
                                     1      2
(%i10) t : (-3)*v[2] + 7*v[3]
(%o10)                            7 v  - 3 v
                                     3      2

(%i13) r1 : atensimp(s . t);
(%o13)           4 (7 (v  . v ) - 3 (v  . v )) - 14 (v  . v )
                        1    3        1    2          2    3

(%i14) ev(r1, v[1]=1, v[2]=1, v[3]=1) ;
(%o14)                                 2

(%i15) r2 : atensimp(t . s) ;
(%o15)           7 (2 (v  . v ) - 4 (v  . v )) + 12 (v  . v )
                        2    3        1    3          1    2

(%i16) ev(r2, v[1]=1, v[2]=1, v[3]=1) ;
(%o16)                                - 2
example : Cayley table for quaternions

we will build the quaternion multiplication table as a matrix by defining the algebra of quaternions as a Clifford-algebra Cl(0,2) with two basis vectors v[1] and v[2]

the three quaternionic imaginary units are then the two basis vectors and their product:

    i = v[1]     j = v[2]     k = v[1]  . v[2]

let us produce Cayley table for quaternions:

     
load (atensor) $
init_atensor (clifford,0,0,2) $

q : zeromatrix (4, 4) $
q[1,1] : 1 $  /* just symbol of multiplication, nothing more */

for i thru adim do
  q[1,i+1] : q[i+1,1] : v[i] $

q[1,4] : q[4,1] : v[1] . v[2] $

for i from 2 thru 4 do
  for j from 2 thru 4 do
    q[i,j] : atensimp (q[i, 1] . q[1, j]) $

q ;

output :

                   [    1        v         v      v  . v  ]
                   [              1         2      1    2 ]
                   [                                      ]
                   [   v         - 1     v  . v    - v    ]
                   [    1                 1    2      2   ]
                   [                                      ]
                   [   v      - v  . v     - 1      v     ]
                   [    2        1    2              1    ]
                   [                                      ]
                   [ v  . v      v        - v       - 1   ]
                   [  1    2      2          1            ]