physop.rlg 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. Tue Feb 10 12:26:52 2004 run on Linux
  2. COMMENT
  3. test file for the PHYSOP package;
  4. % load_package physop; % Load a compiled version of the physop package.
  5. % showtime;
  6. linelength(72)$
  7. % Example 1: Quantum Mechanics of a Dirac particle in an external
  8. % electromagnetic field
  9. VECOP P,A,K;
  10. SCALOP M;
  11. NONCOM P,A;
  12. PHYSINDEX J,L;
  13. oporder M,K,A,P;
  14. % we have to set off allfac here since otherwise there appear
  15. % spurious negative powers in the printed output
  16. off allfac;
  17. FOR ALL J,L LET COMM(P(J),A(L))=K(J)*A(L);
  18. H:= COMMUTE(P**2/(2*M),E/(4*M**2)*(P DOT A));
  19. -1 -1 -1
  20. h := (2*e*(m )*(m )*(m )*k(idx1)*a(idx2)*p(idx1)*p(idx2)
  21. -1 -1 -1
  22. + e*(m )*(m )*(m )*k(idx1)*k(idx1)*a(idx2)*p(idx2)
  23. -1 -1 -1
  24. + e*(m )*(m )*(m )*k(idx1)*k(idx1)*k(idx2)*a(idx2)
  25. -1 -1 -1
  26. + 2*e*(m )*(m )*(m )*k(idx1)*k(idx2)*a(idx2)*p(idx1))/8
  27. % showtime;
  28. %assign the corresponding value to the adjoint of H
  29. H!+ := adj H;
  30. + + + + + -1 -1
  31. (h ) := (e*(a(idx2) )*(k(idx1) )*(k(idx1) )*(k(idx2) )*(m!+ )*(m!+ )
  32. -1 + + + +
  33. *(m!+ ) + 2*e*(p(idx1) )*(a(idx2) )*(k(idx1) )*(k(idx2) )
  34. -1 -1 -1 + + +
  35. *(m!+ )*(m!+ )*(m!+ ) + 2*e*(p(idx1) )*(p(idx2) )*(a(idx2) )
  36. + -1 -1 -1 + +
  37. *(k(idx1) )*(m!+ )*(m!+ )*(m!+ ) + e*(p(idx2) )*(a(idx2) )
  38. + + -1 -1 -1
  39. *(k(idx1) )*(k(idx1) )*(m!+ )*(m!+ )*(m!+ ))/8
  40. % showtime;
  41. % note the ordering of operators in the result!
  42. % enhance the readability of the output
  43. on allfac;
  44. ON CONTRACT;
  45. H;
  46. 3
  47. (e*m!-1
  48. 2 2
  49. *(2*a dot p*k dot p + 2*k dot a*k dot p + k *a dot p + k *k dot a))/8
  50. % showtime;
  51. % Example 2: Virasoro Algebra from Conformal Field Theory
  52. operator del;
  53. % this is just a definition of a delta function
  54. for all n such that numberp n let del(n) =
  55. if n=0 then 1
  56. else 0;
  57. scalop l;
  58. noncom l,l;
  59. state bra,ket;
  60. % commutation relation of the operator l;
  61. for all n,m let comm(l(n),l(m)) =
  62. (m-n)*l(n+m)+c/12*(m**3-m)*del(n+m)*unit;
  63. %modified 1.1
  64. for all n let l!+(n) = l(-n);
  65. % relation for the states
  66. for all h let bra!+(h) = ket(h);
  67. for all p,q let bra(q) | ket(p) = del(p-q);
  68. for all r,h such that r < 0 or (r <2 and h=0) let
  69. l(r) | ket(h) = 0;
  70. for all r,h such that r > 0 or (r > -2 and h = 0) let
  71. bra(h) | l(r) = 0;
  72. % define a procedure to calculate V.E.V.
  73. procedure Vak(X);
  74. bra(0) | X | ket(0);
  75. vak
  76. % and now some calculations;
  77. MA:= adj(l(3)*l(5))*l(3)*l(5);
  78. ma := 2*l(8)*l(-3)*l(-5) + 4*l(8)*l(-8) + l(5)*l(3)*l(-3)*l(-5)
  79. + 2*l(5)*l(3)*l(-8) + 6*l(5)*l(0)*l(-5) + 8*l(5)*l(-2)*l(-3)
  80. + 60*l(5)*l(-5) + 8*l(3)*l(2)*l(-5) + 10*l(3)*l(0)*l(-3)
  81. 2
  82. + 112*l(3)*l(-3) + 64*l(2)*l(-2) + 60*l(0) + 556*l(0)
  83. 2
  84. + 20*c *unit + 2*c*l(5)*l(-5) + 10*c*l(3)*l(-3) + 80*c*l(0)
  85. + 332*c*unit
  86. %modified 1.1
  87. % showtime;
  88. % here is the VEV of m
  89. vak(Ma);
  90. 4*c*(5*c + 83)
  91. % showtime;
  92. % and now calculate another matrix element
  93. matel := bra(1) | ma | ket(1);
  94. *************** WARNING: ***************
  95. Evaluation incomplete due to missing elementary relations
  96. matel := bra(1) | (l(0) | 556*ket(1)) + bra(1) | (l(0) | 80*c*ket(1))
  97. 2
  98. + bra(1) | (l(0)*l(0) | 60*ket(1)) + 20*c + 332*c
  99. %modified 1.1
  100. % showtime;
  101. % this evaluation is incomplete so supply the missing relation
  102. for all h let l(0) | ket(h) = h*ket(h);
  103. % and reevaluate matel
  104. matel := matel;
  105. 2
  106. matel := 4*(5*c + 103*c + 154)
  107. % showtime;
  108. % Example 4: some manipulations with gamma matrices to demonstrate
  109. % the use of commutators and anticommutators
  110. off allfac;
  111. vecop gamma,q;
  112. tensop sigma(2);
  113. antisymmetric sigma;
  114. noncom gamma,gamma;
  115. noncom sigma,gamma;
  116. physindex mu,nu;
  117. operator delta;
  118. for all mu,nu let anticomm(gamma(mu),gamma(nu))=2*delta(mu,nu)*unit,
  119. comm(gamma(mu),gamma(nu))=2*I*sigma(mu,nu);
  120. oporder p,q,gamma,sigma;
  121. off allfac;
  122. on anticom;
  123. (gamma dot p)*(gamma dot q);
  124. p(idx4)*q(idx5)*gamma(idx4)*gamma(idx5)
  125. % showtime;
  126. off anticom;
  127. (gamma dot p)*(gamma dot q);
  128. p(idx6)*q(idx7)*gamma(idx6)*gamma(idx7)
  129. % showtime;
  130. commute((gamma dot p),(gamma dot q));
  131. 2*i*p(idx8)*q(idx9)*sigma(idx8,idx9)
  132. % showtime;
  133. anticommute((gamma dot p),(gamma dot q));
  134. 2*p(idx10)*q(idx11)*gamma(idx10)*gamma(idx11)
  135. - 2*i*p(idx10)*q(idx11)*sigma(idx10,idx11)
  136. on anticom;
  137. anticommute((gamma dot p),(gamma dot q));
  138. 2*delta(idx13,idx12)*p(idx12)*q(idx13)
  139. % showtime;
  140. end;
  141. Time for test: 30 ms