File r38/packages/atensor/atensor.rlg artifact fa895dc175 part of check-in e08999f63f


Tue Feb 10 12:26:32 2004 run on Linux
%*********************************************************************
%                          ATENSOR  TEST  RUN.
%
%                       V.A.Ilyin & A.P.Kryukov
%                  E-mail:   ilyin@theory.npi.msu.su
%                          kryukov@theory.npi.msu.su
%
%                Nucl. Phys. Inst., Moscow State Univ. 
%                        119899 Moscow, RUSSIA
%*********************************************************************

% First of all we have to load the ATENSOR program using the one of the
% following command:
%       1) in "atensor.red"$         % If we load source code
%       2) load atensor$             % If we load binary (compiled) code.
load atensor;



% To control of total execution time clear timer:
showtime;


Time: 0 ms


% Switch on the switch TIME to control of executing time 
% for each statement.
%on time$

% Let us introduce the antisymmetric tensor of the second order.
tensor a2;



% The antisymmetric property can be expressed as:
tsym a2(i,j)+a2(j,i);



% The K-basis that span K subspace is:
kbasis a2;

a2(i,j) + a2(j,i)
1


% Let us input very simple example:
a2(k,k);


0


% By the way the next two expressions looks like different ones:
a2(i,j);


a2(i,j)

a2(j,i);


a2(j,i)


% But the difference of them has a correct value:
a2(j,i)-a2(i,j);


2*a2(j,i)


% Next examples. For this purpose we introduce 3 abstract 
% vectors - v1,v2,v3:
tensor v1,v2,v3;



% The following expression equal zero:
a2(i,j)*v1(i)*v1(j);


0

% It is interest that the result is consequence of the equivalence 
% of the name of tensors.

% While the next one - not:
a2(i,j)*v1(i)*v2(j);


a2(i,j)*v1(i)*v2(j)


% Well. Let us introduce the symmetric tensor of the second order.
tensor s2;


tsym s2(i,j)-s2(j,i);



% Their K-basis look like for a2 excepted sign:
kbasis s2;

s2(j,i) + (-1)*s2(i,j)
1


% Of course the contraction symmetric  and antisymmetric tensors 
% equal zero:
a2(i,j)*s2(i,j);


0


% By the way, the next example not so trivial for computer...
a2(i,j)*a2(j,k)*a2(k,i);


0


% Much more interesting examples we can demonstrate with the
% the tensor higher order. For example full antisymmetric tensor
% of the third order:
tensor a3;



% The antisymmetric property we can introduce through the 
% permutation of the two first indices: 
tsym a3(i,j,k)+a3(j,i,k);



% And the cyclic permutation all of them:
tsym a3(i,j,k)-a3(j,k,i);



% The K basis of a3 consist of 5 vectors:
kbasis a3;

a3(k,i,j) + a3(j,i,k)
a3(k,j,i) + (-1)*a3(j,i,k)
a3(i,k,j) + (-1)*a3(j,i,k)
a3(i,j,k) + a3(j,i,k)
a3(j,k,i) + a3(j,i,k)
5


% In the beginning some very simple examples:
a3(i,k,i);


0

a3(i,j,k)*s2(i,j);


0


% The full symmetric tensor of the third order may be introduce
% by the similar way: 
tensor s3;


tsym s3(i,j,k)-s3(j,i,k);


tsym s3(i,j,k)-s3(j,k,i);


kbasis s3;

s3(k,j,i) + (-1)*s3(i,j,k)
s3(k,i,j) + (-1)*s3(i,j,k)
s3(j,k,i) + (-1)*s3(i,j,k)
s3(j,i,k) + (-1)*s3(i,j,k)
s3(i,k,j) + (-1)*s3(i,j,k)
5


% The next examples demonstrate some calculation with them:
s3(i,j,k)-s3(i,k,j);


0

s3(i,j,k)*a2(i,j);


0

a3(i,j,k)*s2(i,j);


0

s3(i,j,k)*a3(i,j,k);


0



% Now we consider very important physical case - Rieman tensor:
tensor ri;



% It has the antisymmetric property with respect to the permutation
% of the first two indices:
tsym ri(i,j,k,l) + ri(j,i,k,l);



% It has the antisymmetric property with respect to the permutation
% of the second two indices:
tsym ri(i,j,k,l) + ri(i,j,l,k);



% And the triple term identity with cyclic permutation the 
% third of them:
tsym ri(i,j,k,l) + ri(i,k,l,j) + ri(i,l,j,k);



% The corresponding K basis consist of 22(!) vectors:
kbasis ri;

ri(l,k,i,j) + (-1)*ri(j,i,k,l)
ri(l,k,j,i) + ri(j,i,k,l)
ri(l,i,k,j) + (-1)*ri(j,k,i,l)
ri(l,i,j,k) + ri(j,k,i,l)
ri(l,j,k,i) + (-1)*ri(j,k,i,l) + ri(j,i,k,l)
ri(l,j,i,k) + ri(j,k,i,l) + (-1)*ri(j,i,k,l)
ri(k,l,i,j) + ri(j,i,k,l)
ri(k,l,j,i) + (-1)*ri(j,i,k,l)
ri(k,i,l,j) + (-1)*ri(j,k,i,l) + ri(j,i,k,l)
ri(k,i,j,l) + ri(j,k,i,l) + (-1)*ri(j,i,k,l)
ri(k,j,l,i) + (-1)*ri(j,k,i,l)
ri(k,j,i,l) + ri(j,k,i,l)
ri(i,l,k,j) + ri(j,k,i,l)
ri(i,l,j,k) + (-1)*ri(j,k,i,l)
ri(i,k,l,j) + ri(j,k,i,l) + (-1)*ri(j,i,k,l)
ri(i,k,j,l) + (-1)*ri(j,k,i,l) + ri(j,i,k,l)
ri(i,j,l,k) + (-1)*ri(j,i,k,l)
ri(i,j,k,l) + ri(j,i,k,l)
ri(j,l,k,i) + ri(j,k,i,l) + (-1)*ri(j,i,k,l)
ri(j,l,i,k) + (-1)*ri(j,k,i,l) + ri(j,i,k,l)
ri(j,k,l,i) + ri(j,k,i,l)
ri(j,i,l,k) + ri(j,i,k,l)
22


% So we get the answer for any expressions with 3 and more terms of 
% Rieman tensors with not more then 2 terms. For example:
ri(i,j,k,l)+ri(j,k,l,i)+ri(k,l,i,j)+ri(l,i,j,k);


(-2)*ri(l,j,i,k) + 4*ri(l,i,j,k)
 

% This three identities leads us to very important symmetry property with
% respect to exchange of pairs indices:
ri(i,j,k,l)-ri(k,l,i,j);


0


% Let us start with simple example:
ri(m,n,m,n)-ri(m,n,n,m);


2*ri(m,n,m,n)


% Much more complicated example is:
a2(m,n)*ri(m,n,c,d) + a2(k,l)*ri(c,d,l,k);


0

% The answer is trivial but not so simple to obtain one.

% The dimension of the full space is 6! = 720.
% The K basis consists of 690 vectors (to reduce output we 
% commented the last statement):
%kbasis ri(a2);

% One else nontrivial examples with Riemann tensors:
(ri(i,j,k,l)-ri(i,k,j,l))*a2(i,j);


 a2(i,j)*ri(i,j,k,l)
---------------------
          2


%***************** END OF TEST RUN ************************
% The total execution time is:
showtime;


Time: 9370 ms  plus GC time: 60 ms


$

END$


Time for test: 9370 ms, plus GC time: 60 ms


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]