dummy.rlg 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. Tue Feb 10 12:26:32 2004 run on Linux
  2. % test of DUMMY package version 1.1 running in REDUCE 3.6 and 3.7
  3. % DATE: 15 September 1998
  4. % Authors: H. Caprasse <hubert.caprasse@ulg.ac.be>
  5. %
  6. % Case of commuting operator:
  7. %
  8. operator co1,co2;
  9. % declare dummy indices
  10. % first syntax : base <name>
  11. %
  12. dummy_base dv;
  13. dv
  14. % dummy indices are dv1, dv2, dv3, ...
  15. exp := co2(dv2)*co2(dv2)$
  16. c_exp := canonical(exp);
  17. 2
  18. c_exp := co2(dv1)
  19. exp := dv2*co2(dv2)*co2(dv2)$
  20. c_exp := canonical(exp);
  21. 2
  22. c_exp := co2(dv1) *dv1
  23. exp := c_exp * co1(dv3);
  24. 2
  25. exp := co1(dv3)*co2(dv1) *dv1
  26. c_exp := canonical(exp);
  27. 2
  28. c_exp := co1(dv2)*co2(dv1) *dv1
  29. %
  30. operator a,aa,dd,te;
  31. clear_dummy_base;
  32. t
  33. dummy_names a1,a2,b1,b2,mu1,mu2,nu1,nu2;
  34. t
  35. es1:=a(a1,b1)*a(a2,b2);
  36. es1 := a(a1,b1)*a(a2,b2)
  37. asn14:=aa(mu1,a1)*aa(nu2,b2)*dd(nu1,b1,mu2,a2)
  38. *te(mu1,mu2,nu1,nu2);
  39. asn14 := aa(mu1,a1)*aa(nu2,b2)*dd(nu1,b1,mu2,a2)*te(mu1,mu2,nu1,nu2)
  40. asn17:=aa(mu1,a1)*aa(mu2,a2)*dd(nu1,b1,nu2,b2)
  41. *te(mu1,mu2,nu1,nu2);
  42. asn17 := aa(mu1,a1)*aa(mu2,a2)*dd(nu1,b1,nu2,b2)*te(mu1,mu2,nu1,nu2)
  43. esn14:=es1*asn14;
  44. esn14 :=
  45. a(a1,b1)*a(a2,b2)*aa(mu1,a1)*aa(nu2,b2)*dd(nu1,b1,mu2,a2)*te(mu1,mu2,nu1,nu2)
  46. esn17:=es1*asn17;
  47. esn17 :=
  48. a(a1,b1)*a(a2,b2)*aa(mu1,a1)*aa(mu2,a2)*dd(nu1,b1,nu2,b2)*te(mu1,mu2,nu1,nu2)
  49. esn:=es1*(asn14+asn17);
  50. esn := a(a1,b1)*a(a2,b2)*aa(mu1,a1)*te(mu1,mu2,nu1,nu2)
  51. *(aa(mu2,a2)*dd(nu1,b1,nu2,b2) + aa(nu2,b2)*dd(nu1,b1,mu2,a2))
  52. canonical esn;
  53. a(a1,a2)*a(b1,b2)*aa(mu2,b1)*(aa(mu1,a1)*dd(nu1,b2,nu2,a2)*te(mu2,mu1,nu1,nu2)
  54. + aa(mu1,a2)*dd(nu1,b2,nu2,a1)*te(mu2,nu2,nu1,mu1))
  55. % that the next result is correct is not trivial
  56. % to show.
  57. % for esn14 changes of names are
  58. %
  59. % nu1 -> nu1
  60. % b1 -> b2 -> a2
  61. % mu2 -> nu2 -> mu1 -> mu2
  62. %
  63. % for esn17 they are
  64. %
  65. % nu1 -> nu1
  66. % nu2 -> nu2
  67. % b1 -> b2 -> a2 -> a1 -> b1
  68. %
  69. % the last result should be zero
  70. canonical esn -(canonical esn14 +canonical esn17);
  71. 0
  72. % remove dummy_names and operators.
  73. clear_dummy_names;
  74. t
  75. clear a,aa,dd,te;
  76. %
  77. % Case of anticommuting operators
  78. %
  79. operator ao1, ao2;
  80. anticom ao1, ao2;
  81. t
  82. % product of anticommuting operators with FREE indices
  83. a_exp := ao1(s1)*ao1(s2) - ao1(s2)*ao1(s1);
  84. a_exp := ao1(s1)*ao1(s2) - ao1(s2)*ao1(s1)
  85. a_exp := canonical(a_exp);
  86. a_exp := 2*ao1(s1)*ao1(s2)
  87. % the indices are summed upon, i.e. are DUMMY indices
  88. clear_dummy_names;
  89. t
  90. dummy_base dv;
  91. dv
  92. a_exp := ao1(dv1)*ao1(dv2)$
  93. canonical(a_exp);
  94. 0
  95. a_exp := ao1(dv1)*ao1(dv2) - ao1(dv2)*ao1(dv1);
  96. a_exp := ao1(dv1)*ao1(dv2) - ao1(dv2)*ao1(dv1)
  97. a_exp := canonical(a_exp);
  98. a_exp := 0
  99. a_exp := ao1(dv2,dv3)*ao2(dv1,dv2)$
  100. a_exp := canonical(a_exp);
  101. a_exp := ao1(dv1,dv2)*ao2(dv3,dv1)
  102. a_exp := ao1(dv1)*ao1(dv3)*ao2(dv3)*ao2(dv1)$
  103. a_exp := canonical(a_exp);
  104. a_exp := - ao1(dv1)*ao1(dv2)*ao2(dv1)*ao2(dv2)
  105. % Case of non commuting operators
  106. %
  107. operator no1, no2, no3;
  108. noncom no1, no2, no3;
  109. n_exp := no3(dv2)*no2(dv3)*no1(dv1) + no3(dv3)*no2(dv1)*no1(dv2)
  110. + no3(dv1)*no2(dv2)*no1(dv3);
  111. n_exp := no3(dv1)*no2(dv2)*no1(dv3) + no3(dv2)*no2(dv3)*no1(dv1)
  112. + no3(dv3)*no2(dv1)*no1(dv2)
  113. n_exp:=canonical n_exp;
  114. n_exp := 3*no3(dv3)*no2(dv2)*no1(dv1)
  115. % ***
  116. % The example below displays a restriction of the package i.e
  117. % The non commuting operators are ASSUMED to COMMUTE with the
  118. % anticommuting operators.
  119. % ***
  120. exp := co1(dv1)*ao1(dv2,dv1,dv4)*no1(dv1,dv5)*co2(dv3)*ao1(dv1,dv3);
  121. exp := co1(dv1)*co2(dv3)*(ao1(dv2,dv1,dv4)*no1(dv1,dv5)*ao1(dv1,dv3))
  122. canonical(exp);
  123. - co1(dv1)*co2(dv2)*ao1(dv1,dv2)*ao1(dv3,dv1,dv4)*no1(dv1,dv5)
  124. exp := c_exp * a_exp * no3(dv2)*no2(dv3)*no1(dv1);
  125. 2
  126. exp := - co1(dv2)*co2(dv1) *dv1*ao1(dv1)*ao1(dv2)*ao2(dv1)*ao2(dv2)*no3(dv2)
  127. *no2(dv3)*no1(dv1)
  128. can_exp := canonical(exp);
  129. 2
  130. can_exp := - co1(dv2)*co2(dv1) *dv1*ao1(dv1)*ao1(dv2)*ao2(dv1)*ao2(dv2)
  131. *no3(dv2)*no2(dv3)*no1(dv1)
  132. % Case where some operators have a symmetry.
  133. %
  134. operator as1, as2;
  135. antisymmetric as1, as2;
  136. dummy_base s;
  137. s
  138. % With commuting and antisymmetric:
  139. asc_exp:=as1(s1,s2)*as1(s1,s3)*as1(s3,s4)*co1(s3)*co1(s4)+
  140. 2*as1(s1,s2)*as1(s1,s3)*as1(s3,s4)*co1(s2)*co1(s4)$
  141. canonical asc_exp;
  142. as1(s1,s2)*as1(s1,s3)*as1(s3,s4)*co1(s3)*co1(s4)
  143. % Indeed: the second term is identically zero as one sees
  144. % if the substitutions s2->s4, s4->s2 and
  145. % s1->s3, s3->s1 are sucessively done.
  146. %
  147. % With anticommuting and antisymmetric operators:
  148. dummy_base dv;
  149. dv
  150. exp1 := ao1(dv1)*ao1(dv2)$
  151. canonical(exp1);
  152. 0
  153. exp2 := as1(dv1,dv2)$
  154. canonical(exp2);
  155. 0
  156. canonical(exp1*exp2);
  157. as1(dv1,dv2)*ao1(dv1)*ao1(dv2)
  158. canonical(as1(dv1,dv2)*as2(dv2,dv1));
  159. - as1(dv1,dv2)*as2(dv1,dv2)
  160. % With symmetric and antisymmetric operators:
  161. operator ss1, ss2;
  162. symmetric ss1, ss2;
  163. exp := ss1(dv1,dv2)*ss2(dv1,dv2) - ss1(dv2,dv3)*ss2(dv2,dv3);
  164. exp := ss1(dv1,dv2)*ss2(dv1,dv2) - ss1(dv2,dv3)*ss2(dv2,dv3)
  165. canonical(exp);
  166. 0
  167. exp := as1(dv1,dv2)*as1(dv3,dv4)*as1(dv1,dv4);
  168. exp := as1(dv1,dv2)*as1(dv1,dv4)*as1(dv3,dv4)
  169. canonical(exp);
  170. 0
  171. % The last result is equal to half the sum given below:
  172. %
  173. exp + sub(dv2 = dv3, dv3 = dv2, dv1 = dv4, dv4 = dv1, exp);
  174. 0
  175. exp1 := as2(dv3,dv2)*as1(dv3,dv4)*as1(dv1,dv2)*as1(dv1,dv4);
  176. exp1 := - as1(dv1,dv2)*as1(dv1,dv4)*as1(dv3,dv4)*as2(dv2,dv3)
  177. canonical(exp1);
  178. as1(dv1,dv2)*as1(dv1,dv3)*as1(dv3,dv4)*as2(dv2,dv4)
  179. exp2 := as2(dv1,dv4)*as1(dv1,dv3)*as1(dv2,dv4)*as1(dv2,dv3);
  180. exp2 := as1(dv1,dv3)*as1(dv2,dv3)*as1(dv2,dv4)*as2(dv1,dv4)
  181. canonical(exp2);
  182. as1(dv1,dv2)*as1(dv1,dv3)*as1(dv3,dv4)*as2(dv2,dv4)
  183. canonical(exp1-exp2);
  184. 0
  185. % Indeed:
  186. %
  187. exp2 - sub(dv1 = dv3, dv2 = dv1, dv3 = dv4, dv4 = dv2, exp1);
  188. 0
  189. % Case where mixed or incomplete symmetries for operators are declared.
  190. % Function 'symtree' can be used to declare an operator symmetric
  191. % or antisymmetric:
  192. operator om;
  193. symtree(om,{!+,1,2,3});
  194. exp:=om(dv1,dv2,dv3)+om(dv2,dv1,dv3)+om(dv3,dv2,dv1);
  195. exp := om(dv1,dv2,dv3) + om(dv2,dv1,dv3) + om(dv3,dv2,dv1)
  196. canonical exp;
  197. 3*om(dv1,dv2,dv3)
  198. % Declare om to be antisymmetric in the two last indices ONLY:
  199. symtree(om,{!*,{!*,1},{!-,2,3}});
  200. canonical exp;
  201. 0
  202. % With an antisymmetric operator m:
  203. operator m;
  204. dummy_base s;
  205. s
  206. exp := om(nu,s3,s4)*i*psi*(m(s1,s4)*om(mu,s1,s3)
  207. + m(s2,s3)*om(mu,s4,s2) - m(s1,s3)*om(mu,s1,s4)
  208. - m(s2,s4)*om(mu,s3,s2))$
  209. canonical exp;
  210. - 4*m(s1,s2)*om(mu,s1,s3)*om(nu,s2,s3)*i*psi
  211. % Case of the Riemann tensor
  212. %
  213. operator r;
  214. symtree (r, {!+, {!-, 1, 2}, {!-, 3, 4}});
  215. % Without anty dummy indices.
  216. clear_dummy_base;
  217. t
  218. exp := r(dv1, dv2, dv3, dv4) * r(dv2, dv1, dv4, dv3)$
  219. canonical(exp);
  220. 2
  221. r(dv1,dv2,dv3,dv4)
  222. % With dummy indices:
  223. dummy_base dv;
  224. dv
  225. canonical( r(x,y,z,t) );
  226. - r(t,z,x,y)
  227. canonical( r(x,y,t,z) );
  228. r(t,z,x,y)
  229. canonical( r(t,z,y,x) );
  230. - r(t,z,x,y)
  231. exp := r(dv1, dv2, dv3, dv4) * r(dv2, dv1, dv4, dv3)$
  232. canonical(exp);
  233. 2
  234. r(dv1,dv2,dv3,dv4)
  235. exp := r(dv1, dv2, dv3, dv4) * r(dv1, dv3, dv2, dv4)$
  236. canonical(exp);
  237. r(dv1,dv2,dv3,dv4)*r(dv1,dv3,dv2,dv4)
  238. clear_dummy_base;
  239. t
  240. dummy_names i,j,k,l;
  241. t
  242. exp := r(i,j,k,l)*ao1(i,j)*ao1(k,l)$
  243. canonical(exp);
  244. 0
  245. exp := r(k,i,l,j)*as1(k,i)*as1(k,j)$
  246. canonical(exp);
  247. - as1(i,j)*as1(i,k)*r(i,k,j,l)
  248. % Cleanup of the previousy declared dummy variables..
  249. clear_dummy_names;
  250. t
  251. clear_dummy_base;
  252. t
  253. exp := co1(dv3)$
  254. c_exp := canonical(exp);
  255. c_exp := co1(dv3)
  256. end;
  257. Time for test: 30 ms