excalc.doc 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612
  1. EXCALC
  2. A System for Doing Calculations in the Calculus
  3. of
  4. Modern Differential Geometry
  5. USER's MANUAL
  6. Eberhard Schruefer
  7. April 1986
  8. Acknowledgments
  9. This program was developed over several years. I would like to express
  10. my deep gratitude to Dr. Anthony Hearn for his continuous interest in
  11. this work, and especially for his hospitality and support during a
  12. visit in 1984/85 at the Rand Corporation, where substantial progress
  13. on this package could be achieved. The Heinrich Hertz-Stiftung sup-
  14. ported this visit. Many thanks are also due to Drs. F.W. Hehl, University
  15. of Cologne, and J.D. McCrea, University College Dublin, for their
  16. suggestions and work on testing this program.
  17. Table of Contents
  18. Introduction
  19. 1. Declarations
  20. 2. Exterior Multiplication
  21. 3. Partial Differentiation
  22. 4. Exterior Differentiation
  23. 5. Inner Product
  24. 6. Lie Derivative
  25. 7. Hodge-* Duality Operator
  26. 8. Variational Derivative
  27. 9. Handling of Indices
  28. 10. Metric Structures
  29. 11. Riemannian Connections
  30. 12. Ordering and Structuring
  31. 13. Appendix
  32. A1. Summary of Operators and Commands
  33. A2. Examples
  34. INTRODUCTION
  35. EXCALC is designed for easy use by all who are familiar with the
  36. calculus of Modern Differential Geometry. Its syntax is kept as close
  37. as possible to standard textbook notations. Therefore, no great
  38. experience in writing computer algebra programs is required. It is
  39. almost possible to input to the computer the same as what would have
  40. been written down for a handcalculation. For example, the statement
  41. f*x^y + u_|(y^z^x)
  42. would be recognized by the program as a formula involving exterior
  43. products and an inner product. The program is currently able to
  44. handle scalar-valued exterior forms, vectors and operations between
  45. them, as well as non-scalar valued forms (indexed forms). With this,
  46. it should be an ideal tool for studying differential equations,
  47. doing calculations in general relativity and field theories, or doing
  48. simple things as calculating the Laplacian of a tensor field for
  49. an arbitrary given frame. With the increasing popularity of this
  50. calculus, this program should have an application in almost any field
  51. of physics and mathematics.
  52. Since the program is completely embedded in REDUCE, all features and
  53. facilities of REDUCE are available in a calculation. Even for those
  54. who are not quite comfortable in this calculus, there is a good chance
  55. of learning it by just playing with the program.
  56. This is still a very experimental version, and changes of the syntax
  57. are to be expected. The performance of the program can still be
  58. increased considerably.
  59. Complaints and comments are appreciated and should be sent to:
  60. Dr. Eberhard Schruefer
  61. Institut fuer methodische Grundlagen (F1-P)
  62. Gesellschaft fuer Mathematik und Datenverarbeitung mbH
  63. Postfach 1240
  64. Schloss Birlinghoven
  65. D-5205 St. Augustin 1
  66. WEST GERMANY
  67. If the use of this program leads to a publication, this document should
  68. be cited, and a copy of the article should be sent to the above address.
  69. 1. Declarations ________________
  70. Geometrical objects like exterior forms or vectors are introduced to the
  71. system by declaration commands. The declarations can appear anywhere in
  72. a program, but must, of course, be made prior to the use of the object.
  73. Everything that has no declaration is treated as a constant; therefore
  74. zero-forms must also be declared.
  75. An exterior form is introduced by
  76. PFORM declaration1,declaration2,....;
  77. where
  78. declaration::=<name>=<number>|<identifier>|<expression>
  79. <name>::=<identifier>|<identifier>(<arguments>)
  80. For example
  81. PFORM U=K,V=4,F=0,W=DIM-1;
  82. would declare U to be an exterior form of degree K, V to be a form of
  83. degree 4, F to be a form of degree 0 (a function), and W to be a form of
  84. degree DIM-1.
  85. If the exterior form should have indices, the declaration would be
  86. PFORM CURV(A,B)=2,CHRIS(A,B)=1;
  87. The name of the indices is arbitrary.
  88. The declaration of vectors is similar. The command TVECTOR takes a list
  89. of names.
  90. Example:
  91. To declare X as a vector and COMM as a vector with two indices, one
  92. would say
  93. TVECTOR X,COMM(A,B);
  94. If a declaration of an already existing name is made, the old
  95. declaration is removed, and the new one is taken.
  96. 2. Exterior Multiplication ___________________________
  97. Exterior multiplication between exterior forms is carried out with the
  98. nary infix operator ^ (wedge). Factors are ordered according to the
  99. usual ordering in REDUCE using the commutation rule for exterior
  100. products.
  101. Examples:
  102. PFORM U=1,V=1,W=K;
  103. U^V;
  104. U^V
  105. V^U;
  106. - U^V
  107. U^U;
  108. 0
  109. W^U^V;
  110. K
  111. ( - 1) *U^V^W
  112. (3*U-A*W)^(W+5*V)^U;
  113. A*(5*U^V^W - U^W^W)
  114. It is possible to declare the dimension of the underlying space by
  115. SPACEDIM <number>|<identifier>;
  116. If an exterior product has a degree higher than the dimension of the
  117. space, it is replaced by 0:
  118. SPACEDIM 4;
  119. PFORM U=2,V=3;
  120. U^V;
  121. 0
  122. 3. Partial Differentiation ___________________________
  123. Partial differentiation is denoted by the operator @. Its capability is
  124. the same as the REDUCE DF operator.
  125. Examples:
  126. @(SIN X,X);
  127. COS(X)
  128. @(F,X);
  129. 0
  130. An identifier can be declared to be a function of certain variables.
  131. This is done with the command _F_D_O_M_A_I_N. The following would tell the
  132. partial differentiation operator that F is a function of the variables X
  133. and Y and that H is a function of X.
  134. FDOMAIN F=F(X,Y),H=H(X);
  135. Applying @ to F and H would result in
  136. @(F,X);
  137. @ F
  138. X
  139. @(X*F,X);
  140. F + X*@ F
  141. X
  142. @(H,Y);
  143. 0
  144. The partial derivative symbol can also be an operator with a single
  145. argument. It then represents a natural base element of a tangent
  146. vector.
  147. Example:
  148. A*@ X + B*@ Y;
  149. A*@ + B*@
  150. X Y
  151. 4. Exterior Differentiation ____________________________
  152. Exterior differentiation of exterior forms is carried out by the
  153. operator d. Products are normally differentiated out, i.e.
  154. PFORM X=0,Y=K,Z=M;
  155. D(X * Y);
  156. X*d Y + d X^Y
  157. D(R*Y);
  158. R*d Y
  159. D(X*Y^Z);
  160. K
  161. ( - 1) *X*Y^d Z + X*d Y^Z + d X^Y^Z
  162. This expansion can be suppressed by the command _N_O_X_P_N_D _D.
  163. NOXPND D;
  164. D(Y^Z);
  165. d(Y^Z)
  166. To obtain a canonical form for an exterior product when the expansion is
  167. switched off, the operator D is shifted to the right if it appears in
  168. the leftmost place.
  169. D Y ^ Z;
  170. K
  171. - ( - 1) *Y^d Z + d(Y^Z)
  172. Expansion is performed again when the command _X_P_N_D _D is executed.
  173. Functions which are implicitly defined by the FDOMAIN command are
  174. expanded into partial derivatives:
  175. PFORM X=0,Y=0,Z=0,F=0;
  176. FDOMAIN F=F(X,Y);
  177. D F;
  178. @ F*d X + @ F*d Y
  179. X Y
  180. If an argument of an implicitly defined function has further
  181. dependencies the chain rule will be applied e.g.
  182. FDOMAIN Y=Y(Z);
  183. D F;
  184. @ F*d X + @ F*@ Y*d Z
  185. X Y Z
  186. Expansion into partial derivatives can be inhibited by _N_O_X_P_N_D @ and
  187. enabled again by _X_P_N_D @.
  188. The operator is of course aware of the rules that a repeated application
  189. always leads to zero and that there is no exterior form of higher degree
  190. than the dimension of the space.
  191. D D X;
  192. 0
  193. PFORM U=K;
  194. SPACEDIM K;
  195. D U;
  196. 0
  197. 5. Inner Product _________________
  198. The inner product between a vector and an exterior form is represented
  199. by the diphthong _| (underscore or-bar), which is the notation of many
  200. textbooks. If the exterior form is an exterior product, the inner
  201. product is carried through any factor
  202. Example:
  203. PFORM X=0,Y=K,Z=M;
  204. TVECTOR U,V;
  205. U_|(X*Y^Z);
  206. K
  207. X*(( - 1) *Y^U_|Z + U_|Y^Z)
  208. In repeated applications of the inner product to the same exterior form
  209. the vector arguments are ordered e.g.
  210. (U+X*V)_|(U_|(3*Z));
  211. - 3*U_|V_|Z
  212. The duality of natural base elements is also known by the system, i.e.
  213. PFORM X=0,Y=0;
  214. (A*@ X+B*@(Y))_|(3*D X-D Y);
  215. 3*A - B
  216. 6. Lie Derivative __________________
  217. The Lie derivative can be taken between a vector and an exterior form or
  218. between two vectors. It is represented by the infix operator |_ . In
  219. the case of Lie differentiating, an exterior form by a vector, the Lie
  220. derivative is expressed through inner products and exterior
  221. differentiations, i. e.
  222. PFORM Z=K;
  223. TVECTOR U;
  224. U |_ Z;
  225. U_|d Z + d(U_|Z)
  226. If the arguments of the Lie derivative are vectors, the vectors are
  227. ordered using the anticommutivity property, and functions (zero forms)
  228. are differentiated out.
  229. Example:
  230. TVECTOR U,V;
  231. V |_ U;
  232. - U|_V
  233. PFORM X=0,Y=0;
  234. (X*U)|_(Y*V);
  235. - U*Y*V_|d X + V*X*U_|d Y + X*Y*U|_V
  236. 7. Hodge-* Duality Operator ____________________________
  237. The Hodge-* duality operator maps an exterior form of degree K to an
  238. exterior form of degree N-K, where N is the dimension of the space. The
  239. double application of the operator must lead back to the original
  240. exterior form up to a factor. The following example shows how the factor
  241. is chosen here
  242. SPACEDIM N;
  243. PFORM X=K;
  244. # # X;
  245. 2
  246. (K + K*N)
  247. ( - 1) *X*SGN
  248. The indeterminate SGN in the above example denotes the sign of the deter
  249. minant of the metric. It can be assigned a value or will be
  250. automatically set if more of the metric structure is specified (via
  251. COFRAME), i.e. it is then set to g/|g|, where g is the determinant of
  252. the metric. If the Hodge-* operator appears in an exterior product of
  253. maximal degree as the leftmost factor, the Hodge-* is shifted to the
  254. right according to
  255. PFORM X=K,Y=K;
  256. # X ^ Y;
  257. 2
  258. (K + K*N)
  259. ( - 1) *X^# Y
  260. More simplifications are performed if a coframe is defined.
  261. 8. Variational Derivative __________________________
  262. The function VARDF returns as its value the variation of a given
  263. Lagrangian n-form with respect to a specified exterior form (a field of
  264. the Lagrangian). In the shared variable BNDEQ!*, the expression is
  265. stored that has to yield zero if integrated over the boundary.
  266. Syntax:
  267. VARDF(<Lagrangian n-form>,<exterior form>)
  268. Example:
  269. SPACEDIM 4;
  270. PFORM L=4,A=1,J=3;
  271. L:=-1/2*D A ^ # D A - A^# J$ %Lagrangian of the e.m. field
  272. VARDF(L,A);
  273. - (# J + d # d A) %Maxwell's equations
  274. BNDEQ!*;
  275. - 'A^# d A %Equation at the boundary
  276. Restrictions:
  277. In the current implementation, the Lagrangian must be built up by the
  278. fields and the operations d, #, and @. Variation with respect to indexed
  279. quantities is currently not allowed.
  280. For the calculation of the conserved currents induced by symmetry
  281. operators (vector fields), the function NOETHER is provided. It has the
  282. syntax:
  283. NOETHER(<Lagrangian n-form>,<field>,<symmetry generator>)
  284. Example:
  285. pform l=4,a=1,f=2;
  286. spacedim 4;
  287. l:= -1/2*d a^#d a; %Free Maxwell field;
  288. tvector x(k); %An unspecified generator;
  289. noether(l,a,x(-k));
  290. ( - 2*d(X _|A)^# d A - (X _|d A)^# d A + d A^(X _|# d A))/2
  291. K K K
  292. Comment:The above expression would be the canonical energy-momentum
  293. 3-forms of the Maxwell field, if X is interpreted as a translation;
  294. 9. Handling of Indices _______________________
  295. Exterior forms and vectors may have indices. On input, the indices are
  296. given as arguments of the object. A positive argument denotes a
  297. superscript and a negative argument a subscript. On output, the indexed
  298. quantity is displayed two dimensionally if NAT is on. Indices may be
  299. identifiers or numbers. However, zero is currently not allowed to be an
  300. index.
  301. Example:
  302. PFORM OM(K,L)=M,E(K)=1;
  303. E(K)^E(-L);
  304. K
  305. E ^E
  306. L
  307. OM(4,-2);
  308. 4
  309. OM
  310. 2
  311. In the current release, full simplification is performed only if an
  312. index range is specified. It is hoped that this restriction can be re-
  313. moved soon. If the index range (the values that the indices can obtain)
  314. is specified, the given expression is evaluated for all possible index
  315. values, and the summation convention is understood.
  316. Example:
  317. INDEXRANGE T,R,PH,Z;
  318. PFORM E(K)=1,S(K,L)=2;
  319. W := E(K)*E(-K);
  320. T R PH Z
  321. W := E *E + E *E + E *E + E *E
  322. T R PH Z
  323. S(K,L):=E(K)^E(L);
  324. T T
  325. S := 0
  326. R T T R
  327. S := - E ^E
  328. PH T T PH
  329. S := - E ^E
  330. .
  331. .
  332. .
  333. If the expression to be evaluated is not an assignment, the values of
  334. the expression are displayed as an assignment to an indexed variable
  335. with name NS. This is done only on output, i.e. no actual binding to
  336. the variable NS occurs.
  337. E(K)^E(L);
  338. T T
  339. NS := 0
  340. R T T R
  341. NS := - E ^E
  342. .
  343. .
  344. .
  345. It should be noted, however, that the index positions on the variable NS
  346. can sometimes not be uniquely determined by the system (because of
  347. possible reorderings in the expression). Generally it is advisable to
  348. use assignments to display complicated expressions.
  349. In certain cases, one would like to inhibit the summation over specified
  350. index names, or at all. For this the command _N_O_S_U_M <indexname1>,..; and
  351. the switch NOSUM are available. The command NOSUM has the effect that
  352. summation is not performed over those indices which had been listed.
  353. The command _R_E_N_O_S_U_M enables summation again. The switch NOSUM, if on,
  354. inhibits any summation.
  355. It is possible to declare an indexed quantity completely antisymmetric
  356. or completely symmetric by the command _A_N_T_I_S_Y_M_M_E_T_R_I_C <name1>,..; or
  357. _S_Y_M_M_E_T_R_I_C <name1>,...;. If applicable, these commands should be issued,
  358. since great savings in memory and execution time result. Only strict
  359. components are printed.
  360. 10. Metric Structures ______________________
  361. A metric structure is defined in EXCALC by specifying a set of basis one-
  362. forms (the coframe) together with the metric.
  363. Syntax:
  364. COFRAME <identifier><(index1)>=<expression1>,
  365. <identifier><(index2)>=<expression2>,
  366. .
  367. .
  368. <identifier><(indexn)>=<expressionn>
  369. WITH METRIC <name>=<expression>;
  370. This statement automatically sets the dimension of the space and the
  371. index range. The clause WITH METRIC can be omitted if the metric is
  372. Euclidean and the shorthand _W_I_T_H _S_I_G_N_A_T_U_R_E <diagonal elements> can be
  373. used in the case of a pseudo-Euclidean metric. The splitting of a metric
  374. structure in its metric tensor coefficients and basis one-forms is
  375. completely arbitrary including the extrems of an orthonormal frame and a
  376. coordinate frame.
  377. Examples:
  378. COFRAME E R=D R, E(PH)=R*D PH
  379. WITH METRIC G=E(R)*E(R)+E(PH)*E(PH); %Polar coframe;
  380. COFRAME E(R)=D R,E(PH)=R*D(PH); %Same as before;
  381. COFRAME O(T)=D T, O X=D X
  382. WITH SIGNATURE -1,1; %A Lorentz coframe;
  383. COFRAME B(XI)=D XI, B(ETA)=D ETA
  384. WITH METRIC W=-1/2*(B(XI)*B(ETA)+B(ETA)*B(XI)); %A lightcone coframe;
  385. COFRAME E R=D R, E PH=D PH %Polar coordinate
  386. WITH METRIC G=E R*E R+R**2*E PH*E PH; %basis;
  387. Individual elements of the metric can be accessed just by calling them
  388. with the desired indices. The value of the determinant of the covariant
  389. metric is stored in the variable DETM!*. The metric is not needed for
  390. lowering or raising of indices as the system performs this
  391. automatically, i.e. no matter in what index position values were
  392. assigned to an indexed quantity, the values can be retrieved for any
  393. index position just by writing the indexed quantity with the desired
  394. indices.
  395. Example:
  396. COFRAME E T=D T,E X=D X,E Y=D Y
  397. WITH SIGNATURE -1,1,1;
  398. PFORM F(K,L)=0;
  399. ANTISYMMETRIC F;
  400. F(-T,-X):=EX$ F(-X,-Y):=B$ F(-T,-Y):=0$
  401. ON NERO;
  402. F(K,-L):=F(K,-L);
  403. X
  404. F := - EX
  405. T
  406. T
  407. F := - EX
  408. X
  409. Y
  410. F := - B
  411. X
  412. X
  413. F := B
  414. Y
  415. Any expression containing differentials of the coordinate functions will
  416. be transformed into an expression of the basis one-forms.The system also
  417. knows how to take the exterior derivative of the basis one-forms.
  418. Example (spherical coordinates):
  419. COFRAME E(R)=D(R), E(TH)=R*D(TH), E(PH)=R*SIN(TH)*D(PH);
  420. D R^D TH;
  421. R TH
  422. (E ^E )/R
  423. D(E(TH));
  424. R TH
  425. (E ^E )/R
  426. PFORM F=0;
  427. FDOMAIN F=F(R,TH,PH);
  428. FACTOR E;
  429. ON RAT;
  430. D F; %The "gradient" of F in spherical coordinates;
  431. R TH PH
  432. E *@ F + (E *@ F)/R + (E *@ F)/(R*SIN(TH))
  433. R TH PH
  434. The frame dual to the frame defined by the COFRAME command can be
  435. introduced by _F_R_A_M_E <identifier>. This command causes the dual property
  436. to be recognized, and the tangent vectors of the coordinate functions
  437. are replaced by the frame basis vectors.
  438. Example:
  439. COFRAME B R=D R,B PH=R*D PH,E Z=D Z; %Cylindrical coframe;
  440. FRAME X;
  441. ON NERO;
  442. X(-K)_|B(L);
  443. R
  444. NS := 1
  445. R
  446. PH
  447. NS := 1
  448. PH
  449. Z
  450. NS := 1
  451. Z
  452. X(-K) |_ X(-L); %The commutator of the dual frame;
  453. NS := X /R
  454. PH R PH
  455. NS := ( - X )/R %I. e. it is not a coordinate base;
  456. R PH PH
  457. As a convenience, the frames can be displayed at any point in a program
  458. by the command _D_I_S_P_L_A_Y_F_R_A_M_E; .
  459. The Hodge-* duality operator returns the explicitly constructed dual
  460. element if applied to coframe base elements. The metric is properly
  461. taken into account.
  462. The total antisymmetric Levi-Cevita tensor _E_P_S is also avaiable. The
  463. value of EPS with an even permutation of the indices in a covariant
  464. position is taken to be +1.
  465. 11. Riemannian Connections ___________________________
  466. The command RIEMANNCONX is provided for calculating the connection 1
  467. forms. The values are stored on the name given to RIEMANNCONX. This
  468. command is far more efficient than calculating the connection from the
  469. differential of the basis one-forms and using inner products.
  470. Example (Calculate the connection 1-form and curvature 2-form on S(2)):
  471. COFRAME E TH=R*D TH,E PH=R*SIN(TH)*D PH;
  472. RIEMANNCONX OM;
  473. OM(K,-L); %Display the connection forms;
  474. TH
  475. NS := 0
  476. TH
  477. PH PH
  478. NS := (E *COS(TH))/(SIN(TH)*R)
  479. TH
  480. TH PH
  481. NS := ( - E *COS(TH))/(SIN(TH)*R)
  482. PH
  483. PH
  484. NS := 0
  485. PH
  486. PFORM CURV(K,L)=2;
  487. CURV(K,-L):=D OM(K,-L) + OM(K,-M)^OM(M-L); %The curvature forms
  488. TH
  489. CURV := 0
  490. TH
  491. PH TH PH 2
  492. CURV := ( - E ^E )/R %Of course it was a sphere with
  493. TH %radius R.
  494. TH TH PH 2
  495. CURV := (E ^E )/R
  496. PH
  497. PH
  498. CURV := 0
  499. PH
  500. 12. Ordering and Structuring _____________________________
  501. The ordering of an exterior form or vector can be changed by the command
  502. _F_O_R_D_E_R. In an expression, the first identifier or kernel in the
  503. arguments of FORDER is ordered ahead of the second, and so on, and
  504. ordered ahead of all not appearing as arguments. This ordering is done
  505. on the internal level and not only on output. The execution of this
  506. statement can therefore have tremendous effects on computation time and
  507. memory requirements. _R_E_M_F_O_R_D_E_R brings back standard ordering for those
  508. elements that are listed as arguments.
  509. Another ordering command is _I_S_O_L_A_T_E. It takes one argument. The system
  510. attempts to shift out this identifier or kernel to the leftmost
  511. position, utilizing commutation and derivative rules. _R_E_M_I_S_O_L_A_T_E
  512. restores normal ordering.
  513. Example:
  514. PFORM U=K,V=L,W=M;
  515. U^D(V)^W;
  516. U^d V^W
  517. FORDER V;
  518. U^D(V)^W;
  519. (K*L + K)
  520. ( - 1) *d V^U^W
  521. ISOLATE V;
  522. U^D(V);
  523. (K*L + K) L
  524. ( - 1) *(d(V^U) - ( - 1) *V^d U)
  525. An expression can be put in a more structured form by renaming a
  526. subexpression. This is done with the command KEEP which has the syntax
  527. KEEP <name1>=<expresson1>,<name2>=<expression2>,...
  528. The effect is that rules are set up for simplifying <name> without
  529. introducing its definition in an expression. In an expression the system
  530. also tries by reordering to generate as many instances of <name> as
  531. possible.
  532. Example:
  533. PFORM X=0,Y=0,Z=0,F=0,J=3;
  534. KEEP J=D X^D Y^D Z;
  535. J;
  536. J
  537. D J;
  538. 0
  539. J^D X;
  540. 0
  541. FDOMAIN F=F(X);
  542. D F^D Y^D Z;
  543. @ F*J
  544. X
  545. The capabilities of KEEP are currently very limited. Only exterior
  546. products should occur as righthand sides in KEEP.
  547. 13. Appendix _____________
  548. A1. Summary of Operators and Commands
  549. ^ Exterior Multiplication 2
  550. @ Partial Differentiation 3
  551. @ Tangent Vector 3
  552. # Hodge-* Operator 7
  553. _| Inner Product 5
  554. |_ Lie Derivative 6
  555. ANTISYMMETRIC Declares completely antisymmetric indexed 9
  556. quantities
  557. COFRAME Declaration of a coframe 10
  558. d Exterior differentiation 2
  559. DISPLAYFRAME Displays the frame 10
  560. EPS Levi-Civita tensor 10
  561. FDOMAIN Declaration of implicit dependencies 3
  562. FORDER Ordering command 12
  563. FRAME Declares the frame dual to the coframe 10
  564. INDEXRANGE Declaration of indices 9
  565. ISOLATE Ordering command 12
  566. KEEP Structuring command 12
  567. METRIC Clause of COFRAME to specify a metric 10
  568. NOETHER Calculates the Noether current 8
  569. NOSUM Inhibits summation convention 9
  570. NOXPND d Inhibits the use of product rule for d 4
  571. NOXPND @ Inhibits expansion into partial derivatives 4
  572. PFORM Declaration of exterior forms 1
  573. REMFORDER Clears ordering 12
  574. REMISOLATE Clears ISOLATE command 12
  575. RENOSUM Enables summation convention 9
  576. RIEMANNCONX Calculation of a Riemannian Connection 11
  577. SIGNATURE Clause of COFRAME to specify a pseudo-
  578. Euclidean metric 10
  579. SPACEDIM Command to set the dimension of a space 2
  580. SYMMETRIC Declares completely symmetric indexed 9
  581. quantities
  582. TVECTOR Declaration of vectors 1
  583. VARDF Variational derivative 8
  584. XPND d Enables the use of product rule for d 4
  585. (is set on default)
  586. XPND @ Enables expansion into partial derivatives 4
  587. (is set on default)
  588. A2. Examples
  589. The following examples should illustrate the use of EXCALC. It is not
  590. intended to show the most efficient or most elegant way of stating the
  591. problems; rather the variety of syntactic constructs are exemplified.
  592. The examples are on a test file distributed with EXCALC.
  593. %Problem: Calculate the PDE's for the isovector of the heat equation.
  594. %--------
  595. % (c.f. B.K. Harrison, f.B. Estabrook, "Geometric Approach...",
  596. % J. Math. Phys. 12, 653, 1971);
  597. %The heat equation @ psi = @ psi is equivalent to the set of exterior
  598. % xx t
  599. %equations (with u=@ psi, y=@ psi):
  600. % T x
  601. pform psi=0,u=0,x=0,y=0,t=0,a=1,da=2,b=2;
  602. a:=d psi - u*d t - y*d x;
  603. da:=- d u^d t - d y^d x;
  604. b:=u*d x^d t - d y^d t;
  605. %Now calculate the PDE's for the isovector;
  606. tvector v;
  607. pform vpsi=0,vt=0,vu=0,vx=0,vy=0;
  608. fdomain vpsi=vpsi(psi,t,u,x,y),vt=vt(psi,t,u,x,y),vu=vu(psi,t,u,x,y),
  609. vx=vx(psi,t,u,x,y),vy=vy(psi,t,u,x,y);
  610. v:=vpsi*@ psi + vt*@ t + vu*@ u + vx*@ x + vy*@ y;
  611. factor d;
  612. on rat;
  613. i1:=v |_ a - l*a;
  614. pform o=1;
  615. o:=ot*d t + ox*d x + ou*d u + oy*d y;
  616. fdomain f=f(psi,t,u,x,y);
  617. i11:=v_|d a - l*a + d f;
  618. let vx=-@(f,y),vt=-@(f,u),vu=@(f,t)+u*@(f,psi),vy=@(f,x)+y*@(f,psi),
  619. vpsi=f-u*@(f,u)-y*@(f,y);
  620. factor ^;
  621. i2:=v |_ b - xi*b - o^a + zet*da;
  622. let ou=0,oy=@(f,u,psi),ox=-u*@(f,u,psi),
  623. ot=@(f,x,psi)+u*@(f,y,psi)+y*@(f,psi,psi);
  624. i2;
  625. let zet=-@(f,u,x)-@(f,u,y)*u-@(f,u,psi)*y;
  626. i2;
  627. let xi=-@(f,t,u)-u*@(f,u,psi)+@(f,x,y)+u*@(f,y,y)+y*@(f,y,psi)+@(f,psi);
  628. i2;
  629. let @(f,u,u)=0;
  630. i2; % These PDE's have to be solved;
  631. clear a,da,b,v,i1,i11,o,i2,xi,t;
  632. remfdomain f;
  633. clear @(f,u,u);
  634. %Problem:
  635. %--------
  636. %Calculate the integrability conditions for the system of PDE's:
  637. %(c.f. B.F. Schutz, "Geometrical Methods of Mathematical Physics"
  638. %Cambridge University Press, 1984, p. 156)
  639. % @ z /@ x + a1*z + b1*z = c1
  640. % 1 1 2
  641. % @ z /@ y + a2*z + b2*z = c2
  642. % 1 1 2
  643. % @ z /@ x + f1*z + g1*z = h1
  644. % 2 1 2
  645. % @ z /@ y + f2*z + g2*z = h2
  646. % 2 1 2 ;
  647. 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,
  648. a1=0,a2=0,b1=0,b2=0,c1=0,c2=0,f1=0,f2=0,g1=0,g2=0,h1=0,h2=0;
  649. fdomain a1=a1(x,y),a2=a2(x,y),b1=b1(x,y),b2=b2(x,y),
  650. c1=c1(x,y),c2=c2(x,y),f1=f1(x,y),f2=f2(x,y),
  651. g1=g1(x,y),g2=g2(x,y),h1=h1(x,y),h2=h2(x,y);
  652. a:=a1*d x+a2*d y$
  653. b:=b1*d x+b2*d y$
  654. c:=c1*d x+c2*d y$
  655. f:=f1*d x+f2*d y$
  656. g:=g1*d x+g2*d y$
  657. h:=h1*d x+h2*d y$
  658. %The equivalent exterior system:;
  659. factor d;
  660. w(1) := d z(-1) + z(-1)*a + z(-2)*b - c;
  661. w(2) := d z(-2) + z(-1)*f + z(-2)*g - h;
  662. indexrange 1,2;
  663. factor z;
  664. %The integrability conditions:;
  665. integ(k) := d w(k) ^ w(1) ^ w(2);
  666. clear a,b,c,f,g,h,w(k),integ(k);
  667. %Problem:
  668. %--------
  669. %Calculate the PDE's for the generators of the d-theta symmetries of
  670. %the Lagrangian system of the planar Kepler problem.
  671. %c.f. W.Sarlet, F.Cantrijn, Siam Review 23, 467, 1981;
  672. %Verify that time translation is a d-theta symmetry and calculate the
  673. %corresponding integral;
  674. pform t=0,q(k)=0,v(k)=0,lam(k)=0,tau=0,xi(k)=0,et(k)=0,theta=1,f=0,
  675. l=0,glq(k)=0,glv(k)=0,glt=0;
  676. tvector gam,y;
  677. indexrange 1,2;
  678. fdomain tau=tau(t,q(k),v(k)),xi=xi(t,q(k),v(k)),f=f(t,q(k),v(k));
  679. l:=1/2*(v(1)**2+v(2)**2)+m/r$ %The Lagrangian;
  680. pform r=0;
  681. fdomain r=r(q(k));
  682. let @(r,q 1)=q(1)/r,@(r,q 2)=q(2)/r,q(1)**2+q(2)**2=r**2;
  683. lam(k):=-m*q(k)/r; %The force;
  684. gam:=@ t + v(k)*@(q(k)) + lam(k)*@(v(k))$
  685. et(k) := gam _| d xi(k) - v(k)*gam _| d tau$
  686. y :=tau*@ t + xi(k)*@(q(k)) + et(k)*@(v(k))$ %Symmetry generator;
  687. theta := l*d t + @(l,v(k))*(d q(k) - v(k)*d t)$
  688. factor @;
  689. s := y |_ theta - d f$
  690. glq(k):=@(q k)_|s;
  691. glv(k):=@(v k)_|s;
  692. glt:=@(t)_|s;
  693. %Translation in time must generate a symmetry;
  694. xi(k) := 0;
  695. tau := 1;
  696. glq k;
  697. glv k;
  698. glt;
  699. %The corresponding integral is of course the energy;
  700. integ := - y _| theta;
  701. clear l,lam k,gam,et k,y,theta,s,glq k,glv k,glt,t,q k,v k,tau,xi k;
  702. remfdomain r,f;
  703. %Problem:
  704. %--------
  705. %Calculate the "gradient" and "Laplacian" of a function and the "curl"
  706. %and "divergence" of a one-form in elliptic coordinates;
  707. coframe e u=sqrt(cosh(v)**2-sin(u)**2)*d u,
  708. e v=sqrt(cosh(v)**2-sin(u)**2)*d v,
  709. e ph=cos u*sinh v*d ph;
  710. pform f=0;
  711. fdomain f=f(u,v,ph);
  712. factor e,^;
  713. on rat,gcd;
  714. order cosh v, sin u;
  715. %The gradient:;
  716. d f;
  717. factor @;
  718. %The Laplacian:;
  719. # d # d f;
  720. %Another way of calculating the Laplacian:
  721. -#vardf(1/2*d f^#d f,f);
  722. remfac @;
  723. %Now calculate the "curl" and the "divergence" of a one-form;
  724. pform w=1,a(k)=0;
  725. fdomain a=a(u,v,ph);
  726. w:=a(-k)*e k;
  727. %The curl:;
  728. x := # d w;
  729. factor @;
  730. %The divergence;
  731. y := # d # w;
  732. remfac @;
  733. clear x,y,w,u,v,ph,e k,a k;
  734. remfdomain a,f;
  735. %Problem:
  736. %--------
  737. %Calculate in a spherical coordinate system the Navier Stokes equations;
  738. coframe e r=d r,e th=r*d th,e ph=r*sin th*d ph;
  739. frame x;
  740. fdomain v=v(t,r,th,ph),p=p(r,th,ph);
  741. pform v(k)=0,p=0,w=1;
  742. %We first calculate the convective derivative;
  743. w := v(-k)*e(k)$
  744. factor e; on rat;
  745. cdv := @(w,t) + (v(k)*x(-k)) |_ w - 1/2*d(v(k)*v(-k));
  746. %next we calculate the viscous terms;
  747. visc := nu*(d#d# w - #d#d w) + nus*d#d# w;
  748. %finally we add the pressure term and print the components of the
  749. %whole equation;
  750. pform nasteq=1,nast(k)=0;
  751. nasteq := cdv - visc + 1/rho*d p$
  752. factor @;
  753. nast(-k) := x(-k) _| nasteq;
  754. remfac @,e;
  755. clear v k,x k,nast k,cdv,visc,p,w,nasteq;
  756. remfdomain p,v;
  757. %Problem:
  758. %--------
  759. %Calculate from the Lagrangian of a vibrating rod the equation of
  760. % motion and show that the invariance under time translation leads
  761. % to a conserved current;
  762. pform y=0,x=0,t=0,q=0,j=0,lagr=2;
  763. fdomain y=y(x,t),q=q(x),j=j(x);
  764. factor ^;
  765. lagr:=1/2*(rho*q*@(y,t)**2-e*j*@(y,x,x)**2)*d x^d t;
  766. vardf(lagr,y);
  767. %The Lagrangian does not explicitly depend on time; therefore the
  768. %vector field @ t generates a symmetry. The conserved current is
  769. pform c=1;
  770. factor d;
  771. c := noether(lagr,y,@ t);
  772. %The exterior derivative of this must be zero or a multiple of the
  773. %equation of motion (weak conservation law) to be a conserved current;
  774. remfac d;
  775. d c;
  776. %i.e. it is a multiple of the equation of motion;
  777. clear lagr,c;
  778. %Problem:
  779. %--------
  780. %Show that the metric structure given by Eguchi and Hanson induces a
  781. %self-dual curvature.
  782. %c.f. T. Eguchi, P.B. Gilkey, A.J. Hanson, "Gravitation, Gauge Theories
  783. % and Differential Geometry", Physics Reports 66, 213, 1980;
  784. for all x let cos(x)**2=1-sin(x)**2;
  785. pform f=0,g=0;
  786. fdomain f=f(r), g=g(r);
  787. coframe o(r) =f*d r,
  788. o(theta) =(r/2)*(sin(psi)*d theta-sin(theta)*cos(psi)*d phi),
  789. o(phi) =(r/2)*(-cos(psi)*d theta-sin(theta)*sin(psi)*d phi),
  790. o(psi) =(r/2)*g*(d psi+cos(theta)*d phi);
  791. frame e;
  792. pform gamma1(a,b)=1,curv2(a,b)=2;
  793. antisymmetric gamma1,curv2;
  794. factor o;
  795. gamma1(-a,-b):=-(1/2)*( e(-a)_|(e(-c)_|(d o(-b)))
  796. -e(-b)_|(e(-a)_|(d o(-c)))
  797. +e(-c)_|(e(-b)_|(d o(-a))) )*o(c)$
  798. curv2(-a,b):=d gamma1(-a,b) + gamma1(-c,b)^gamma1(-a,c)$
  799. factor ^;
  800. curv2(a,b):= curv2(a,b)$
  801. let f=1/g;
  802. let g=sqrt(1-(a/r)**4);
  803. pform chck(k,l)=2;
  804. antisymmetric chck;
  805. %The following has to be zero for a self-dual curvature;
  806. chck(k,l):=1/2*eps(k,l,m,n)*curv2(-m,-n)+curv2(k,l);
  807. clear gamma1(a,b),curv2(a,b),f,g,chck(a,b),o(k),e(k);
  808. remfdomain f,g;
  809. %Problem:
  810. %--------
  811. %Calculate for a given coframe and given torsion the Riemannian part and
  812. %the torsion induced part of the connection. Calculate the curvature.
  813. %For a more elaborate example see E.Schruefer, F.W. Hehl, J.D. McCrea,
  814. %"Exterior Calculus on the Computer: The REDUCE-Package EXCALC Applied
  815. %to General Relativity and to the Poincare Gauge Theory", GRG, vol. 19,
  816. %1987, pp. 197-218
  817. pform ff=0, gg=0;
  818. fdomain ff=ff(r), gg=gg(r);
  819. coframe o(4)=d u+2*b0*cos(theta)*d phi,
  820. o(1)=ff*(d u+2*b0*cos(theta)*d phi)+ d r,
  821. o(2)=gg*d theta,
  822. o(3)=gg*sin(theta)*d phi
  823. with metric g=-o(4)*o(1)-o(4)*o(1)+o(2)*o(2)+o(3)*o(3);
  824. frame e;
  825. pform tor(a)=2,gwt(a)=2,gam(a,b)=1,
  826. u1=0,u3=0,u5=0;
  827. antisymmetric gam;
  828. fdomain u1=u1(r),u3=u3(r),u5=u5(r);
  829. tor(4):=0$
  830. tor(1):=-u5*o(4)^o(1)-2*u3*o(2)^o(3)$
  831. tor(2):=u1*o(4)^o(2)+u3*o(4)^o(3)$
  832. tor(3):=u1*o(4)^o(3)-u3*o(4)^o(2)$
  833. gwt(-a):=d o(-a)-tor(-a)$
  834. %The following is the combined connection;
  835. %The Riemannian part could have equally well been calculated by the
  836. %RIEMANNCONX statement;
  837. gam(-a,-b):=(1/2)*( e(-b)_|(e(-c)_|gwt(-a))
  838. +e(-c)_|(e(-a)_|gwt(-b))
  839. -e(-a)_|(e(-b)_|gwt(-c)) )*o(c);
  840. pform curv(a,b)=2;
  841. antisymmetric curv;
  842. factor ^;
  843. curv(-a,b):=d gam(-a,b) + gam(-c,b)^gam(-a,c);
  844. showtime;
  845. end;