excalc.tst 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. %Problem: Calculate the PDE's for the isovector of the heat equation.
  2. %--------
  3. % (c.f. B.K. Harrison, f.B. Estabrook, "Geometric Approach...",
  4. % J. Math. Phys. 12, 653, 1971);
  5. %The heat equation @ psi = @ psi is equivalent to the set of exterior
  6. % xx t
  7. %equations (with u=@ psi, y=@ psi):
  8. % T x
  9. pform psi=0,u=0,x=0,y=0,t=0,a=1,da=2,b=2;
  10. a:=d psi - u*d t - y*d x;
  11. da:=- d u^d t - d y^d x;
  12. b:=u*d x^d t - d y^d t;
  13. %Now calculate the PDE's for the isovector;
  14. tvector v;
  15. pform vpsi=0,vt=0,vu=0,vx=0,vy=0;
  16. fdomain vpsi=vpsi(psi,t,u,x,y),vt=vt(psi,t,u,x,y),vu=vu(psi,t,u,x,y),
  17. vx=vx(psi,t,u,x,y),vy=vy(psi,t,u,x,y);
  18. v:=vpsi*@ psi + vt*@ t + vu*@ u + vx*@ x + vy*@ y;
  19. factor d;
  20. on rat;
  21. i1:=v |_ a - l*a;
  22. pform o=1;
  23. o:=ot*d t + ox*d x + ou*d u + oy*d y;
  24. fdomain f=f(psi,t,u,x,y);
  25. i11:=v _|d a - l*a + d f;
  26. let vx=-@(f,y),vt=-@(f,u),vu=@(f,t)+u*@(f,psi),vy=@(f,x)+y*@(f,psi),
  27. vpsi=f-u*@(f,u)-y*@(f,y);
  28. factor ^;
  29. i2:=v |_ b - xi*b - o^a + zet*da;
  30. let ou=0,oy=@(f,u,psi),ox=-u*@(f,u,psi),
  31. ot=@(f,x,psi)+u*@(f,y,psi)+y*@(f,psi,psi);
  32. i2;
  33. let zet=-@(f,u,x)-@(f,u,y)*u-@(f,u,psi)*y;
  34. i2;
  35. let xi=-@(f,t,u)-u*@(f,u,psi)+@(f,x,y)+u*@(f,y,y)+y*@(f,y,psi)+@(f,psi);
  36. i2;
  37. let @(f,u,u)=0;
  38. i2; % These PDE's have to be solved;
  39. clear a,da,b,v,i1,i11,o,i2,xi,t;
  40. remfdomain f;
  41. clear @(f,u,u);
  42. %Problem:
  43. %--------
  44. %Calculate the integrability conditions for the system of PDE's:
  45. %(c.f. B.F. Schutz, "Geometrical Methods of Mathematical Physics"
  46. %Cambridge University Press, 1984, p. 156)
  47. % @ z /@ x + a1*z + b1*z = c1
  48. % 1 1 2
  49. % @ z /@ y + a2*z + b2*z = c2
  50. % 1 1 2
  51. % @ z /@ x + f1*z + g1*z = h1
  52. % 2 1 2
  53. % @ z /@ y + f2*z + g2*z = h2
  54. % 2 1 2 ;
  55. pform w(k)=1,integ(k)=4,z(k)=0,x=0,y=0,a=1,b=1,c=1,f=1,g=1,h=1,
  56. a1=0,a2=0,b1=0,b2=0,c1=0,c2=0,f1=0,f2=0,g1=0,g2=0,h1=0,h2=0;
  57. fdomain a1=a1(x,y),a2=a2(x,y),b1=b1(x,y),b2=b2(x,y),
  58. c1=c1(x,y),c2=c2(x,y),f1=f1(x,y),f2=f2(x,y),
  59. g1=g1(x,y),g2=g2(x,y),h1=h1(x,y),h2=h2(x,y);
  60. a:=a1*d x+a2*d y$
  61. b:=b1*d x+b2*d y$
  62. c:=c1*d x+c2*d y$
  63. f:=f1*d x+f2*d y$
  64. g:=g1*d x+g2*d y$
  65. h:=h1*d x+h2*d y$
  66. %The equivalent exterior system:;
  67. factor d;
  68. w(1) := d z(-1) + z(-1)*a + z(-2)*b - c;
  69. w(2) := d z(-2) + z(-1)*f + z(-2)*g - h;
  70. indexrange 1,2;
  71. factor z;
  72. %The integrability conditions:;
  73. integ(k) := d w(k) ^ w(1) ^ w(2);
  74. clear a,b,c,f,g,h,w(k),integ(k);
  75. %Problem:
  76. %--------
  77. %Calculate the PDE's for the generators of the d-theta symmetries of
  78. %the Lagrangian system of the planar Kepler problem.
  79. %c.f. W.Sarlet, F.Cantrijn, Siam Review 23, 467, 1981;
  80. %Verify that time translation is a d-theta symmetry and calculate the
  81. %corresponding integral;
  82. pform t=0,q(k)=0,v(k)=0,lam(k)=0,tau=0,xi(k)=0,et(k)=0,theta=1,f=0,
  83. l=0,glq(k)=0,glv(k)=0,glt=0;
  84. tvector gam,y;
  85. indexrange 1,2;
  86. fdomain tau=tau(t,q(k),v(k)),xi=xi(t,q(k),v(k)),f=f(t,q(k),v(k));
  87. l:=1/2*(v(1)**2+v(2)**2)+m/r$ %The Lagrangian;
  88. pform r=0;
  89. fdomain r=r(q(k));
  90. let @(r,q 1)=q(1)/r,@(r,q 2)=q(2)/r,q(1)**2+q(2)**2=r**2;
  91. lam(k):=-m*q(k)/r; %The force;
  92. gam:=@ t + v(k)*@(q(k)) + lam(k)*@(v(k))$
  93. et(k) := gam _| d xi(k) - v(k)*gam _| d tau$
  94. y :=tau*@ t + xi(k)*@(q(k)) + et(k)*@(v(k))$ %Symmetry generator;
  95. theta := l*d t + @(l,v(k))*(d q(k) - v(k)*d t)$
  96. factor @;
  97. s := y |_ theta - d f$
  98. glq(k):=@(q k) _|s;
  99. glv(k):=@(v k) _|s;
  100. glt:=@(t) _|s;
  101. %Translation in time must generate a symmetry;
  102. xi(k) := 0;
  103. tau := 1;
  104. glq k;
  105. glv k;
  106. glt;
  107. %The corresponding integral is of course the energy;
  108. integ := - y _| theta;
  109. clear l,lam k,gam,et k,y,theta,s,glq k,glv k,glt,t,q k,v k,tau,xi k;
  110. remfdomain r,f;
  111. %Problem:
  112. %--------
  113. %Calculate the "gradient" and "Laplacian" of a function and the "curl"
  114. %and "divergence" of a one-form in elliptic coordinates;
  115. coframe e u=sqrt(cosh(v)**2-sin(u)**2)*d u,
  116. e v=sqrt(cosh(v)**2-sin(u)**2)*d v,
  117. e ph=cos u*sinh v*d ph;
  118. pform f=0;
  119. fdomain f=f(u,v,ph);
  120. factor e,^;
  121. on rat,gcd;
  122. order cosh v, sin u;
  123. %The gradient:;
  124. d f;
  125. factor @;
  126. %The Laplacian:;
  127. # d # d f;
  128. %Another way of calculating the Laplacian:
  129. -#vardf(1/2*d f^#d f,f);
  130. remfac @;
  131. %Now calculate the "curl" and the "divergence" of a one-form;
  132. pform w=1,a(k)=0;
  133. fdomain a=a(u,v,ph);
  134. w:=a(-k)*e k;
  135. %The curl:;
  136. x := # d w;
  137. factor @;
  138. %The divergence;
  139. y := # d # w;
  140. remfac @;
  141. clear x,y,w,u,v,ph,e k,a k;
  142. remfdomain a,f;
  143. %Problem:
  144. %--------
  145. %Calculate in a spherical coordinate system the Navier Stokes equations;
  146. coframe e r=d r,e th=r*d th,e ph=r*sin th*d ph;
  147. frame x;
  148. fdomain v=v(t,r,th,ph),p=p(r,th,ph);
  149. pform v(k)=0,p=0,w=1;
  150. %We first calculate the convective derivative;
  151. w := v(-k)*e(k)$
  152. factor e; on rat;
  153. cdv := @(w,t) + (v(k)*x(-k)) |_ w - 1/2*d(v(k)*v(-k));
  154. %next we calculate the viscous terms;
  155. visc := nu*(d#d# w - #d#d w) + nus*d#d# w;
  156. %finally we add the pressure term and print the components of the
  157. %whole equation;
  158. pform nasteq=1,nast(k)=0;
  159. nasteq := cdv - visc + 1/rho*d p$
  160. factor @;
  161. nast(-k) := x(-k) _| nasteq;
  162. remfac @,e;
  163. clear v k,x k,nast k,cdv,visc,p,w,nasteq;
  164. remfdomain p,v;
  165. %Problem:
  166. %--------
  167. %Calculate from the Lagrangian of a vibrating rod the equation of
  168. % motion and show that the invariance under time translation leads
  169. % to a conserved current;
  170. pform y=0,x=0,t=0,q=0,j=0,lagr=2;
  171. fdomain y=y(x,t),q=q(x),j=j(x);
  172. factor ^;
  173. lagr:=1/2*(rho*q*@(y,t)**2-e*j*@(y,x,x)**2)*d x^d t;
  174. vardf(lagr,y);
  175. %The Lagrangian does not explicitly depend on time; therefore the
  176. %vector field @ t generates a symmetry. The conserved current is
  177. pform c=1;
  178. factor d;
  179. c := noether(lagr,y,@ t);
  180. %The exterior derivative of this must be zero or a multiple of the
  181. %equation of motion (weak conservation law) to be a conserved current;
  182. remfac d;
  183. d c;
  184. %i.e. it is a multiple of the equation of motion;
  185. clear lagr,c;
  186. %Problem:
  187. %--------
  188. %Show that the metric structure given by Eguchi and Hanson induces a
  189. %self-dual curvature.
  190. %c.f. T. Eguchi, P.B. Gilkey, A.J. Hanson, "Gravitation, Gauge Theories
  191. % and Differential Geometry", Physics Reports 66, 213, 1980;
  192. for all x let cos(x)**2=1-sin(x)**2;
  193. pform f=0,g=0;
  194. fdomain f=f(r), g=g(r);
  195. coframe o(r) =f*d r,
  196. o(theta) =(r/2)*(sin(psi)*d theta-sin(theta)*cos(psi)*d phi),
  197. o(phi) =(r/2)*(-cos(psi)*d theta-sin(theta)*sin(psi)*d phi),
  198. o(psi) =(r/2)*g*(d psi+cos(theta)*d phi);
  199. frame e;
  200. pform gamma1(a,b)=1,curv2(a,b)=2;
  201. antisymmetric gamma1,curv2;
  202. factor o;
  203. gamma1(-a,-b):=-(1/2)*( e(-a) _|(e(-c) _|(d o(-b)))
  204. -e(-b) _|(e(-a) _|(d o(-c)))
  205. +e(-c) _|(e(-b) _|(d o(-a))) )*o(c)$
  206. curv2(-a,b):=d gamma1(-a,b) + gamma1(-c,b)^gamma1(-a,c)$
  207. factor ^;
  208. curv2(a,b):= curv2(a,b)$
  209. let f=1/g;
  210. let g=sqrt(1-(a/r)**4);
  211. pform chck(k,l)=2;
  212. antisymmetric chck;
  213. %The following has to be zero for a self-dual curvature;
  214. chck(k,l):=1/2*eps(k,l,m,n)*curv2(-m,-n)+curv2(k,l);
  215. clear gamma1(a,b),curv2(a,b),f,g,chck(a,b),o(k),e(k);
  216. remfdomain f,g;
  217. %Problem:
  218. %--------
  219. %Calculate for a given coframe and given torsion the Riemannian part and
  220. %the torsion induced part of the connection. Calculate the curvature.
  221. %For a more elaborate example see E.Schruefer, F.W. Hehl, J.D. McCrea,
  222. %"Application of the REDUCE package EXCALC to the Poincare gauge field
  223. %theory of gravity", to be submited to GRG Journal;
  224. pform ff=0, gg=0;
  225. fdomain ff=ff(r), gg=gg(r);
  226. coframe o(4)=d u+2*b0*cos(theta)*d phi,
  227. o(1)=ff*(d u+2*b0*cos(theta)*d phi)+ d r,
  228. o(2)=gg*d theta,
  229. o(3)=gg*sin(theta)*d phi
  230. with metric g=-o(4)*o(1)-o(4)*o(1)+o(2)*o(2)+o(3)*o(3);
  231. frame e;
  232. pform tor(a)=2,gwt(a)=2,gam(a,b)=1,
  233. u1=0,u3=0,u5=0;
  234. antisymmetric gam;
  235. fdomain u1=u1(r),u3=u3(r),u5=u5(r);
  236. tor(4):=0$
  237. tor(1):=-u5*o(4)^o(1)-2*u3*o(2)^o(3)$
  238. tor(2):=u1*o(4)^o(2)+u3*o(4)^o(3)$
  239. tor(3):=u1*o(4)^o(3)-u3*o(4)^o(2)$
  240. gwt(-a):=d o(-a)-tor(-a)$
  241. %The following is the combined connection;
  242. %The Riemannian part could have equally well been calculated by the
  243. %RIEMANNCONX statement;
  244. gam(-a,-b):=(1/2)*( e(-b) _|(e(-c) _|gwt(-a))
  245. +e(-c) _|(e(-a) _|gwt(-b))
  246. -e(-a) _|(e(-b) _|gwt(-c)) )*o(c);
  247. pform curv(a,b)=2;
  248. antisymmetric curv;
  249. factor ^;
  250. curv(-a,b):=d gam(-a,b) + gam(-c,b)^gam(-a,c);
  251. showtime;
  252. end;