dummy.tst 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. % test of DUMMY package version 1.1 running in REDUCE 3.6 and 3.7
  2. % DATE: 15 September 1998
  3. % Authors: H. Caprasse <hubert.caprasse@ulg.ac.be>
  4. %
  5. % Case of commuting operator:
  6. %
  7. operator co1,co2;
  8. % declare dummy indices
  9. % first syntax : base <name>
  10. %
  11. dummy_base dv;
  12. % dummy indices are dv1, dv2, dv3, ...
  13. exp := co2(dv2)*co2(dv2)$
  14. c_exp := canonical(exp);
  15. exp := dv2*co2(dv2)*co2(dv2)$
  16. c_exp := canonical(exp);
  17. exp := c_exp * co1(dv3);
  18. c_exp := canonical(exp);
  19. %
  20. operator a,aa,dd,te;
  21. clear_dummy_base;
  22. dummy_names a1,a2,b1,b2,mu1,mu2,nu1,nu2;
  23. es1:=a(a1,b1)*a(a2,b2);
  24. asn14:=aa(mu1,a1)*aa(nu2,b2)*dd(nu1,b1,mu2,a2)
  25. *te(mu1,mu2,nu1,nu2);
  26. asn17:=aa(mu1,a1)*aa(mu2,a2)*dd(nu1,b1,nu2,b2)
  27. *te(mu1,mu2,nu1,nu2);
  28. esn14:=es1*asn14;
  29. esn17:=es1*asn17;
  30. esn:=es1*(asn14+asn17);
  31. canonical esn;
  32. % that the next result is correct is not trivial
  33. % to show.
  34. % for esn14 changes of names are
  35. %
  36. % nu1 -> nu1
  37. % b1 -> b2 -> a2
  38. % mu2 -> nu2 -> mu1 -> mu2
  39. %
  40. % for esn17 they are
  41. %
  42. % nu1 -> nu1
  43. % nu2 -> nu2
  44. % b1 -> b2 -> a2 -> a1 -> b1
  45. %
  46. % the last result should be zero
  47. canonical esn -(canonical esn14 +canonical esn17);
  48. % remove dummy_names and operators.
  49. clear_dummy_names;
  50. clear a,aa,dd,te;
  51. %
  52. % Case of anticommuting operators
  53. %
  54. operator ao1, ao2;
  55. anticom ao1, ao2;
  56. % product of anticommuting operators with FREE indices
  57. a_exp := ao1(s1)*ao1(s2) - ao1(s2)*ao1(s1);
  58. a_exp := canonical(a_exp);
  59. % the indices are summed upon, i.e. are DUMMY indices
  60. clear_dummy_names;
  61. dummy_base dv;
  62. a_exp := ao1(dv1)*ao1(dv2)$
  63. canonical(a_exp);
  64. a_exp := ao1(dv1)*ao1(dv2) - ao1(dv2)*ao1(dv1);
  65. a_exp := canonical(a_exp);
  66. a_exp := ao1(dv2,dv3)*ao2(dv1,dv2)$
  67. a_exp := canonical(a_exp);
  68. a_exp := ao1(dv1)*ao1(dv3)*ao2(dv3)*ao2(dv1)$
  69. a_exp := canonical(a_exp);
  70. % Case of non commuting operators
  71. %
  72. operator no1, no2, no3;
  73. noncom no1, no2, no3;
  74. n_exp := no3(dv2)*no2(dv3)*no1(dv1) + no3(dv3)*no2(dv1)*no1(dv2)
  75. + no3(dv1)*no2(dv2)*no1(dv3);
  76. n_exp:=canonical n_exp;
  77. % ***
  78. % The example below displays a restriction of the package i.e
  79. % The non commuting operators are ASSUMED to COMMUTE with the
  80. % anticommuting operators.
  81. % ***
  82. exp := co1(dv1)*ao1(dv2,dv1,dv4)*no1(dv1,dv5)*co2(dv3)*ao1(dv1,dv3);
  83. canonical(exp);
  84. exp := c_exp * a_exp * no3(dv2)*no2(dv3)*no1(dv1);
  85. can_exp := canonical(exp);
  86. % Case where some operators have a symmetry.
  87. %
  88. operator as1, as2;
  89. antisymmetric as1, as2;
  90. dummy_base s;
  91. % With commuting and antisymmetric:
  92. asc_exp:=as1(s1,s2)*as1(s1,s3)*as1(s3,s4)*co1(s3)*co1(s4)+
  93. 2*as1(s1,s2)*as1(s1,s3)*as1(s3,s4)*co1(s2)*co1(s4)$
  94. canonical asc_exp;
  95. % Indeed: the second term is identically zero as one sees
  96. % if the substitutions s2->s4, s4->s2 and
  97. % s1->s3, s3->s1 are sucessively done.
  98. %
  99. % With anticommuting and antisymmetric operators:
  100. dummy_base dv;
  101. exp1 := ao1(dv1)*ao1(dv2)$
  102. canonical(exp1);
  103. exp2 := as1(dv1,dv2)$
  104. canonical(exp2);
  105. canonical(exp1*exp2);
  106. canonical(as1(dv1,dv2)*as2(dv2,dv1));
  107. % With symmetric and antisymmetric operators:
  108. operator ss1, ss2;
  109. symmetric ss1, ss2;
  110. exp := ss1(dv1,dv2)*ss2(dv1,dv2) - ss1(dv2,dv3)*ss2(dv2,dv3);
  111. canonical(exp);
  112. exp := as1(dv1,dv2)*as1(dv3,dv4)*as1(dv1,dv4);
  113. canonical(exp);
  114. % The last result is equal to half the sum given below:
  115. %
  116. exp + sub(dv2 = dv3, dv3 = dv2, dv1 = dv4, dv4 = dv1, exp);
  117. exp1 := as2(dv3,dv2)*as1(dv3,dv4)*as1(dv1,dv2)*as1(dv1,dv4);
  118. canonical(exp1);
  119. exp2 := as2(dv1,dv4)*as1(dv1,dv3)*as1(dv2,dv4)*as1(dv2,dv3);
  120. canonical(exp2);
  121. canonical(exp1-exp2);
  122. % Indeed:
  123. %
  124. exp2 - sub(dv1 = dv3, dv2 = dv1, dv3 = dv4, dv4 = dv2, exp1);
  125. % Case where mixed or incomplete symmetries for operators are declared.
  126. % Function 'symtree' can be used to declare an operator symmetric
  127. % or antisymmetric:
  128. operator om;
  129. symtree(om,{!+,1,2,3});
  130. exp:=om(dv1,dv2,dv3)+om(dv2,dv1,dv3)+om(dv3,dv2,dv1);
  131. canonical exp;
  132. % Declare om to be antisymmetric in the two last indices ONLY:
  133. symtree(om,{!*,{!*,1},{!-,2,3}});
  134. canonical exp;
  135. % With an antisymmetric operator m:
  136. operator m;
  137. dummy_base s;
  138. exp := om(nu,s3,s4)*i*psi*(m(s1,s4)*om(mu,s1,s3)
  139. + m(s2,s3)*om(mu,s4,s2) - m(s1,s3)*om(mu,s1,s4)
  140. - m(s2,s4)*om(mu,s3,s2))$
  141. canonical exp;
  142. % Case of the Riemann tensor
  143. %
  144. operator r;
  145. symtree (r, {!+, {!-, 1, 2}, {!-, 3, 4}});
  146. % Without anty dummy indices.
  147. clear_dummy_base;
  148. exp := r(dv1, dv2, dv3, dv4) * r(dv2, dv1, dv4, dv3)$
  149. canonical(exp);
  150. % With dummy indices:
  151. dummy_base dv;
  152. canonical( r(x,y,z,t) );
  153. canonical( r(x,y,t,z) );
  154. canonical( r(t,z,y,x) );
  155. exp := r(dv1, dv2, dv3, dv4) * r(dv2, dv1, dv4, dv3)$
  156. canonical(exp);
  157. exp := r(dv1, dv2, dv3, dv4) * r(dv1, dv3, dv2, dv4)$
  158. canonical(exp);
  159. clear_dummy_base;
  160. dummy_names i,j,k,l;
  161. exp := r(i,j,k,l)*ao1(i,j)*ao1(k,l)$
  162. canonical(exp);
  163. exp := r(k,i,l,j)*as1(k,i)*as1(k,j)$
  164. canonical(exp);
  165. % Cleanup of the previousy declared dummy variables..
  166. clear_dummy_names; clear_dummy_base;
  167. exp := co1(dv3)$
  168. c_exp := canonical(exp);
  169. end;