EXCALC.TST 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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,u,x,y,t}=0,a=1,{da,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,vt,vu,vx,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 + zeta*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 zeta=-@(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,vpsi,vt,vu,vx,vy;
  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),x,y}=0,{a,b,c,f,g,h}=1,
  56. {a1,a2,b1,b2,c1,c2,f1,f2,g1,g2,h1,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,x,y,w(k),integ(k),z(k);
  75. remfdomain a1,a2,b1,c1,c2,f1,f2,g1,g2,h1,h2;
  76. % Problem:
  77. % --------
  78. % Calculate the PDE's for the generators of the d-theta symmetries of
  79. % the Lagrangian system of the planar Kepler problem.
  80. % c.f. W.Sarlet, F.Cantrijn, Siam Review 23, 467, 1981
  81. % Verify that time translation is a d-theta symmetry and calculate the
  82. % corresponding integral.
  83. pform {t,q(k),v(k),lam(k),tau,xi(k),eta(k)}=0,theta=1,f=0,
  84. {l,glq(k),glv(k),glt}=0;
  85. tvector gam,y;
  86. indexrange 1,2;
  87. fdomain tau=tau(t,q(k),v(k)),xi=xi(t,q(k),v(k)),f=f(t,q(k),v(k));
  88. l := 1/2*(v(1)**2 + v(2)**2) + m/r$ % The Lagrangian.
  89. pform r=0;
  90. fdomain r=r(q(k));
  91. let @(r,q 1)=q(1)/r,@(r,q 2)=q(2)/r,q(1)**2+q(2)**2=r**2;
  92. lam(k) := -m*q(k)/r; % The force.
  93. gam := @ t + v(k)*@(q(k)) + lam(k)*@(v(k))$
  94. eta(k) := gam _| d xi(k) - v(k)*gam _| d tau$
  95. y := tau*@ t + xi(k)*@(q(k)) + eta(k)*@(v(k))$ % Symmetry generator.
  96. theta := l*d t + @(l,v(k))*(d q(k) - v(k)*d t)$
  97. factor @;
  98. s := y |_ theta - d f$
  99. glq(k) := @(q k) _| s;
  100. glv(k) := @(v k) _| s;
  101. glt := @(t) _| s;
  102. % Translation in time must generate a symmetry.
  103. xi(k) := 0;
  104. tau := 1;
  105. glq k := glq k;
  106. glv k := glv k;
  107. glt;
  108. % The corresponding integral is of course the energy.
  109. integ := - y _| theta;
  110. clear l,lam k,gam,eta k,y,theta,s,glq k,glv k,glt,t,q k,v k,tau,xi k;
  111. remfdomain r,f,tau,xi;
  112. % Problem:
  113. % --------
  114. % Calculate the "gradient" and "Laplacian" of a function and the "curl"
  115. % and "divergence" of a one-form in elliptic coordinates.
  116. coframe e u = sqrt(cosh(v)**2 - sin(u)**2)*d u,
  117. e v = sqrt(cosh(v)**2 - sin(u)**2)*d v,
  118. e phi = cos u*sinh v*d phi;
  119. pform f=0;
  120. fdomain f=f(u,v,phi);
  121. factor e,^;
  122. on rat,gcd;
  123. order cosh v, sin u;
  124. % The gradient:
  125. d f;
  126. factor @;
  127. % The Laplacian:
  128. # d # d f;
  129. % Another way of calculating the Laplacian:
  130. -#vardf(1/2*d f^#d f,f);
  131. remfac @;
  132. % Now calculate the "curl" and the "divergence" of a one-form.
  133. pform w=1,a(k)=0;
  134. fdomain a=a(u,v,phi);
  135. w := a(-k)*e k;
  136. % The curl:
  137. x := # d w;
  138. factor @;
  139. % The divergence:
  140. y := # d # w;
  141. remfac @;
  142. clear x,y,w,u,v,phi,e k,a k;
  143. remfdomain a,f;
  144. % Problem:
  145. % --------
  146. % Calculate in a spherical coordinate system the Navier Stokes equations.
  147. coframe e r=d r, e theta =r*d theta, e phi = r*sin theta *d phi;
  148. frame x;
  149. fdomain v=v(t,r,theta,phi),p=p(r,theta,phi);
  150. pform v(k)=0,p=0,w=1;
  151. % We first calculate the convective derivative.
  152. w := v(-k)*e(k)$
  153. factor e; on rat;
  154. cdv := @(w,t) + (v(k)*x(-k)) |_ w - 1/2*d(v(k)*v(-k));
  155. %next we calculate the viscous terms;
  156. visc := nu*(d#d# w - #d#d w) + mu*d#d# w;
  157. % Finally we add the pressure term and print the components of the
  158. % whole equation.
  159. pform nasteq=1,nast(k)=0;
  160. nasteq := cdv - visc + 1/rho*d p$
  161. factor @;
  162. nast(-k) := x(-k) _| nasteq;
  163. remfac @,e;
  164. clear v k,x k,nast k,cdv,visc,p,w,nasteq,e k;
  165. remfdomain p,v;
  166. % Problem:
  167. % --------
  168. % Calculate from the Lagrangian of a vibrating rod the equation of
  169. % motion and show that the invariance under time translation leads
  170. % to a conserved current.
  171. pform {y,x,t,q,j}=0,lagr=2;
  172. fdomain y=y(x,t),q=q(x),j=j(x);
  173. factor ^;
  174. lagr := 1/2*(rho*q*@(y,t)**2 - e*j*@(y,x,x)**2)*d x^d t;
  175. vardf(lagr,y);
  176. % The Lagrangian does not explicitly depend on time; therefore the
  177. % vector field @ t generates a symmetry. The conserved current is
  178. pform c=1;
  179. factor d;
  180. c := noether(lagr,y,@ t);
  181. % The exterior derivative of this must be zero or a multiple of the
  182. % equation of motion (weak conservation law) to be a conserved current.
  183. remfac d;
  184. d c;
  185. % i.e. it is a multiple of the equation of motion.
  186. clear lagr,c,j,y,q;
  187. remfdomain y,q,j;
  188. % Problem:
  189. % --------
  190. % Show that the metric structure given by Eguchi and Hanson induces a
  191. % self-dual curvature.
  192. % c.f. T. Eguchi, P.B. Gilkey, A.J. Hanson, "Gravitation, Gauge Theories
  193. % and Differential Geometry", Physics Reports 66, 213, 1980
  194. for all x let cos(x)**2=1-sin(x)**2;
  195. pform f=0,g=0;
  196. fdomain f=f(r), g=g(r);
  197. coframe o(r) = f*d r,
  198. o(theta) = (r/2)*(sin(psi)*d theta - sin(theta)*cos(psi)*d phi),
  199. o(phi) = (r/2)*(-cos(psi)*d theta - sin(theta)*sin(psi)*d phi),
  200. o(psi) = (r/2)*g*(d psi + cos(theta)*d phi);
  201. frame e;
  202. pform gamma(a,b)=1,curv2(a,b)=2;
  203. index_symmetries gamma(a,b),curv2(a,b): antisymmetric;
  204. factor o;
  205. gamma(-a,-b) := -(1/2)*( e(-a) _| (e(-c) _| (d o(-b)))
  206. -e(-b) _| (e(-a) _| (d o(-c)))
  207. +e(-c) _| (e(-b) _| (d o(-a))) )*o(c)$
  208. curv2(-a,b) := d gamma(-a,b) + gamma(-c,b)^gamma(-a,c)$
  209. let f=1/g,g=sqrt(1-(a/r)**4);
  210. pform chck(k,l)=2;
  211. index_symmetries chck(k,l): antisymmetric;
  212. % The following has to be zero for a self-dual curvature.
  213. chck(k,l) := 1/2*eps(k,l,m,n)*curv2(-m,-n) + curv2(k,l);
  214. clear gamma(a,b),curv2(a,b),f,g,chck(a,b),o(k),e(k),r,phi,psi;
  215. remfdomain f,g;
  216. % Example: 6-dimensional FRW model with quadratic curvature terms in
  217. % -------
  218. % the Lagrangian (Lanczos and Gauss-Bonnet terms).
  219. % cf. Henriques, Nuclear Physics, B277, 621 (1986)
  220. for all x let cos(x)**2+sin(x)**2=1;
  221. pform {r,s}=0;
  222. fdomain r=r(t),s=s(t);
  223. coframe o(t) = d t,
  224. o(1) = r*d u/(1 + k*(u**2)/4),
  225. o(2) = r*u*d theta/(1 + k*(u**2)/4),
  226. o(3) = r*u*sin(theta)*d phi/(1 + k*(u**2)/4),
  227. o(4) = s*d v1,
  228. o(5) = s*sin(v1)*d v2
  229. with metric g =-o(t)*o(t)+o(1)*o(1)+o(2)*o(2)+o(3)*o(3)
  230. +o(4)*o(4)+o(5)*o(5);
  231. frame e;
  232. on nero; factor o,^;
  233. riemannconx om;
  234. pform curv(k,l)=2,{riemann(a,b,c,d),ricci(a,b),riccisc}=0;
  235. index_symmetries curv(k,l): antisymmetric,
  236. riemann(k,l,m,n): antisymmetric in {k,l},{m,n}
  237. symmetric in {{k,l},{m,n}},
  238. ricci(k,l): symmetric;
  239. curv(k,l) := d om(k,l) + om(k,-m)^om(m,l);
  240. riemann(a,b,c,d) := e(d) _| (e (c) _| curv(a,b));
  241. % The rest is done in the Ricci calculus language,
  242. ricci(-a,-b) := riemann(c,-a,-d,-b)*g(-c,d);
  243. riccisc := ricci(-a,-b)*g(a,b);
  244. pform {laglanc,inv1,inv2} = 0;
  245. index_symmetries riemc3(k,l),riemri(k,l),
  246. hlang(k,l),einst(k,l): symmetric;
  247. pform {riemc3(i,j),riemri(i,j)}=0;
  248. riemc3(-i,-j) := riemann(-i,-k,-l,-m)*riemann(-j,k,l,m)$
  249. inv1 := riemc3(-i,-j)*g(i,j);
  250. riemri(-i,-j) := 2*riemann(-i,-k,-j,-l)*ricci(k,l)$
  251. inv2 := ricci(-a,-b)*ricci(a,b);
  252. laglanc := (1/2)*(inv1 - 4*inv2 + riccisc**2);
  253. pform {einst(a,b),hlang(a,b)}=0;
  254. hlang(-i,-j) := 2*(riemc3(-i,-j) - riemri(-i,-j) -
  255. 2*ricci(-i,-k)*ricci(-j,K) +
  256. riccisc*ricci(-i,-j) - (1/2)*laglanc*g(-i,-j));
  257. % The complete Einstein tensor:
  258. einst(-i,-j) := (ricci(-i,-j) - (1/2)*riccisc*g(-i,-j))*alp1 +
  259. hlang(-i,-j)*alp2$
  260. alp1 := 1$
  261. factor alp2;
  262. einst(-i,-j) := einst(-i,-j);
  263. clear o(k),e(k),riemc3(i,j),riemri(i,j),curv(k,l),riemann(a,b,c,d),
  264. ricci(a,b),riccisc,t,u,v1,v2,theta,phi,r,om(k,l),einst(a,b),
  265. hlang(a,b);
  266. remfdomain r,s;
  267. % Problem:
  268. % --------
  269. % Calculate for a given coframe and given torsion the Riemannian part and
  270. % the torsion induced part of the connection. Calculate the curvature.
  271. % For a more elaborate example see E.Schruefer, F.W. Hehl, J.D. McCrea,
  272. % "Application of the REDUCE package EXCALC to the Poincare gauge field
  273. % theory of gravity", GRG Journal, vol. 19, (1988) 197--218
  274. pform {ff, gg}=0;
  275. fdomain ff=ff(r), gg=gg(r);
  276. coframe o(4) = d u + 2*b0*cos(theta)*d phi,
  277. o(1) = ff*(d u + 2*b0*cos(theta)*d phi) + d r,
  278. o(2) = gg*d theta,
  279. o(3) = gg*sin(theta)*d phi
  280. with metric g = -o(4)*o(1)-o(4)*o(1)+o(2)*o(2)+o(3)*o(3);
  281. frame e;
  282. pform {tor(a),gwt(a)}=2,gamma(a,b)=1,
  283. {u1,u3,u5}=0;
  284. index_symmetries gamma(a,b): antisymmetric;
  285. fdomain u1=u1(r),u3=u3(r),u5=u5(r);
  286. tor(4) := 0$
  287. tor(1) := -u5*o(4)^o(1) - 2*u3*o(2)^o(3)$
  288. tor(2) := u1*o(4)^o(2) + u3*o(4)^o(3)$
  289. tor(3) := u1*o(4)^o(3) - u3*o(4)^o(2)$
  290. gwt(-a) := d o(-a) - tor(-a)$
  291. % The following is the combined connection.
  292. % The Riemannian part could have equally well been calculated by the
  293. % RIEMANNCONX statement.
  294. gamma(-a,-b) := (1/2)*( e(-b) _| (e(-c) _| gwt(-a))
  295. +e(-c) _| (e(-a) _| gwt(-b))
  296. -e(-a) _| (e(-b) _| gwt(-c)) )*o(c);
  297. pform curv(a,b)=2;
  298. index_symmetries curv(a,b): antisymmetric;
  299. factor ^;
  300. curv(-a,b) := d gamma(-a,b) + gamma(-c,b)^gamma(-a,c);
  301. clear o(k),e(k),curv(a,b),gamma(a,b),theta,phi,x,y,z,r,s,t,u,v,p,q,c,cs;
  302. remfdomain u1,u3,u5,ff,gg;
  303. showtime;
  304. end;