physop.tst 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. COMMENT
  2. test file for the PHYSOP package;
  3. showtime;
  4. linelength(72)$
  5. % Example 1: Quantum Mechanics of a Dirac particle in an external
  6. % electromagnetic field
  7. VECOP P,A,K;
  8. SCALOP M;
  9. NONCOM P,A;
  10. PHYSINDEX J,L;
  11. oporder M,K,A,P;
  12. % we have to set off allfac here since otherwise there appear
  13. % spurious negative powers in the printed output
  14. off allfac;
  15. FOR ALL J,L LET COMM(P(J),A(L))=K(J)*A(L);
  16. H:= COMMUTE(P**2/(2*M),E/(4*M**2)*(P DOT A));
  17. showtime;
  18. %assign the corresponding value to the adjoint of H
  19. H!+ := adj H;
  20. showtime;
  21. % note the ordering of operators in the result!
  22. % enhance the readability of the output
  23. on allfac;
  24. ON CONTRACT;
  25. H;
  26. showtime;
  27. % Example 2: Virasoro Algebra from Conformal Field Theory
  28. operator del; % this is just a defintion of a delta function
  29. for all n such that numberp n let del(n) =
  30. if n=0 then 1
  31. else 0;
  32. scalop l;
  33. noncom l,l;
  34. state bra,ket;
  35. % commutation relation of the operator l;
  36. for all n,m let comm(l(n),l(m)) =
  37. (m-n)*l(n+m)+c/12*(m**3-m)*del(n+m);
  38. for all n let l!+(n) = l(-n);
  39. % relation for the states
  40. for all h let bra!+(h) = ket(h);
  41. for all p,q let bra(q) | ket(p) = del(p-q);
  42. for all r,h such that r < 0 or (r <2 and h=0) let
  43. l(r) | ket(h) = 0;
  44. for all r,h such that r > 0 or (r > -2 and h = 0) let
  45. bra(h) | l(r) = 0;
  46. % define a procedure to calculate V.E.V.
  47. procedure Vak(X);
  48. bra(0) | X | ket(0);
  49. % and now some calculations;
  50. M:= adj(l(3)*l(5))*l(3)*l(5);
  51. showtime;
  52. % here is the VEV of m
  53. vak(M);
  54. showtime;
  55. % and now calculate another matrix element
  56. matel := bra(1) | m | ket(1);
  57. showtime;
  58. % this evaluation is incomplete so supply the missing relation
  59. for all h let l(0) | ket(h) = h*ket(h);
  60. % and reevaluate matel
  61. matel := matel;
  62. showtime;
  63. % Example 4: some manipulations with gamma matrices to demonstrate
  64. % the use of commutators and anticommutators
  65. off allfac;
  66. vecop gamma,q;
  67. tensop sigma(2);
  68. antisymmetric sigma;
  69. noncom gamma,gamma;
  70. noncom sigma,gamma;
  71. physindex mu,nu;
  72. operator delta;
  73. for all mu,nu let anticomm(gamma(mu),gamma(nu))=2*delta(mu,nu)*unit,
  74. comm(gamma(mu),gamma(nu))=2*I*sigma(mu,nu);
  75. oporder p,q,gamma,sigma;
  76. off allfac;
  77. on anticom;
  78. (gamma dot p)*(gamma dot q);
  79. showtime;
  80. off anticom;
  81. (gamma dot p)*(gamma dot q);
  82. showtime;
  83. commute((gamma dot p),(gamma dot q));
  84. showtime;
  85. anticommute((gamma dot p),(gamma dot q));
  86. on anticom;
  87. anticommute((gamma dot p),(gamma dot q));
  88. showtime;
  89. end;