### 27.1 Introduction to atensor

`atensor` is an algebraic tensor manipulation package. To use `atensor`, type `load("atensor")`, followed by a call to the `init_atensor` function.

The essence of `atensor` is a set of simplification rules for the noncommutative (dot) product operator ("`.`"). `atensor` recognizes several algebra types; the corresponding simplification rules are put into effect when the `init_atensor` function is called.

The capabilities of `atensor` can be demonstrated by defining the algebra of quaternions as a Clifford-algebra Cl(0,2) with two basis vectors. The three quaternionic imaginary units are then the two basis vectors and their product, i.e.:

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

Although the `atensor` package has a built-in definition for the quaternion algebra, it is not used in this example, in which we endeavour to build the quaternion multiplication table as a matrix:

    (%i1) load("atensor");
    (%o1)       /share/tensor/atensor.mac
    (%i2) init_atensor(clifford,0,0,2);
    (%o2)                                done
    (%i3) atensimp(v[1].v[1]);
    (%o3)                                 - 1
    (%i4) atensimp((v[1].v[2]).(v[1].v[2]));
    (%o4)                                 - 1
    (%i5) q:zeromatrix(4,4);
                                    [ 0  0  0  0 ]
                                    [            ]
                                    [ 0  0  0  0 ]
    (%o5)                           [            ]
                                    [ 0  0  0  0 ]
                                    [            ]
                                    [ 0  0  0  0 ]
    (%i6) q[1,1]:1;
    (%o6)                                  1
    (%i7) for i thru adim do q[1,i+1]:q[i+1,1]:v[i];
    (%o7)                                done
    (%i8) q[1,4]:q[4,1]:v[1].v[2];
    (%o8)                               v  . v
                                         1    2
    (%i9) for i from 2 thru 4 do for j from 2 thru 4 do
          q[i,j]:atensimp(q[i,1].q[1,j]);
    (%o9)                                done
    (%i10) q;

                       [    1        v         v      v  . v  ]
                       [              1         2      1    2 ]
                       [                                      ]
                       [   v         - 1     v  . v    - v    ]
                       [    1                 1    2      2   ]
    (%o10)             [                                      ]
                       [   v      - v  . v     - 1      v     ]
                       [    2        1    2              1    ]
                       [                                      ]
                       [ v  . v      v        - v       - 1   ]
                       [  1    2      2          1            ]

`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, and 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 `v` represents the value of `asymbol` and `fun` is either `af` or `sf`; or, it substitutes `v[aform[i,j]]` in place of `av(v[i],v[j])`.

Needless to say, the functions `sf`, `af` and `av` can be redefined.

When the `atensor` package is loaded, the following flags are set:

    dotscrules:true;
    dotdistrib:true;
    dotexptsimp:false;

If you wish to experiment with a nonassociative algebra, you may also consider setting `dotassoc` to `false`. In this case, however, `atensimp` will not always be able to obtain the desired simplifications.

Categories:Tensors ·Share packages ·Package atensor ·