excalc.rlg 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296
  1. Tue Feb 10 12:27:59 2004 run on Linux
  2. *** ^ redefined
  3. % Problem: Calculate the PDE's for the isovector of the heat equation.
  4. % --------
  5. % (c.f. B.K. Harrison, f.B. Estabrook, "Geometric Approach...",
  6. % J. Math. Phys. 12, 653, 1971)
  7. % The heat equation @ psi = @ psi is equivalent to the set of exterior
  8. % xx t
  9. % equations (with u=@ psi, y=@ psi):
  10. % T x
  11. pform {psi,u,x,y,t}=0,a=1,{da,b}=2;
  12. a := d psi - u*d t - y*d x;
  13. a := d psi - d t*u - d x*y
  14. da := - d u^d t - d y^d x;
  15. da := d t^d u + d x^d y
  16. b := u*d x^d t - d y^d t;
  17. b := - d t^d x*u + d t^d y
  18. % Now calculate the PDE's for the isovector.
  19. tvector v;
  20. pform {vpsi,vt,vu,vx,vy}=0;
  21. fdomain vpsi=vpsi(psi,t,u,x,y),vt=vt(psi,t,u,x,y),vu=vu(psi,t,u,x,y),
  22. vx=vx(psi,t,u,x,y),vy=vy(psi,t,u,x,y);
  23. v := vpsi*@ psi + vt*@ t + vu*@ u + vx*@ x + vy*@ y;
  24. v := @ *vpsi + @ *vt + @ *vu + @ *vx + @ *vy
  25. psi t u x y
  26. factor d;
  27. on rat;
  28. i1 := v |_ a - l*a;
  29. i1 := d psi*(@ vpsi - @ vt*u - @ vx*y - l)
  30. psi psi psi
  31. + d t*(@ vpsi - @ vt*u - @ vx*y + l*u - vu)
  32. t t t
  33. + d u*(@ vpsi - @ vt*u - @ vx*y)
  34. u u u
  35. + d x*(@ vpsi - @ vt*u - @ vx*y + l*y - vy)
  36. x x x
  37. + d y*(@ vpsi - @ vt*u - @ vx*y)
  38. y y y
  39. pform o=1;
  40. o := ot*d t + ox*d x + ou*d u + oy*d y;
  41. o := d t*ot + d u*ou + d x*ox + d y*oy
  42. fdomain f=f(psi,t,u,x,y);
  43. i11 := v _| d a - l*a + d f;
  44. i11 := - d psi*l + d t*(l*u - vu) + d u*vt + d x*(l*y - vy) + d y*vx
  45. let vx=-@(f,y),vt=-@(f,u),vu=@(f,t)+u*@(f,psi),vy=@(f,x)+y*@(f,psi),
  46. vpsi=f-u*@(f,u)-y*@(f,y);
  47. factor ^;
  48. i2 := v |_ b - xi*b - o^a + zeta*da;
  49. i2 := d psi^d t*( - @ f*y - @ f - @ f*u + ot) + d psi^d u*ou
  50. psi psi psi x psi y
  51. + d psi^d x*(@ f*u + ox) + d psi^d y*( - @ f + oy)
  52. psi u psi u
  53. + d t^d u*(@ f*y + @ f + @ f*u - ou*u + zeta) + d t^d x*(
  54. psi u u x u y
  55. @ f*y - @ f*u + @ f*u - @ f + @ f + @ f*u + ot*y - ox*u
  56. psi x psi t u t x x x y
  57. + u*xi)
  58. + d t^d y*(@ f*y + @ f - @ f + @ f + @ f*u - oy*u - xi)
  59. psi y psi t u x y y y
  60. + d u^d x*(@ f*u + ou*y) - d u^d y*@ f
  61. u u u u
  62. + d x^d y*( - @ f - @ f*u - oy*y + zeta)
  63. u x u y
  64. let ou=0,oy=@(f,u,psi),ox=-u*@(f,u,psi),
  65. ot=@(f,x,psi)+u*@(f,y,psi)+y*@(f,psi,psi);
  66. i2;
  67. 2
  68. d t^d u*(@ f*y + @ f + @ f*u + zeta) + d t^d x*(@ f*y
  69. psi u u x u y psi psi
  70. 2
  71. + @ f*u + 2*@ f*y + @ f*u*y - @ f*u + @ f*u - @ f + @ f
  72. psi u psi x psi y psi t u t x x
  73. + @ f*u + u*xi)
  74. x y
  75. + d t^d y*( - @ f*u + @ f*y + @ f - @ f + @ f + @ f*u - xi)
  76. psi u psi y psi t u x y y y
  77. + d u^d x*@ f*u - d u^d y*@ f
  78. u u u u
  79. + d x^d y*( - @ f*y - @ f - @ f*u + zeta)
  80. psi u u x u y
  81. let zeta=-@(f,u,x)-@(f,u,y)*u-@(f,u,psi)*y;
  82. i2;
  83. 2 2
  84. d t^d x*(@ f*y + @ f*u + 2*@ f*y + @ f*u*y - @ f*u
  85. psi psi psi u psi x psi y psi
  86. + @ f*u - @ f + @ f + @ f*u + u*xi)
  87. t u t x x x y
  88. + d t^d y*( - @ f*u + @ f*y + @ f - @ f + @ f + @ f*u - xi)
  89. psi u psi y psi t u x y y y
  90. + d u^d x*@ f*u - d u^d y*@ f - 2*d x^d y*(@ f*y + @ f + @ f*u)
  91. u u u u psi u u x u y
  92. let xi=-@(f,t,u)-u*@(f,u,psi)+@(f,x,y)+u*@(f,y,y)+y*@(f,y,psi)+@(f,psi);
  93. i2;
  94. 2
  95. d t^d x*(@ f*y + 2*@ f*y + 2*@ f*u*y - @ f + @ f + 2*@ f*u
  96. psi psi psi x psi y t x x x y
  97. 2
  98. + @ f*u ) + d u^d x*@ f*u - d u^d y*@ f
  99. y y u u u u
  100. - 2*d x^d y*(@ f*y + @ f + @ f*u)
  101. psi u u x u y
  102. let @(f,u,u)=0;
  103. i2;
  104. 2
  105. d t^d x*(@ f*y + 2*@ f*y + 2*@ f*u*y - @ f + @ f + 2*@ f*u
  106. psi psi psi x psi y t x x x y
  107. 2
  108. + @ f*u ) - 2*d x^d y*(@ f*y + @ f + @ f*u)
  109. y y psi u u x u y
  110. % These PDE's have to be solved.
  111. clear a,da,b,v,i1,i11,o,i2,xi,t;
  112. remfdomain f,vpsi,vt,vu,vx,vy;
  113. clear @(f,u,u);
  114. % Problem:
  115. % --------
  116. % Calculate the integrability conditions for the system of PDE's:
  117. % (c.f. B.F. Schutz, "Geometrical Methods of Mathematical Physics"
  118. % Cambridge University Press, 1984, p. 156)
  119. % @ z /@ x + a1*z + b1*z = c1
  120. % 1 1 2
  121. % @ z /@ y + a2*z + b2*z = c2
  122. % 1 1 2
  123. % @ z /@ x + f1*z + g1*z = h1
  124. % 2 1 2
  125. % @ z /@ y + f2*z + g2*z = h2
  126. % 2 1 2 ;
  127. pform w(k)=1,integ(k)=4,{z(k),x,y}=0,{a,b,c,f,g,h}=1,
  128. {a1,a2,b1,b2,c1,c2,f1,f2,g1,g2,h1,h2}=0;
  129. fdomain a1=a1(x,y),a2=a2(x,y),b1=b1(x,y),b2=b2(x,y),
  130. c1=c1(x,y),c2=c2(x,y),f1=f1(x,y),f2=f2(x,y),
  131. g1=g1(x,y),g2=g2(x,y),h1=h1(x,y),h2=h2(x,y);
  132. a:=a1*d x+a2*d y$
  133. b:=b1*d x+b2*d y$
  134. c:=c1*d x+c2*d y$
  135. f:=f1*d x+f2*d y$
  136. g:=g1*d x+g2*d y$
  137. h:=h1*d x+h2*d y$
  138. % The equivalent exterior system:
  139. factor d;
  140. w(1) := d z(-1) + z(-1)*a + z(-2)*b - c;
  141. 1
  142. w := d z + d x*(z *a1 + z *b1 - c1) + d y*(z *a2 + z *b2 - c2)
  143. 1 1 2 1 2
  144. w(2) := d z(-2) + z(-1)*f + z(-2)*g - h;
  145. 2
  146. w := d z + d x*(z *f1 + z *g1 - h1) + d y*(z *f2 + z *g2 - h2)
  147. 2 1 2 1 2
  148. indexrange 1,2;
  149. factor z;
  150. % The integrability conditions:
  151. integ(k) := d w(k) ^ w(1) ^ w(2);
  152. 1
  153. integ := d z ^d z ^d x^d y*z *( - @ a1 + @ a2 + b1*f2 - b2*f1) +
  154. 1 2 1 y x
  155. d z ^d z ^d x^d y*z *( - @ b1 + @ b2 + a1*b2 - a2*b1 + b1*g2 - b2*g1)
  156. 1 2 2 y x
  157. + d z ^d z ^d x^d y*(@ c1 - @ c2 - a1*c2 + a2*c1 - b1*h2 + b2*h1)
  158. 1 2 y x
  159. 2
  160. integ := d z ^d z ^d x^d y*z *( - @ f1 + @ f2 - a1*f2 + a2*f1 - f1*g2 + f2*g1)
  161. 1 2 1 y x
  162. + d z ^d z ^d x^d y*z *( - @ g1 + @ g2 - b1*f2 + b2*f1)
  163. 1 2 2 y x
  164. + d z ^d z ^d x^d y*(@ h1 - @ h2 + c1*f2 - c2*f1 - g1*h2 + g2*h1)
  165. 1 2 y x
  166. clear a,b,c,f,g,h,x,y,w(k),integ(k),z(k);
  167. remfdomain a1,a2,b1,c1,c2,f1,f2,g1,g2,h1,h2;
  168. % Problem:
  169. % --------
  170. % Calculate the PDE's for the generators of the d-theta symmetries of
  171. % the Lagrangian system of the planar Kepler problem.
  172. % c.f. W.Sarlet, F.Cantrijn, Siam Review 23, 467, 1981
  173. % Verify that time translation is a d-theta symmetry and calculate the
  174. % corresponding integral.
  175. pform {t,q(k),v(k),lam(k),tau,xi(k),eta(k)}=0,theta=1,f=0,
  176. {l,glq(k),glv(k),glt}=0;
  177. tvector gam,y;
  178. indexrange 1,2;
  179. fdomain tau=tau(t,q(k),v(k)),xi=xi(t,q(k),v(k)),f=f(t,q(k),v(k));
  180. l := 1/2*(v(1)**2 + v(2)**2) + m/r$
  181. % The Lagrangian.
  182. pform r=0;
  183. fdomain r=r(q(k));
  184. let @(r,q 1)=q(1)/r,@(r,q 2)=q(2)/r,q(1)**2+q(2)**2=r**2;
  185. lam(k) := -m*q(k)/r;
  186. 1
  187. 1 - q *m
  188. lam := ---------
  189. r
  190. 2
  191. 2 - q *m
  192. lam := ---------
  193. r
  194. % The force.
  195. gam := @ t + v(k)*@(q(k)) + lam(k)*@(v(k))$
  196. eta(k) := gam _| d xi(k) - v(k)*gam _| d tau$
  197. y := tau*@ t + xi(k)*@(q(k)) + eta(k)*@(v(k))$
  198. % Symmetry generator.
  199. theta := l*d t + @(l,v(k))*(d q(k) - v(k)*d t)$
  200. factor @;
  201. s := y |_ theta - d f$
  202. glq(k) := @(q k) _| s;
  203. 1 1 1 2
  204. - @ (xi )*q *m - @ (xi )*q *m
  205. 1 2
  206. 1 1 1 1 2 v v
  207. glq := 2*@ (xi )*v + @ (xi )*v + ------------------ + ------------------
  208. 1 2 r r
  209. q q
  210. 1 2 2
  211. + @ (xi ) + @ (xi )*v - @ f
  212. t 1 1
  213. q q
  214. 1 2 2 2
  215. @ tau*( - 3*(v ) *r - (v ) *r + 2*m)
  216. 1
  217. q 1 2
  218. + --------------------------------------- - @ tau*v *v
  219. 2*r 2
  220. q
  221. 1 1 2 1
  222. @ tau*q *v *m @ tau*q *v *m
  223. 1 2
  224. v v 1
  225. + ---------------- + ---------------- - @ tau*v
  226. r r t
  227. 2 1
  228. - @ (xi )*q *m
  229. 1
  230. 2 1 1 2 1 2 2 v
  231. glq := @ (xi )*v + @ (xi )*v + 2*@ (xi )*v + ------------------
  232. 2 1 2 r
  233. q q q
  234. 2 2
  235. - @ (xi )*q *m
  236. 2
  237. v 2 1 2
  238. + ------------------ + @ (xi ) - @ f - @ tau*v *v
  239. r t 2 1
  240. q q
  241. 1 2 2 2 1 2
  242. @ tau*( - (v ) *r - 3*(v ) *r + 2*m) @ tau*q *v *m
  243. 2 1
  244. q v
  245. + --------------------------------------- + ----------------
  246. 2*r r
  247. 2 2
  248. @ tau*q *v *m
  249. 2
  250. v 2
  251. + ---------------- - @ tau*v
  252. r t
  253. glv(k) := @(v k) _| s;
  254. 1 2 2 2
  255. @ tau*( - (v ) *r - (v ) *r + 2*m)
  256. 1
  257. 1 1 1 2 2 v
  258. glv := @ (xi )*v + @ (xi )*v - @ f + -------------------------------------
  259. 1 1 1 2*r
  260. v v v
  261. 1 2 2 2
  262. @ tau*( - (v ) *r - (v ) *r + 2*m)
  263. 2
  264. 2 1 1 2 2 v
  265. glv := @ (xi )*v + @ (xi )*v - @ f + -------------------------------------
  266. 2 2 2 2*r
  267. v v v
  268. glt := @(t) _| s;
  269. 1 1 1
  270. @ (xi )*q *v *m
  271. 1
  272. 1 1 2 1 1 2 v
  273. glt := - @ (xi )*(v ) - @ (xi )*v *v + ------------------
  274. 1 2 r
  275. q q
  276. 1 2 1
  277. @ (xi )*q *v *m
  278. 2
  279. v 2 1 2 2 2 2
  280. + ------------------ - @ (xi )*v *v - @ (xi )*(v )
  281. r 1 2
  282. q q
  283. 2 1 2 2 2 2
  284. @ (xi )*q *v *m @ (xi )*q *v *m
  285. 1 2
  286. v v
  287. + ------------------ + ------------------ - @ f
  288. r r t
  289. 1 1 2 2 2 2 1 2 2 2
  290. + @ tau*v *((v ) + (v ) ) + @ tau*v *((v ) + (v ) )
  291. 1 2
  292. q q
  293. 1 1 2 2 2 2 1 2 2 2
  294. @ tau*q *m*((v ) + (v ) ) @ tau*q *m*((v ) + (v ) )
  295. 1 2
  296. v v
  297. - ----------------------------- - -----------------------------
  298. r r
  299. 1 2 2 2
  300. @ tau*((v ) *r + (v ) *r + 2*m) 1 1 2 2
  301. t m*(q *xi + q *xi )
  302. + --------------------------------- - ---------------------
  303. 2*r 3
  304. r
  305. % Translation in time must generate a symmetry.
  306. xi(k) := 0;
  307. k
  308. xi := 0
  309. tau := 1;
  310. tau := 1
  311. glq k := glq k;
  312. 1
  313. glq := - @ f
  314. 1
  315. q
  316. 2
  317. glq := - @ f
  318. 2
  319. q
  320. glv k := glv k;
  321. 1
  322. glv := - @ f
  323. 1
  324. v
  325. 2
  326. glv := - @ f
  327. 2
  328. v
  329. glt;
  330. - @ f
  331. t
  332. % The corresponding integral is of course the energy.
  333. integ := - y _| theta;
  334. 1 2 2 2
  335. (v ) *r + (v ) *r - 2*m
  336. integ := -------------------------
  337. 2*r
  338. clear l,lam k,gam,eta k,y,theta,s,glq k,glv k,glt,t,q k,v k,tau,xi k;
  339. remfdomain r,f,tau,xi;
  340. % Problem:
  341. % --------
  342. % Calculate the "gradient" and "Laplacian" of a function and the "curl"
  343. % and "divergence" of a one-form in elliptic coordinates.
  344. coframe e u = sqrt(cosh(v)**2 - sin(u)**2)*d u,
  345. e v = sqrt(cosh(v)**2 - sin(u)**2)*d v,
  346. e phi = cos u*sinh v*d phi;
  347. pform f=0;
  348. fdomain f=f(u,v,phi);
  349. factor e,^;
  350. on rat,gcd;
  351. order cosh v, sin u;
  352. % The gradient:
  353. d f;
  354. phi u v
  355. e *@ f e *@ f e *@ f
  356. phi u v
  357. ---------------- + -------------------------- + --------------------------
  358. cos(u)*sinh(v) 2 2 2 2
  359. sqrt(cosh(v) - sin(u) ) sqrt(cosh(v) - sin(u) )
  360. factor @;
  361. % The Laplacian:
  362. # d # d f;
  363. @ f @ f @ f*sin(u)
  364. phi phi u u u
  365. ------------------ + -------------------- - -----------------------------
  366. 2 2 2 2 2 2
  367. cos(u) *sinh(v) cosh(v) - sin(u) cos(u)*(cosh(v) - sin(u) )
  368. @ f @ f*cosh(v)
  369. v v v
  370. + -------------------- + ------------------------------
  371. 2 2 2 2
  372. cosh(v) - sin(u) sinh(v)*(cosh(v) - sin(u) )
  373. % Another way of calculating the Laplacian:
  374. -#vardf(1/2*d f^#d f,f);
  375. @ f @ f @ f*sin(u)
  376. phi phi u u u
  377. ------------------ + -------------------- - -----------------------------
  378. 2 2 2 2 2 2
  379. cos(u) *sinh(v) cosh(v) - sin(u) cos(u)*(cosh(v) - sin(u) )
  380. @ f @ f*cosh(v)
  381. v v v
  382. + -------------------- + ------------------------------
  383. 2 2 2 2
  384. cosh(v) - sin(u) sinh(v)*(cosh(v) - sin(u) )
  385. remfac @;
  386. % Now calculate the "curl" and the "divergence" of a one-form.
  387. pform w=1,a(k)=0;
  388. fdomain a=a(u,v,phi);
  389. w := a(-k)*e k;
  390. phi u v
  391. w := e *a + e *a + e *a
  392. phi u v
  393. % The curl:
  394. x := # d w;
  395. phi 2 2
  396. x := (e *( - cosh(v) *@ (a ) + cosh(v) *@ (a ) - cosh(v)*a *sinh(v)
  397. v u u v u
  398. 2 2
  399. + sin(u) *@ (a ) - sin(u) *@ (a ) - sin(u)*a *cos(u)))/(
  400. v u u v v
  401. 2 2 2 2 u
  402. sqrt(cosh(v) - sin(u) )*(cosh(v) - sin(u) )) + (e *(
  403. cosh(v)*a *cos(u) + cos(u)*@ (a )*sinh(v)
  404. phi v phi
  405. 2 2 2 2
  406. - sqrt(cosh(v) - sin(u) )*@ (a )))/(sqrt(cosh(v) - sin(u) )
  407. phi v
  408. v
  409. *cos(u)*sinh(v)) + (e *(sin(u)*a *sinh(v) - cos(u)*@ (a )*sinh(v)
  410. phi u phi
  411. 2 2 2 2
  412. + sqrt(cosh(v) - sin(u) )*@ (a )))/(sqrt(cosh(v) - sin(u) )
  413. phi u
  414. *cos(u)*sinh(v))
  415. factor @;
  416. % The divergence:
  417. y := # d # w;
  418. @ (a ) @ (a ) @ (a )
  419. phi phi u u v v
  420. y := ---------------- + -------------------------- + --------------------------
  421. cos(u)*sinh(v) 2 2 2 2
  422. sqrt(cosh(v) - sin(u) ) sqrt(cosh(v) - sin(u) )
  423. 3 2
  424. + (cosh(v) *a *cos(u) - cosh(v) *sin(u)*a *sinh(v)
  425. v u
  426. 2 2
  427. - cosh(v)*sin(u) *a *cos(u) + cosh(v)*a *cos(u)*sinh(v)
  428. v v
  429. 3 2
  430. + sin(u) *a *sinh(v) - sin(u)*a *cos(u) *sinh(v))/(
  431. u u
  432. 2 2 2 2
  433. sqrt(cosh(v) - sin(u) )*cos(u)*sinh(v)*(cosh(v) - sin(u) ))
  434. remfac @;
  435. clear x,y,w,u,v,phi,e k,a k;
  436. remfdomain a,f;
  437. % Problem:
  438. % --------
  439. % Calculate in a spherical coordinate system the Navier Stokes equations.
  440. coframe e r=d r, e theta =r*d theta, e phi = r*sin theta *d phi;
  441. frame x;
  442. fdomain v=v(t,r,theta,phi),p=p(r,theta,phi);
  443. pform v(k)=0,p=0,w=1;
  444. % We first calculate the convective derivative.
  445. w := v(-k)*e(k)$
  446. factor e;
  447. on rat;
  448. cdv := @(w,t) + (v(k)*x(-k)) |_ w - 1/2*d(v(k)*v(-k));
  449. phi
  450. cdv := (e *(cos(theta)*v *v + @ (v )*v
  451. phi theta phi phi phi
  452. + @ (v )*sin(theta)*v *r + @ (v )*sin(theta)*r
  453. r phi r t phi
  454. + @ (v )*sin(theta)*v + sin(theta)*v *v ))/(
  455. theta phi theta phi r
  456. r
  457. sin(theta)*r) + (e *(@ (v )*v + @ (v )*sin(theta)*v *r
  458. phi r phi r r r
  459. + @ (v )*sin(theta)*r + @ (v )*sin(theta)*v
  460. t r theta r theta
  461. 2 2
  462. - sin(theta)*(v ) - sin(theta)*(v ) ))/(sin(theta)*r) + (
  463. phi theta
  464. theta 2
  465. e *( - cos(theta)*(v ) + @ (v )*v
  466. phi phi theta phi
  467. + @ (v )*sin(theta)*v *r + @ (v )*sin(theta)*r
  468. r theta r t theta
  469. + @ (v )*sin(theta)*v + sin(theta)*v *v ))/(
  470. theta theta theta r theta
  471. sin(theta)*r)
  472. %next we calculate the viscous terms;
  473. visc := nu*(d#d# w - #d#d w) + mu*d#d# w;
  474. phi 2
  475. visc := (e *( - cos(theta) *v *nu + cos(theta)*@ (v )*sin(theta)*nu
  476. phi theta phi
  477. + cos(theta)*@ (v )*mu + 2*cos(theta)*@ (v )*nu
  478. phi theta phi theta
  479. + @ (v )*mu + @ (v )*nu
  480. phi phi phi phi phi phi
  481. 2 2 2
  482. + @ (v )*sin(theta) *nu*r + 2*@ (v )*sin(theta) *nu*r
  483. r r phi r phi
  484. 2
  485. + @ (v )*sin(theta) *nu + @ (v )*sin(theta)*mu*r
  486. theta theta phi phi r r
  487. + 2*@ (v )*sin(theta)*mu + 2*@ (v )*sin(theta)*nu
  488. phi r phi r
  489. 2
  490. + @ (v )*sin(theta)*mu - sin(theta) *v *nu))/(
  491. phi theta theta phi
  492. 2 2 r
  493. sin(theta) *r ) + (e *(cos(theta)*@ (v )*sin(theta)*nu
  494. theta r
  495. + cos(theta)*@ (v )*sin(theta)*mu*r
  496. r theta
  497. - cos(theta)*sin(theta)*v *mu
  498. theta
  499. - 2*cos(theta)*sin(theta)*v *nu
  500. theta
  501. + @ (v )*sin(theta)*mu*r - @ (v )*sin(theta)*mu
  502. phi r phi phi phi
  503. - 2*@ (v )*sin(theta)*nu + @ (v )*nu
  504. phi phi phi phi r
  505. 2 2 2 2
  506. + @ (v )*sin(theta) *mu*r + @ (v )*sin(theta) *nu*r
  507. r r r r r r
  508. 2 2
  509. + 2*@ (v )*sin(theta) *mu*r + 2*@ (v )*sin(theta) *nu*r
  510. r r r r
  511. 2
  512. + @ (v )*sin(theta) *nu
  513. theta theta r
  514. 2
  515. + @ (v )*sin(theta) *mu*r
  516. r theta theta
  517. 2 2
  518. - @ (v )*sin(theta) *mu - 2*@ (v )*sin(theta) *nu
  519. theta theta theta theta
  520. 2 2 2 2
  521. - 2*sin(theta) *v *mu - 2*sin(theta) *v *nu))/(sin(theta) *r ) +
  522. r r
  523. theta 2 2
  524. (e *( - cos(theta) *v *mu - cos(theta) *v *nu
  525. theta theta
  526. - cos(theta)*@ (v )*mu - 2*cos(theta)*@ (v )*nu
  527. phi phi phi phi
  528. + cos(theta)*@ (v )*sin(theta)*mu
  529. theta theta
  530. + cos(theta)*@ (v )*sin(theta)*nu
  531. theta theta
  532. + @ (v )*sin(theta)*mu
  533. phi theta phi
  534. 2 2
  535. + @ (v )*sin(theta) *mu*r + 2*@ (v )*sin(theta) *mu
  536. r theta r theta r
  537. 2
  538. + 2*@ (v )*sin(theta) *nu + @ (v )*nu
  539. theta r phi phi theta
  540. 2 2
  541. + @ (v )*sin(theta) *nu*r
  542. r r theta
  543. 2
  544. + 2*@ (v )*sin(theta) *nu*r
  545. r theta
  546. 2
  547. + @ (v )*sin(theta) *mu
  548. theta theta theta
  549. 2 2
  550. + @ (v )*sin(theta) *nu - sin(theta) *v *mu
  551. theta theta theta theta
  552. 2 2 2
  553. - sin(theta) *v *nu))/(sin(theta) *r )
  554. theta
  555. % Finally we add the pressure term and print the components of the
  556. % whole equation.
  557. pform nasteq=1,nast(k)=0;
  558. nasteq := cdv - visc + 1/rho*d p$
  559. factor @;
  560. nast(-k) := x(-k) _| nasteq;
  561. - @ (v )*mu @ (v )*(mu + 2*nu) - @ (v )*nu
  562. phi r phi phi phi phi phi r
  563. nast := -------------------- + ------------------------ + --------------------
  564. r sin(theta)*r 2 2 2
  565. sin(theta)*r sin(theta) *r
  566. @ (v )*v @ (v )*(v *r - 2*mu - 2*nu)
  567. phi r phi r r r
  568. + --------------- - @ (v )*(mu + nu) + -----------------------------
  569. sin(theta)*r r r r r
  570. - @ (v )*nu
  571. theta theta r
  572. + @ (v ) + ------------------------
  573. t r 2
  574. r
  575. @ (v )*( - cos(theta)*nu + sin(theta)*v *r)
  576. theta r theta
  577. + -----------------------------------------------------
  578. 2
  579. sin(theta)*r
  580. - @ (v )*mu - @ (v )*cos(theta)*mu
  581. r theta theta r theta
  582. + ------------------------ + -----------------------------
  583. r sin(theta)*r
  584. @ (v )*(mu + 2*nu) @ p
  585. theta theta r
  586. + ---------------------------- + ----- + (cos(theta)*v *mu
  587. 2 rho theta
  588. r
  589. 2
  590. + 2*cos(theta)*v *nu - sin(theta)*(v ) *r
  591. theta phi
  592. 2
  593. + 2*sin(theta)*v *mu + 2*sin(theta)*v *nu - sin(theta)*(v ) *r)
  594. r r theta
  595. 2
  596. /(sin(theta)*r )
  597. - @ (v )*mu @ (v )*cos(theta)*(mu + 2*nu)
  598. phi theta phi phi phi
  599. nast := ------------------------ + -----------------------------------
  600. theta 2 2 2
  601. sin(theta)*r sin(theta) *r
  602. - @ (v )*mu 2*@ (v )*(mu + nu)
  603. r theta r theta r
  604. + -------------------- - ------------------------
  605. r 2
  606. r
  607. - @ (v )*nu @ (v )*v
  608. phi phi theta phi theta phi
  609. + ------------------------ + ------------------- - @ (v )*nu
  610. 2 2 sin(theta)*r r r theta
  611. sin(theta) *r
  612. @ (v )*(v *r - 2*nu)
  613. r theta r
  614. + -------------------------- + @ (v )
  615. r t theta
  616. @ (v )*(mu + nu)
  617. theta theta theta
  618. - -------------------------------- + (@ (v )
  619. 2 theta theta
  620. r
  621. *( - cos(theta)*mu - cos(theta)*nu + sin(theta)*v *r))/(
  622. theta
  623. @ p
  624. 2 theta 2
  625. sin(theta)*r ) + --------- + (cos(theta) *v *mu
  626. r*rho theta
  627. 2 2
  628. + cos(theta) *v *nu - cos(theta)*sin(theta)*(v ) *r
  629. theta phi
  630. 2 2
  631. + sin(theta) *v *v *r + sin(theta) *v *mu
  632. r theta theta
  633. 2 2 2
  634. + sin(theta) *v *nu)/(sin(theta) *r )
  635. theta
  636. @ (v )*(mu + nu) @ (v )*v
  637. phi phi phi phi phi phi
  638. nast := - -------------------------- + ----------------- - @ (v )*nu
  639. phi 2 2 sin(theta)*r r r phi
  640. sin(theta) *r
  641. @ (v )*(v *r - 2*nu) - @ (v )*nu
  642. r phi r theta theta phi
  643. + ------------------------ + @ (v ) + --------------------------
  644. r t phi 2
  645. r
  646. @ (v )*( - cos(theta)*nu + sin(theta)*v *r)
  647. theta phi theta
  648. + -------------------------------------------------------
  649. 2
  650. sin(theta)*r
  651. - @ (v )*mu 2*@ (v )*(mu + nu)
  652. phi r r phi r
  653. + ------------------ - ----------------------
  654. sin(theta)*r 2
  655. sin(theta)*r
  656. - @ (v )*mu
  657. phi theta theta
  658. + --------------------------
  659. 2
  660. sin(theta)*r
  661. @ (v )*cos(theta)*( - mu - 2*nu) @ p
  662. phi theta phi
  663. + ---------------------------------------- + ------------------ + (
  664. 2 2 sin(theta)*r*rho
  665. sin(theta) *r
  666. 2
  667. v *(cos(theta) *nu + cos(theta)*sin(theta)*v *r
  668. phi theta
  669. 2 2 2 2
  670. + sin(theta) *v *r + sin(theta) *nu))/(sin(theta) *r )
  671. r
  672. remfac @,e;
  673. clear v k,x k,nast k,cdv,visc,p,w,nasteq,e k;
  674. remfdomain p,v;
  675. % Problem:
  676. % --------
  677. % Calculate from the Lagrangian of a vibrating rod the equation of
  678. % motion and show that the invariance under time translation leads
  679. % to a conserved current.
  680. pform {y,x,t,q,j}=0,lagr=2;
  681. fdomain y=y(x,t),q=q(x),j=j(x);
  682. factor ^;
  683. lagr := 1/2*(rho*q*@(y,t)**2 - e*j*@(y,x,x)**2)*d x^d t;
  684. 2 2
  685. d t^d x*( - @ y *q*rho + @ y *e*j)
  686. t x x
  687. lagr := --------------------------------------
  688. 2
  689. vardf(lagr,y);
  690. d t^d x*(@ j*@ y*e + 2*@ j*@ y*e + @ y*q*rho + @ y*e*j)
  691. x x x x x x x x t t x x x x
  692. % The Lagrangian does not explicitly depend on time; therefore the
  693. % vector field @ t generates a symmetry. The conserved current is
  694. pform c=1;
  695. factor d;
  696. c := noether(lagr,y,@ t);
  697. c := d t*e*(@ j*@ y*@ y - @ y*@ y*j + @ y*@ y*j)
  698. x t x x t x x x t x x x
  699. 2 2
  700. d x*(@ y *q*rho + @ y *e*j)
  701. t x x
  702. - -------------------------------
  703. 2
  704. % The exterior derivative of this must be zero or a multiple of the
  705. % equation of motion (weak conservation law) to be a conserved current.
  706. remfac d;
  707. d c;
  708. d t^d x*@ y*( - @ j*@ y*e - 2*@ j*@ y*e - @ y*q*rho - @ y*e*j)
  709. t x x x x x x x x t t x x x x
  710. % i.e. it is a multiple of the equation of motion.
  711. clear lagr,c,j,y,q;
  712. remfdomain y,q,j;
  713. % Problem:
  714. % --------
  715. % Show that the metric structure given by Eguchi and Hanson induces a
  716. % self-dual curvature.
  717. % c.f. T. Eguchi, P.B. Gilkey, A.J. Hanson, "Gravitation, Gauge Theories
  718. % and Differential Geometry", Physics Reports 66, 213, 1980
  719. for all x let cos(x)**2=1-sin(x)**2;
  720. pform f=0,g=0;
  721. fdomain f=f(r), g=g(r);
  722. coframe o(r) = f*d r,
  723. o(theta) = (r/2)*(sin(psi)*d theta - sin(theta)*cos(psi)*d phi),
  724. o(phi) = (r/2)*(-cos(psi)*d theta - sin(theta)*sin(psi)*d phi),
  725. o(psi) = (r/2)*g*(d psi + cos(theta)*d phi);
  726. frame e;
  727. pform gamma(a,b)=1,curv2(a,b)=2;
  728. index_symmetries gamma(a,b),curv2(a,b): antisymmetric;
  729. factor o;
  730. gamma(-a,-b) := -(1/2)*( e(-a) _| (e(-c) _| (d o(-b)))
  731. -e(-b) _| (e(-a) _| (d o(-c)))
  732. +e(-c) _| (e(-b) _| (d o(-a))) )*o(c)$
  733. curv2(-a,b) := d gamma(-a,b) + gamma(-c,b)^gamma(-a,c)$
  734. let f=1/g,g=sqrt(1-(a/r)**4);
  735. pform chck(k,l)=2;
  736. index_symmetries chck(k,l): antisymmetric;
  737. % The following has to be zero for a self-dual curvature.
  738. chck(k,l) := 1/2*eps(k,l,m,n)*curv2(-m,-n) + curv2(k,l);
  739. r theta
  740. chck := 0
  741. r phi
  742. chck := 0
  743. theta phi
  744. chck := 0
  745. r psi
  746. chck := 0
  747. theta psi
  748. chck := 0
  749. phi psi
  750. chck := 0
  751. clear gamma(a,b),curv2(a,b),f,g,chck(a,b),o(k),e(k),r,phi,psi;
  752. remfdomain f,g;
  753. % Example: 6-dimensional FRW model with quadratic curvature terms in
  754. % -------
  755. % the Lagrangian (Lanczos and Gauss-Bonnet terms).
  756. % cf. Henriques, Nuclear Physics, B277, 621 (1986)
  757. for all x let cos(x)**2+sin(x)**2=1;
  758. pform {r,s}=0;
  759. fdomain r=r(t),s=s(t);
  760. coframe o(t) = d t,
  761. o(1) = r*d u/(1 + k*(u**2)/4),
  762. o(2) = r*u*d theta/(1 + k*(u**2)/4),
  763. o(3) = r*u*sin(theta)*d phi/(1 + k*(u**2)/4),
  764. o(4) = s*d v1,
  765. o(5) = s*sin(v1)*d v2
  766. with metric g =-o(t)*o(t)+o(1)*o(1)+o(2)*o(2)+o(3)*o(3)
  767. +o(4)*o(4)+o(5)*o(5);
  768. frame e;
  769. on nero;
  770. factor o,^;
  771. riemannconx om;
  772. pform curv(k,l)=2,{riemann(a,b,c,d),ricci(a,b),riccisc}=0;
  773. index_symmetries curv(k,l): antisymmetric,
  774. riemann(k,l,m,n): antisymmetric in {k,l},{m,n}
  775. symmetric in {{k,l},{m,n}},
  776. ricci(k,l): symmetric;
  777. curv(k,l) := d om(k,l) + om(k,-m)^om(m,l);
  778. t 1
  779. o ^o *@ r
  780. t 1 t t
  781. curv := -------------
  782. r
  783. t 2
  784. o ^o *@ r
  785. t 2 t t
  786. curv := -------------
  787. r
  788. 1 2 2
  789. o ^o *(@ r + k)
  790. 1 2 t
  791. curv := ------------------
  792. 2
  793. r
  794. t 3
  795. o ^o *@ r
  796. t 3 t t
  797. curv := -------------
  798. r
  799. 1 3 2
  800. o ^o *(@ r + k)
  801. 1 3 t
  802. curv := ------------------
  803. 2
  804. r
  805. 2 3 2
  806. o ^o *(@ r + k)
  807. 2 3 t
  808. curv := ------------------
  809. 2
  810. r
  811. t 4
  812. o ^o *@ s
  813. t 4 t t
  814. curv := -------------
  815. s
  816. 1 4
  817. o ^o *@ r*@ s
  818. 1 4 t t
  819. curv := ---------------
  820. r*s
  821. 2 4
  822. o ^o *@ r*@ s
  823. 2 4 t t
  824. curv := ---------------
  825. r*s
  826. 3 4
  827. o ^o *@ r*@ s
  828. 3 4 t t
  829. curv := ---------------
  830. r*s
  831. t 5
  832. o ^o *@ s
  833. t 5 t t
  834. curv := -------------
  835. s
  836. 1 5
  837. o ^o *@ r*@ s
  838. 1 5 t t
  839. curv := ---------------
  840. r*s
  841. 2 5
  842. o ^o *@ r*@ s
  843. 2 5 t t
  844. curv := ---------------
  845. r*s
  846. 3 5
  847. o ^o *@ r*@ s
  848. 3 5 t t
  849. curv := ---------------
  850. r*s
  851. 4 5 2
  852. o ^o *(@ s + 1)
  853. 4 5 t
  854. curv := ------------------
  855. 2
  856. s
  857. riemann(a,b,c,d) := e(d) _| (e (c) _| curv(a,b));
  858. - @ r
  859. t 1 t 1 t t
  860. riemann := ----------
  861. r
  862. - @ r
  863. t 2 t 2 t t
  864. riemann := ----------
  865. r
  866. 2
  867. @ r + k
  868. 1 2 1 2 t
  869. riemann := ----------
  870. 2
  871. r
  872. - @ r
  873. t 3 t 3 t t
  874. riemann := ----------
  875. r
  876. 2
  877. @ r + k
  878. 1 3 1 3 t
  879. riemann := ----------
  880. 2
  881. r
  882. 2
  883. @ r + k
  884. 2 3 2 3 t
  885. riemann := ----------
  886. 2
  887. r
  888. - @ s
  889. t 4 t 4 t t
  890. riemann := ----------
  891. s
  892. @ r*@ s
  893. 1 4 1 4 t t
  894. riemann := ---------
  895. r*s
  896. @ r*@ s
  897. 2 4 2 4 t t
  898. riemann := ---------
  899. r*s
  900. @ r*@ s
  901. 3 4 3 4 t t
  902. riemann := ---------
  903. r*s
  904. - @ s
  905. t 5 t 5 t t
  906. riemann := ----------
  907. s
  908. @ r*@ s
  909. 1 5 1 5 t t
  910. riemann := ---------
  911. r*s
  912. @ r*@ s
  913. 2 5 2 5 t t
  914. riemann := ---------
  915. r*s
  916. @ r*@ s
  917. 3 5 3 5 t t
  918. riemann := ---------
  919. r*s
  920. 2
  921. @ s + 1
  922. 4 5 4 5 t
  923. riemann := ----------
  924. 2
  925. s
  926. % The rest is done in the Ricci calculus language,
  927. ricci(-a,-b) := riemann(c,-a,-d,-b)*g(-c,d);
  928. - 3*@ r*s - 2*@ s*r
  929. t t t t
  930. ricci := --------------------------
  931. t t r*s
  932. 2
  933. @ r*r*s + 2*@ r *s + 2*@ r*@ s*r + 2*k*s
  934. t t t t t
  935. ricci := --------------------------------------------
  936. 1 1 2
  937. r *s
  938. 2
  939. @ r*r*s + 2*@ r *s + 2*@ r*@ s*r + 2*k*s
  940. t t t t t
  941. ricci := --------------------------------------------
  942. 2 2 2
  943. r *s
  944. 2
  945. @ r*r*s + 2*@ r *s + 2*@ r*@ s*r + 2*k*s
  946. t t t t t
  947. ricci := --------------------------------------------
  948. 3 3 2
  949. r *s
  950. 2
  951. 3*@ r*@ s*s + @ s*r*s + @ s *r + r
  952. t t t t t
  953. ricci := --------------------------------------
  954. 4 4 2
  955. r*s
  956. 2
  957. 3*@ r*@ s*s + @ s*r*s + @ s *r + r
  958. t t t t t
  959. ricci := --------------------------------------
  960. 5 5 2
  961. r*s
  962. riccisc := ricci(-a,-b)*g(a,b);
  963. 2 2 2 2 2 2
  964. riccisc := (2*(3*@ r*r*s + 3*@ r *s + 6*@ r*@ s*r*s + 2*@ s*r *s + @ s *r
  965. t t t t t t t t
  966. 2 2 2 2
  967. + 3*k*s + r ))/(r *s )
  968. pform {laglanc,inv1,inv2} = 0;
  969. index_symmetries riemc3(k,l),riemri(k,l),
  970. hlang(k,l),einst(k,l): symmetric;
  971. pform {riemc3(i,j),riemri(i,j)}=0;
  972. riemc3(-i,-j) := riemann(-i,-k,-l,-m)*riemann(-j,k,l,m)$
  973. inv1 := riemc3(-i,-j)*g(i,j);
  974. 2 2 4 4 4 2 2 2 2 2 4
  975. inv1 := (4*(3*@ r *r *s + 3*@ r *s + 6*@ r *@ s *r *s + 6*@ r *k*s
  976. t t t t t t
  977. 2 4 2 4 4 2 4 2 4 4 4 4
  978. + 2*@ s *r *s + @ s *r + 2*@ s *r + 3*k *s + r ))/(r *s )
  979. t t t t
  980. riemri(-i,-j) := 2*riemann(-i,-k,-j,-l)*ricci(k,l)$
  981. inv2 := ricci(-a,-b)*ricci(a,b);
  982. 2 2 4 2 4 2 3
  983. inv2 := (2*(6*@ r *r *s + 6*@ r*@ r *r*s + 6*@ r*@ r*@ s*r *s
  984. t t t t t t t t t
  985. 3 3 4 4 4
  986. + 6*@ r*@ s*r *s + 6*@ r*k*r*s + 6*@ r *s
  987. t t t t t t t
  988. 3 3 2 2 2 2 2 4
  989. + 12*@ r *@ s*r*s + 15*@ r *@ s *r *s + 12*@ r *k*s
  990. t t t t t
  991. 3 2 3 3 3
  992. + 6*@ r*@ s*@ s*r *s + 6*@ r*@ s *r *s + 12*@ r*@ s*k*r*s
  993. t t t t t t t t
  994. 3 2 4 2 2 4
  995. + 6*@ r*@ s*r *s + 3*@ s *r *s + 2*@ s*@ s *r *s
  996. t t t t t t t
  997. 4 4 4 2 4 2 4 4 4 4
  998. + 2*@ s*r *s + @ s *r + 2*@ s *r + 6*k *s + r ))/(r *s )
  999. t t t t
  1000. laglanc := (1/2)*(inv1 - 4*inv2 + riccisc**2);
  1001. 2 2 2 2 2
  1002. laglanc := (12*(@ r*@ r *s + 4*@ r*@ r*@ s*r*s + @ r*@ s *r + @ r*k*s
  1003. t t t t t t t t t t t t
  1004. 2 3 2 2 2
  1005. + @ r*r + 2*@ r *@ s*s + 2*@ r *@ s*r*s + 3*@ r *@ s *r
  1006. t t t t t t t t t
  1007. 2 2
  1008. + @ r *r + 2*@ r*@ s*@ s*r + 2*@ r*@ s*k*s + 2*@ s*k*r*s
  1009. t t t t t t t t t
  1010. 2 3 2
  1011. + @ s *k*r + k*r))/(r *s )
  1012. t
  1013. pform {einst(a,b),hlang(a,b)}=0;
  1014. hlang(-i,-j) := 2*(riemc3(-i,-j) - riemri(-i,-j) -
  1015. 2*ricci(-i,-k)*ricci(-j,K) +
  1016. riccisc*ricci(-i,-j) - (1/2)*laglanc*g(-i,-j));
  1017. hlang :=
  1018. t t
  1019. 3 2 2 2 2
  1020. 12*(2*@ r *@ s*s + 3*@ r *@ s *r + @ r *r + 2*@ r*@ s*k*s + @ s *k*r + k*r)
  1021. t t t t t t t t
  1022. -----------------------------------------------------------------------------
  1023. 3 2
  1024. r *s
  1025. 2
  1026. hlang := (4*( - 4*@ r*@ r*@ s*s - 2*@ r*@ s *r - 2*@ r*r
  1027. 1 1 t t t t t t t t t
  1028. 2 2 2 2
  1029. - 2*@ r *@ s*s - 3*@ r *@ s - @ r - 4*@ r*@ s*@ s*r
  1030. t t t t t t t t t t
  1031. 2 2 2
  1032. - 2*@ s*k*s - @ s *k - k))/(r *s )
  1033. t t t
  1034. 2
  1035. hlang := (4*( - 4*@ r*@ r*@ s*s - 2*@ r*@ s *r - 2*@ r*r
  1036. 2 2 t t t t t t t t t
  1037. 2 2 2 2
  1038. - 2*@ r *@ s*s - 3*@ r *@ s - @ r - 4*@ r*@ s*@ s*r
  1039. t t t t t t t t t t
  1040. 2 2 2
  1041. - 2*@ s*k*s - @ s *k - k))/(r *s )
  1042. t t t
  1043. 2
  1044. hlang := (4*( - 4*@ r*@ r*@ s*s - 2*@ r*@ s *r - 2*@ r*r
  1045. 3 3 t t t t t t t t t
  1046. 2 2 2 2
  1047. - 2*@ r *@ s*s - 3*@ r *@ s - @ r - 4*@ r*@ s*@ s*r
  1048. t t t t t t t t t t
  1049. 2 2 2
  1050. - 2*@ s*k*s - @ s *k - k))/(r *s )
  1051. t t t
  1052. 2 3
  1053. hlang := (12*( - @ r*@ r *s - 2*@ r*@ r*@ s*r - @ r*k*s - @ r *@ s
  1054. 4 4 t t t t t t t t t t t
  1055. 2 3
  1056. - @ r *@ s*r - @ r*@ s*k - @ s*k*r))/(r *s)
  1057. t t t t t t t
  1058. 2 3
  1059. hlang := (12*( - @ r*@ r *s - 2*@ r*@ r*@ s*r - @ r*k*s - @ r *@ s
  1060. 5 5 t t t t t t t t t t t
  1061. 2 3
  1062. - @ r *@ s*r - @ r*@ s*k - @ s*k*r))/(r *s)
  1063. t t t t t t t
  1064. % The complete Einstein tensor:
  1065. einst(-i,-j) := (ricci(-i,-j) - (1/2)*riccisc*g(-i,-j))*alp1 +
  1066. hlang(-i,-j)*alp2$
  1067. alp1 := 1$
  1068. factor alp2;
  1069. einst(-i,-j) := einst(-i,-j);
  1070. 3 2 2 2
  1071. einst := (12*alp2*(2*@ r *@ s*s + 3*@ r *@ s *r + @ r *r + 2*@ r*@ s*k*s
  1072. t t t t t t t t t
  1073. 2 3 2
  1074. + @ s *k*r + k*r))/(r *s )
  1075. t
  1076. 2 2 2 2 2 2
  1077. 3*@ r *s + 6*@ r*@ s*r*s + @ s *r + 3*k*s + r
  1078. t t t t
  1079. + ---------------------------------------------------
  1080. 2 2
  1081. r *s
  1082. 2
  1083. einst := (4*alp2*( - 4*@ r*@ r*@ s*s - 2*@ r*@ s *r - 2*@ r*r
  1084. 1 1 t t t t t t t t t
  1085. 2 2 2 2
  1086. - 2*@ r *@ s*s - 3*@ r *@ s - @ r - 4*@ r*@ s*@ s*r
  1087. t t t t t t t t t t
  1088. 2 2 2 2
  1089. - 2*@ s*k*s - @ s *k - k))/(r *s ) + ( - 2*@ r*r*s
  1090. t t t t t
  1091. 2 2 2 2 2 2 2
  1092. - @ r *s - 4*@ r*@ s*r*s - 2*@ s*r *s - @ s *r - k*s - r )/
  1093. t t t t t t
  1094. 2 2
  1095. (r *s )
  1096. 2
  1097. einst := (4*alp2*( - 4*@ r*@ r*@ s*s - 2*@ r*@ s *r - 2*@ r*r
  1098. 2 2 t t t t t t t t t
  1099. 2 2 2 2
  1100. - 2*@ r *@ s*s - 3*@ r *@ s - @ r - 4*@ r*@ s*@ s*r
  1101. t t t t t t t t t t
  1102. 2 2 2 2
  1103. - 2*@ s*k*s - @ s *k - k))/(r *s ) + ( - 2*@ r*r*s
  1104. t t t t t
  1105. 2 2 2 2 2 2 2
  1106. - @ r *s - 4*@ r*@ s*r*s - 2*@ s*r *s - @ s *r - k*s - r )/
  1107. t t t t t t
  1108. 2 2
  1109. (r *s )
  1110. 2
  1111. einst := (4*alp2*( - 4*@ r*@ r*@ s*s - 2*@ r*@ s *r - 2*@ r*r
  1112. 3 3 t t t t t t t t t
  1113. 2 2 2 2
  1114. - 2*@ r *@ s*s - 3*@ r *@ s - @ r - 4*@ r*@ s*@ s*r
  1115. t t t t t t t t t t
  1116. 2 2 2 2
  1117. - 2*@ s*k*s - @ s *k - k))/(r *s ) + ( - 2*@ r*r*s
  1118. t t t t t
  1119. 2 2 2 2 2 2 2
  1120. - @ r *s - 4*@ r*@ s*r*s - 2*@ s*r *s - @ s *r - k*s - r )/
  1121. t t t t t t
  1122. 2 2
  1123. (r *s )
  1124. 2 3
  1125. einst := (12*alp2*( - @ r*@ r *s - 2*@ r*@ r*@ s*r - @ r*k*s - @ r *@ s
  1126. 4 4 t t t t t t t t t t t
  1127. 2 3
  1128. - @ r *@ s*r - @ r*@ s*k - @ s*k*r))/(r *s)
  1129. t t t t t t t
  1130. 2 2
  1131. - 3*@ r*r*s - 3*@ r *s - 3*@ r*@ s*r - @ s*r - 3*k*s
  1132. t t t t t t t
  1133. + ------------------------------------------------------------
  1134. 2
  1135. r *s
  1136. 2 3
  1137. einst := (12*alp2*( - @ r*@ r *s - 2*@ r*@ r*@ s*r - @ r*k*s - @ r *@ s
  1138. 5 5 t t t t t t t t t t t
  1139. 2 3
  1140. - @ r *@ s*r - @ r*@ s*k - @ s*k*r))/(r *s)
  1141. t t t t t t t
  1142. 2 2
  1143. - 3*@ r*r*s - 3*@ r *s - 3*@ r*@ s*r - @ s*r - 3*k*s
  1144. t t t t t t t
  1145. + ------------------------------------------------------------
  1146. 2
  1147. r *s
  1148. clear o(k),e(k),riemc3(i,j),riemri(i,j),curv(k,l),riemann(a,b,c,d),
  1149. ricci(a,b),riccisc,t,u,v1,v2,theta,phi,r,om(k,l),einst(a,b),
  1150. hlang(a,b);
  1151. remfdomain r,s;
  1152. % Problem:
  1153. % --------
  1154. % Calculate for a given coframe and given torsion the Riemannian part and
  1155. % the torsion induced part of the connection. Calculate the curvature.
  1156. % For a more elaborate example see E.Schruefer, F.W. Hehl, J.D. McCrea,
  1157. % "Application of the REDUCE package EXCALC to the Poincare gauge field
  1158. % theory of gravity", GRG Journal, vol. 19, (1988) 197--218
  1159. pform {ff, gg}=0;
  1160. fdomain ff=ff(r), gg=gg(r);
  1161. coframe o(4) = d u + 2*b0*cos(theta)*d phi,
  1162. o(1) = ff*(d u + 2*b0*cos(theta)*d phi) + d r,
  1163. o(2) = gg*d theta,
  1164. o(3) = gg*sin(theta)*d phi
  1165. with metric g = -o(4)*o(1)-o(4)*o(1)+o(2)*o(2)+o(3)*o(3);
  1166. frame e;
  1167. pform {tor(a),gwt(a)}=2,gamma(a,b)=1,
  1168. {u1,u3,u5}=0;
  1169. index_symmetries gamma(a,b): antisymmetric;
  1170. fdomain u1=u1(r),u3=u3(r),u5=u5(r);
  1171. tor(4) := 0$
  1172. tor(1) := -u5*o(4)^o(1) - 2*u3*o(2)^o(3)$
  1173. tor(2) := u1*o(4)^o(2) + u3*o(4)^o(3)$
  1174. tor(3) := u1*o(4)^o(3) - u3*o(4)^o(2)$
  1175. gwt(-a) := d o(-a) - tor(-a)$
  1176. % The following is the combined connection.
  1177. % The Riemannian part could have equally well been calculated by the
  1178. % RIEMANNCONX statement.
  1179. gamma(-a,-b) := (1/2)*( e(-b) _| (e(-c) _| gwt(-a))
  1180. +e(-c) _| (e(-a) _| gwt(-b))
  1181. -e(-a) _| (e(-b) _| gwt(-c)) )*o(c);
  1182. 4
  1183. gamma := o *(@ ff - u5)
  1184. 4 1 r
  1185. 2
  1186. o *(@ gg*ff + gg*u1) 3 2
  1187. r o *( - b0*ff + gg *u3)
  1188. gamma := - ---------------------- + ------------------------
  1189. 4 2 gg 2
  1190. gg
  1191. 2
  1192. o *@ gg 3
  1193. r - o *b0
  1194. gamma := --------- + ----------
  1195. 1 2 gg 2
  1196. gg
  1197. 3
  1198. 2 2 o *(@ gg*ff + gg*u1)
  1199. o *(b0*ff - gg *u3) r
  1200. gamma := --------------------- - ----------------------
  1201. 4 3 2 gg
  1202. gg
  1203. 3
  1204. 2 o *@ gg
  1205. o *b0 r
  1206. gamma := ------- + ---------
  1207. 1 3 2 gg
  1208. gg
  1209. 1 3 4 2
  1210. o *b0 o *cos(theta) o *(b0*ff - 2*gg *u3)
  1211. gamma := ------- + --------------- + -----------------------
  1212. 2 3 2 sin(theta)*gg 2
  1213. gg gg
  1214. pform curv(a,b)=2;
  1215. index_symmetries curv(a,b): antisymmetric;
  1216. factor ^;
  1217. curv(-a,b) := d gamma(-a,b) + gamma(-c,b)^gamma(-a,c);
  1218. 4 2 3
  1219. curv := (2*o ^o
  1220. 4
  1221. 2
  1222. *(@ ff*b0*gg - 2*@ gg*b0*ff + @ gg*gg *u3 - b0*gg*u1 - b0*gg*u5))/
  1223. r r r
  1224. 3 4 1
  1225. gg + o ^o *(@ ff - @ u5)
  1226. r r r
  1227. 1 2 3 2
  1228. o ^o *(@ gg*gg - b0 )
  1229. 4 r r 4 2 3 3
  1230. curv := -------------------------- + (o ^o *( - @ ff*@ gg*gg - @ gg*ff*gg
  1231. 2 4 r r r r
  1232. gg
  1233. 3 2 2 4
  1234. + @ gg*gg *u5 - b0 *ff + 2*b0*gg *u3))/gg
  1235. r
  1236. 4 3 2
  1237. o ^o *(@ ff*b0*gg - 2*@ gg*b0*ff + 2*@ gg*gg *u3 - b0*gg*u5)
  1238. r r r
  1239. + --------------------------------------------------------------
  1240. 3
  1241. gg
  1242. 1 3 3 2
  1243. o ^o *(@ gg*gg - b0 )
  1244. 4 r r
  1245. curv := --------------------------
  1246. 3 4
  1247. gg
  1248. 4 2 2
  1249. o ^o *( - @ ff*b0*gg + 2*@ gg*b0*ff - 2*@ gg*gg *u3 + b0*gg*u5)
  1250. r r r
  1251. + -----------------------------------------------------------------
  1252. 3
  1253. gg
  1254. 4 3 3 3 3 2
  1255. + (o ^o *( - @ ff*@ gg*gg - @ gg*ff*gg + @ gg*gg *u5 - b0 *ff
  1256. r r r r r
  1257. 2 4
  1258. + 2*b0*gg *u3))/gg
  1259. 1 2 3
  1260. curv := (2*o ^o
  1261. 1
  1262. 2
  1263. *( - @ ff*b0*gg + 2*@ gg*b0*ff - @ gg*gg *u3 + b0*gg*u1 + b0*gg*u5))
  1264. r r r
  1265. 3 4 1
  1266. /gg + o ^o *( - @ ff + @ u5)
  1267. r r r
  1268. 1 1 2 3 3 3 4
  1269. curv := (o ^o *( - @ ff*@ gg*gg - @ gg*ff*gg - @ gg*gg *u1 - @ u1*gg
  1270. 2 r r r r r r
  1271. 2 2 4 1 3
  1272. - b0 *ff + b0*gg *u3))/gg + (o ^o *( - @ ff*b0*gg
  1273. r
  1274. 2 3 3
  1275. + 2*@ gg*b0*ff + @ gg*gg *u3 + @ u3*gg + b0*gg*u1))/gg + (
  1276. r r r
  1277. 4 2 4 2 3 3
  1278. o ^o *( - @ ff*gg *u1 + @ gg*ff *gg + @ gg*ff*gg *u1
  1279. r r r r
  1280. 3 4 2 2 2
  1281. + @ gg*ff*gg *u5 + @ u1*ff*gg - b0 *ff + 3*b0*ff*gg *u3
  1282. r r
  1283. 4 4 2 4 4 3 2
  1284. + gg *u1*u5 - 2*gg *u3 ))/gg + (o ^o *(@ ff*gg *u3
  1285. r
  1286. 2
  1287. - 3*@ gg*ff*gg*u3 - @ u3*ff*gg + b0*ff*u1 + b0*ff*u5
  1288. r r
  1289. 2 2 2
  1290. - 2*gg *u1*u3 - gg *u3*u5))/gg
  1291. 1 1 2
  1292. curv := (o ^o
  1293. 3
  1294. 2 3
  1295. *(@ ff*b0*gg - 2*@ gg*b0*ff - @ gg*gg *u3 - @ u3*gg - b0*gg*u1))/
  1296. r r r r
  1297. 3 1 3 3 3 3
  1298. gg + (o ^o *( - @ ff*@ gg*gg - @ gg*ff*gg - @ gg*gg *u1
  1299. r r r r r
  1300. 4 2 2 4 4 2 2
  1301. - @ u1*gg - b0 *ff + b0*gg *u3))/gg + (o ^o *( - @ ff*gg *u3
  1302. r r
  1303. 2
  1304. + 3*@ gg*ff*gg*u3 + @ u3*ff*gg - b0*ff*u1 - b0*ff*u5
  1305. r r
  1306. 2 2 2 4 3 4
  1307. + 2*gg *u1*u3 + gg *u3*u5))/gg + (o ^o *( - @ ff*gg *u1
  1308. r
  1309. 2 3 3 3
  1310. + @ gg*ff *gg + @ gg*ff*gg *u1 + @ gg*ff*gg *u5
  1311. r r r r
  1312. 4 2 2 2 4
  1313. + @ u1*ff*gg - b0 *ff + 3*b0*ff*gg *u3 + gg *u1*u5
  1314. r
  1315. 4 2 4
  1316. - 2*gg *u3 ))/gg
  1317. 2 1 2 3 3 3 4
  1318. curv := (o ^o *( - @ ff*@ gg*gg - @ gg*ff*gg - @ gg*gg *u1 - @ u1*gg
  1319. 4 r r r r r r
  1320. 2 2 4 1 3
  1321. - b0 *ff + b0*gg *u3))/gg + (o ^o *( - @ ff*b0*gg
  1322. r
  1323. 2 3 3
  1324. + 2*@ gg*b0*ff + @ gg*gg *u3 + @ u3*gg + b0*gg*u1))/gg + (
  1325. r r r
  1326. 4 2 4 2 3 3
  1327. o ^o *( - @ ff*gg *u1 + @ gg*ff *gg + @ gg*ff*gg *u1
  1328. r r r r
  1329. 3 4 2 2 2
  1330. + @ gg*ff*gg *u5 + @ u1*ff*gg - b0 *ff + 3*b0*ff*gg *u3
  1331. r r
  1332. 4 4 2 4 4 3 2
  1333. + gg *u1*u5 - 2*gg *u3 ))/gg + (o ^o *(@ ff*gg *u3
  1334. r
  1335. 2
  1336. - 3*@ gg*ff*gg*u3 - @ u3*ff*gg + b0*ff*u1 + b0*ff*u5
  1337. r r
  1338. 2 2 2
  1339. - 2*gg *u1*u3 - gg *u3*u5))/gg
  1340. 1 2 3 2
  1341. o ^o *(@ gg*gg - b0 )
  1342. 2 r r 4 2 3 3
  1343. curv := -------------------------- + (o ^o *( - @ ff*@ gg*gg - @ gg*ff*gg
  1344. 1 4 r r r r
  1345. gg
  1346. 3 2 2 4
  1347. + @ gg*gg *u5 - b0 *ff + 2*b0*gg *u3))/gg
  1348. r
  1349. 4 3 2
  1350. o ^o *(@ ff*b0*gg - 2*@ gg*b0*ff + 2*@ gg*gg *u3 - b0*gg*u5)
  1351. r r r
  1352. + --------------------------------------------------------------
  1353. 3
  1354. gg
  1355. 2 2 3
  1356. curv := (o ^o
  1357. 3
  1358. 2 2 3 2 2 2
  1359. *( - 2*@ gg *ff*gg - 2*@ gg*gg *u1 + 6*b0 *ff - 6*b0*gg *u3 + gg ))
  1360. r r
  1361. 4 1 3
  1362. 2*o ^o *(@ ff*b0*gg - 2*@ gg*b0*ff - @ u3*gg )
  1363. 4 r r r
  1364. /gg + ------------------------------------------------
  1365. 3
  1366. gg
  1367. 3 1 2
  1368. curv := (o ^o
  1369. 4
  1370. 2 3
  1371. *(@ ff*b0*gg - 2*@ gg*b0*ff - @ gg*gg *u3 - @ u3*gg - b0*gg*u1))/
  1372. r r r r
  1373. 3 1 3 3 3 3
  1374. gg + (o ^o *( - @ ff*@ gg*gg - @ gg*ff*gg - @ gg*gg *u1
  1375. r r r r r
  1376. 4 2 2 4 4 2 2
  1377. - @ u1*gg - b0 *ff + b0*gg *u3))/gg + (o ^o *( - @ ff*gg *u3
  1378. r r
  1379. 2
  1380. + 3*@ gg*ff*gg*u3 + @ u3*ff*gg - b0*ff*u1 - b0*ff*u5
  1381. r r
  1382. 2 2 2 4 3 4
  1383. + 2*gg *u1*u3 + gg *u3*u5))/gg + (o ^o *( - @ ff*gg *u1
  1384. r
  1385. 2 3 3 3
  1386. + @ gg*ff *gg + @ gg*ff*gg *u1 + @ gg*ff*gg *u5
  1387. r r r r
  1388. 4 2 2 2 4
  1389. + @ u1*ff*gg - b0 *ff + 3*b0*ff*gg *u3 + gg *u1*u5
  1390. r
  1391. 4 2 4
  1392. - 2*gg *u3 ))/gg
  1393. 1 3 3 2
  1394. o ^o *(@ gg*gg - b0 )
  1395. 3 r r
  1396. curv := --------------------------
  1397. 1 4
  1398. gg
  1399. 4 2 2
  1400. o ^o *( - @ ff*b0*gg + 2*@ gg*b0*ff - 2*@ gg*gg *u3 + b0*gg*u5)
  1401. r r r
  1402. + -----------------------------------------------------------------
  1403. 3
  1404. gg
  1405. 4 3 3 3 3 2
  1406. + (o ^o *( - @ ff*@ gg*gg - @ gg*ff*gg + @ gg*gg *u5 - b0 *ff
  1407. r r r r r
  1408. 2 4
  1409. + 2*b0*gg *u3))/gg
  1410. 3 2 3
  1411. curv := (o ^o
  1412. 2
  1413. 2 2 3 2 2 2
  1414. *(2*@ gg *ff*gg + 2*@ gg*gg *u1 - 6*b0 *ff + 6*b0*gg *u3 - gg ))/
  1415. r r
  1416. 4 1 3
  1417. 2*o ^o *( - @ ff*b0*gg + 2*@ gg*b0*ff + @ u3*gg )
  1418. 4 r r r
  1419. gg + ---------------------------------------------------
  1420. 3
  1421. gg
  1422. 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;
  1423. remfdomain u1,u3,u5,ff,gg;
  1424. showtime;
  1425. Time: 1110 ms plus GC time: 20 ms
  1426. end;
  1427. Time for test: 1110 ms, plus GC time: 20 ms