atensor.tst 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. %*********************************************************************
  2. % ATENSOR TEST RUN.
  3. %
  4. % V.A.Ilyin & A.P.Kryukov
  5. % E-mail: ilyin@theory.npi.msu.su
  6. % kryukov@theory.npi.msu.su
  7. %
  8. % Nucl. Phys. Inst., Moscow State Univ.
  9. % 119899 Moscow, RUSSIA
  10. %*********************************************************************
  11. % First of all we have to load the ATENSOR program using the one of the
  12. % following command:
  13. % 1) in "atensor.red"$ % If we load source code
  14. % 2) load atensor$ % If we load binary (compiled) code.
  15. load atensor;
  16. % To control of total execution time clear timer:
  17. showtime;
  18. % Switch on the switch TIME to control of executing time
  19. % for each statement.
  20. %on time$
  21. % Let us introduce the antisymmetric tensor of the second order.
  22. tensor a2;
  23. % The antisymmetric property can be expressed as:
  24. tsym a2(i,j)+a2(j,i);
  25. % The K-basis that span K subspace is:
  26. kbasis a2;
  27. % Let us input very simple example:
  28. a2(k,k);
  29. % By the way the next two expressions looks like different ones:
  30. a2(i,j);
  31. a2(j,i);
  32. % But the difference of them has a correct value:
  33. a2(j,i)-a2(i,j);
  34. % Next examples. For this purpose we introduce 3 abstract
  35. % vectors - v1,v2,v3:
  36. tensor v1,v2,v3;
  37. % The following expression equal zero:
  38. a2(i,j)*v1(i)*v1(j);
  39. % It is interest that the result is consequence of the equivalence
  40. % of the name of tensors.
  41. % While the next one - not:
  42. a2(i,j)*v1(i)*v2(j);
  43. % Well. Let us introduce the symmetric tensor of the second order.
  44. tensor s2;
  45. tsym s2(i,j)-s2(j,i);
  46. % Their K-basis look like for a2 excepted sign:
  47. kbasis s2;
  48. % Of course the contraction symmetric and antisymmetric tensors
  49. % equal zero:
  50. a2(i,j)*s2(i,j);
  51. % By the way, the next example not so trivial for computer...
  52. a2(i,j)*a2(j,k)*a2(k,i);
  53. % Much more interesting examples we can demonstrate with the
  54. % the tensor higher order. For example full antisymmetric tensor
  55. % of the third order:
  56. tensor a3;
  57. % The antisymmetric property we can introduce through the
  58. % permutation of the two first indices:
  59. tsym a3(i,j,k)+a3(j,i,k);
  60. % And the cyclic permutation all of them:
  61. tsym a3(i,j,k)-a3(j,k,i);
  62. % The K basis of a3 consist of 5 vectors:
  63. kbasis a3;
  64. % In the beginning some very simple examples:
  65. a3(i,k,i);
  66. a3(i,j,k)*s2(i,j);
  67. % The full symmetric tensor of the third order may be introduce
  68. % by the similar way:
  69. tensor s3;
  70. tsym s3(i,j,k)-s3(j,i,k);
  71. tsym s3(i,j,k)-s3(j,k,i);
  72. kbasis s3;
  73. % The next examples demonstrate some calculation with them:
  74. s3(i,j,k)-s3(i,k,j);
  75. s3(i,j,k)*a2(i,j);
  76. a3(i,j,k)*s2(i,j);
  77. s3(i,j,k)*a3(i,j,k);
  78. % Now we consider very important physical case - Rieman tensor:
  79. tensor ri;
  80. % It has the antisymmetric property with respect to the permutation
  81. % of the first two indices:
  82. tsym ri(i,j,k,l) + ri(j,i,k,l);
  83. % It has the antisymmetric property with respect to the permutation
  84. % of the second two indices:
  85. tsym ri(i,j,k,l) + ri(i,j,l,k);
  86. % And the triple term identity with cyclic permutation the
  87. % third of them:
  88. tsym ri(i,j,k,l) + ri(i,k,l,j) + ri(i,l,j,k);
  89. % The corresponding K basis consist of 22(!) vectors:
  90. kbasis ri;
  91. % So we get the answer for any expressions with 3 and more terms of
  92. % Rieman tensors with not more then 2 terms. For example:
  93. ri(i,j,k,l)+ri(j,k,l,i)+ri(k,l,i,j)+ri(l,i,j,k);
  94. % This three identities leads us to very important symmetry property with
  95. % respect to exchange of pairs indices:
  96. ri(i,j,k,l)-ri(k,l,i,j);
  97. % Let us start with simple example:
  98. ri(m,n,m,n)-ri(m,n,n,m);
  99. % Much more complicated example is:
  100. a2(m,n)*ri(m,n,c,d) + a2(k,l)*ri(c,d,l,k);
  101. % The answer is trivial but not so simple to obtain one.
  102. % The dimension of the full space is 6! = 720.
  103. % The K basis consists of 690 vectors (to reduce output we
  104. % commented the last statement):
  105. %kbasis ri(a2);
  106. % One else nontrivial examples with Riemann tensors:
  107. (ri(i,j,k,l)-ri(i,k,j,l))*a2(i,j);
  108. %***************** END OF TEST RUN ************************
  109. % The total execution time is:
  110. showtime;
  111. $END$