physop.tst 2.6 KB

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