dummy.rlg 8.2 KB

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