DUMMY.TST 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. % test of DUMMY package version 1.0 running in REDUCE 3.5
  2. % DATE: 15 February 1994
  3. % Authors: A. Dresse <adresse@ulb.ac.be>
  4. % H. Caprasse <caprasse@vm1.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. % dummy indices are dv1, dv2, dv3, ...
  14. exp := co2(dv2)*co2(dv2)$
  15. c_exp := canonical(exp);
  16. exp := dv2*co2(dv2)*co2(dv2)$
  17. c_exp := canonical(exp);
  18. exp := c_exp * co1(dv3);
  19. c_exp := canonical(exp);
  20. % aliases for dummy indices
  21. %
  22. dummy_names i,j,k;
  23. canonical(c_exp);
  24. % remove dummy_names
  25. clear_dummy_names;
  26. % Case of anticommuting operators
  27. %
  28. operator ao1, ao2;
  29. anticom ao1, ao2;
  30. % product of anticommuting operators with FREE indices
  31. a_exp := ao1(s1)*ao1(s2) - ao1(s2)*ao1(s1);
  32. a_exp := canonical(a_exp);
  33. % the indices are summed upon, i.e. are DUMMY indices
  34. a_exp := ao1(dv1)*ao1(dv2)$
  35. canonical(a_exp);
  36. a_exp := ao1(dv1)*ao1(dv2) - ao1(dv2)*ao1(dv1);
  37. a_exp := canonical(a_exp);
  38. a_exp := ao1(dv2,dv3)*ao2(dv1,dv2)$
  39. a_exp := canonical(a_exp);
  40. a_exp := ao1(dv1)*ao1(dv3)*ao2(dv3)*ao2(dv1)$
  41. a_exp := canonical(a_exp);
  42. % Case of non commuting operators
  43. %
  44. operator no1, no2, no3;
  45. noncom no1, no2, no3;
  46. n_exp := no3(dv2)*no2(dv3)*no1(dv1) + no3(dv3)*no2(dv1)*no1(dv2)
  47. + no3(dv1)*no2(dv2)*no1(dv3);
  48. n_exp:=canonical n_exp;
  49. % Case of mixed commutation properties
  50. % ***
  51. % The example below displays a restriction of the package i.e
  52. % The non commuting operators are ASSUMED to COMMUTE with the
  53. % anticommuting operators.
  54. % ***
  55. exp := co1(dv1)*ao1(dv2,dv1,dv4)*no1(dv1,dv5)*co2(dv3)*ao1(dv1,dv3);
  56. canonical(exp);
  57. exp := c_exp * a_exp * no3(dv2)*no2(dv3)*no1(dv1);
  58. can_exp := canonical(exp);
  59. % Case of internal symmetries of operators
  60. %
  61. operator as1, as2;
  62. antisymmetric as1, as2;
  63. clear_dummy_base ;
  64. dummy_base s;
  65. % First a non trivial expression:
  66. asc_exp:=as1(s1,s2)*as1(s1,s3)*as1(s3,s4)*co1(s3)*co1(s4)+
  67. 2*as1(s1,s2)*as1(s1,s3)*as1(s3,s4)*co1(s2)*co1(s4)$
  68. canonical asc_exp;
  69. % Second simple illustrative examples:
  70. clear_dummy_base;
  71. dummy_base dv;
  72. exp1 := ao1(dv1)*ao1(dv2)$
  73. canonical(exp1);
  74. exp2 := as1(dv1,dv2)$
  75. canonical(exp2);
  76. canonical(exp1*exp2);
  77. canonical(as1(dv1,dv2)*as2(dv2,dv1));
  78. operator ss1, ss2;
  79. symmetric ss1, ss2;
  80. exp := ss1(dv1,dv2)*ss2(dv1,dv2) - ss1(dv2,dv3)*ss2(dv2,dv3);
  81. canonical(exp);
  82. exp := as1(dv1,dv2)*as1(dv3,dv4)*as1(dv1,dv4);
  83. canonical(exp);
  84. % Indeed the result is equal to half the sum given below:
  85. %
  86. exp + sub(dv2 = dv3, dv3 = dv2, dv1 = dv4, dv4 = dv1, exp);
  87. exp1 := as2(dv3,dv2)*as1(dv3,dv4)*as1(dv1,dv2)*as1(dv1,dv4);
  88. canonical(exp1);
  89. exp2 := as2(dv1,dv4)*as1(dv1,dv3)*as1(dv2,dv4)*as1(dv2,dv3);
  90. canonical(exp2);
  91. canonical(exp1-exp2);
  92. % Indeed:
  93. %
  94. exp2 - sub(dv1 = dv3, dv2 = dv1, dv3 = dv4, dv4 = dv2, exp1);
  95. % Declare the internal symmetry properties of the Riemann tensor
  96. %
  97. operator r;
  98. symtree (r, {!+, {!-, 1, 2}, {!-, 3, 4}});
  99. canonical( r(x,y,z,t) );
  100. canonical( r(x,y,t,z) );
  101. canonical( r(t,z,y,x) );
  102. exp := r(dv1, dv2, dv3, dv4) * r(dv2, dv1, dv4, dv3)$
  103. canonical(exp);
  104. exp := r(dv1, dv2, dv3, dv4) * r(dv1, dv3, dv2, dv4)$
  105. canonical(exp);
  106. dummy_names i,j,k,l;
  107. canonical(exp);
  108. exp := r(i,j,k,l)*ao1(i,j)*ao1(k,l);
  109. canonical(exp);
  110. exp := r(k,i,l,j)*as1(k,i)*as1(k,j);
  111. canonical(exp);
  112. clear_dummy_names; clear_dummy_base;
  113. exp := co1(dv3)$
  114. c_exp := canonical(exp);
  115. end;