1\documentclass[11pt]{article}
2\usepackage{reduce}
3\title{EXCALC: A System for Doing Calculations in the Calculus of Modern
4Differential Geometry}
5\author{Eberhard Schr\"{u}fer \\
6Institute SCAI.Alg   \\
7German National Research Center for Information Technology (GMD) \\
8Schloss Birlinghoven \\
9D-53754 Sankt Augustin \\
10Germany       \\[0.05in]
11Email: eschruefer@ca-musings.de}
12\begin{document}
13\maketitle
14
15\index{EXCALC package}
16
17\section*{Acknowledgments}
18
19This program was developed over several years. I would like to express
20my deep gratitude to Dr.\ Anthony Hearn for his continuous interest in
21this work, and especially for his hospitality and support during a
22visit in 1984/85 at the RAND Corporation, where substantial progress
23on this package could be achieved. The Heinrich Hertz-Stiftung
24supported this visit. Many thanks are also due to Drs. F.W. Hehl,
25University of Cologne, and J.D. McCrea, University College Dublin, for
26their suggestions and work on testing this program.
27
28\section{Introduction}
29
30\index{differential geometry}
31{\bf EXCALC} is designed for easy use by all who are familiar with the
32calculus of Modern Differential Geometry.  Its syntax is kept as close
33as possible to standard textbook notations.  Therefore, no great
34experience in writing computer algebra programs is required.  It is
35almost possible to input to the computer the same as what would have
36been written down for a hand-calculation.  For example, the statement
37\begin{verbatim}
38                       f*x^y + u _| (y^z^x)
39\end{verbatim}
40\index{exterior calculus}
41would be recognized by the program as a formula involving exterior
42products and an inner product.  The program is currently able to
43handle scalar-valued exterior forms, vectors and operations between
44them, as well as non-scalar valued forms (indexed forms).  With this,
45it should be an ideal tool for studying differential equations,
46doing calculations in general relativity and field theories, or doing
47such simple things as calculating the Laplacian of a tensor field for
48an arbitrary given frame.  With the increasing popularity of this
49calculus, this program should have an application in almost any field
50of physics and mathematics.
51
52Since the program is completely embedded in {\REDUCE}, all features and
53facilities of {\REDUCE} are available in a calculation.  Even for those
54who are not quite comfortable in this calculus, there is a good chance
55of learning it by just playing with the program.
56
57This is the last release of version 2. A much extended differential
58geometry package (which includes complete symbolic index simplification,
59tensors, mappings, bundles and others) is under development.
60
61Complaints and comments are appreciated and should be send to the author.
62If the use of this program leads to a publication, this document should
63be cited, and a copy of the article to the above address would be
64welcome.
65
66\section{Declarations}
67
68Geometrical objects like exterior forms or vectors are introduced to the
69system by declaration commands.  The declarations can appear anywhere in
70a program, but must, of course, be made prior to the use of the object.
71Everything that has no declaration is treated as a constant; therefore
72zero-forms must also be declared.
73
74An exterior form is introduced by\label{PFORM} \index{PFORM statement}
75\index{exterior form ! declaration}
76
77\hspace*{2em} \k{PFORM} \s{declaration$_1$}, \s{declaration$_2$}, \ldots;
78
79where
80\begin{tabbing}
81\s{declaration} ::= \s{name} $\mid$ \s{list of names}=\s{number} $\mid$  \s{identifier} $\mid$ \\
82\s{expression} \\
83\s{name} ::= \s{identifier} $\mid$ \s{identifier}(\s{arguments})
84\end{tabbing}
85
86For example
87\begin{verbatim}
88     pform u=k,v=4,f=0,w=dim-1;
89\end{verbatim}
90declares \texttt{U} to be an exterior form of degree \texttt{K}, \texttt{V} to be a
91form of degree 4, \texttt{F} to be a form of degree 0 (a function), and \texttt{W}
92to be a form of degree \texttt{DIM}-1.
93
94If the exterior form should have indices, the declaration would be
95\index{exterior form ! with indices}
96\begin{verbatim}
97     pform curv(a,b)=2,chris(a,b)=1;
98\end{verbatim}
99The names of the indices are arbitrary.
100
101Exterior forms of the same degree can be grouped into lists to save typing.
102\begin{verbatim}
103     pform {x,y,z}=0,{rho(k,l),u,v(k)}=1;
104\end{verbatim}
105The declaration of vectors is similar. The command \texttt{TVECTOR}\label{TVECTOR}
106takes a list of names. \index{TVECTOR command} \index{exterior form ! vector}
107
108\hspace*{2em} \k{TVECTOR} \s{name$_1$}, \s{name$_2$}, \ldots;
109
110For example, to declare \texttt{X} as a vector and \texttt{COMM} as a vector with
111two indices, one would say
112\begin{verbatim}
113     tvector x,comm(a,b);
114\end{verbatim}
115If a declaration of an already existing name is made, the old
116declaration is removed, and the new one is taken.
117
118The exterior degree of a symbol or a general expression can be obtained
119with the function \label{EXDEGREE} \index{EXDEGREE command}
120
121\hspace*{2em} \k{EXDEGREE} \s{expression};
122
123Example:
124\begin{verbatim}
125     exdegree(u + 3*chris(k,-k));
126
127     1
128\end{verbatim}
129
130
131\section{Exterior Multiplication}
132
133\index{"\^{} ! exterior multiplication} \index{exterior product}
134Exterior multiplication between exterior forms is carried out with the
135nary infix operator \^{ } (wedge)\label{wedge}.  Factors are ordered
136according to the usual ordering in {\REDUCE} using the commutation
137rule for exterior products.
138
139\example\index{EXCALC package ! example}
140
141\begin{verbatim}
142     pform u=1,v=1,w=k;
143
144     u^v;
145
146     U^V
147
148     v^u;
149
150     - U^V
151
152     u^u;
153
154     0
155
156     w^u^v;
157
158           K
159     ( - 1) *U^V^W
160
161     (3*u-a*w)^(w+5*v)^u;
162
163     A*(5*U^V^W - U^W^W)
164\end{verbatim}
165
166It is possible to declare the dimension of the underlying space
167by\label{SPACEDIM} \index{SPACEDIM command} \index{dimension}
168
169\hspace*{2em} \k{SPACEDIM} \s{number} $\mid$ \s{identifier};
170
171If an exterior product has a degree higher than the dimension of the
172space, it is replaced by 0:
173
174\begin{verbatim}
175     spacedim 4;
176
177     pform u=2,v=3;
178
179     u^v;
180
181     0
182\end{verbatim}
183
184
185\section{Partial Differentiation}
186
187Partial differentiation is denoted by the operator \texttt{@}\label{at}.  Its
188capability is the same as the {\REDUCE} \texttt{DF} operator.
189\index{"@ operator} \index{partial differentiation}
190\index{differentiation ! partial}
191
192\example\index{EXCALC package ! example}
193
194\begin{verbatim}
195     @(sin x,x);
196
197     COS(X)
198
199     @(f,x);
200
201     0
202\end{verbatim}
203
204An identifier can be declared to be a function of certain variables.
205\index{FDOMAIN command}
206This is done with the command \texttt{FDOMAIN}\label{FDOMAIN}.  The
207following would tell the partial differentiation operator that \texttt{F}
208is a function of the variables \texttt{X} and \texttt{Y} and that \texttt{H} is
209a function of \texttt{X}.
210
211\begin{verbatim}
212     fdomain f=f(x,y),h=h(x);
213\end{verbatim}
214
215Applying \texttt{@} to \texttt{F} and \texttt{H} would result in
216
217\begin{verbatim}
218     @(x*f,x);
219
220     F + X*@  F
221            X
222
223     @(h,y);
224
225     0
226\end{verbatim}
227
228\index{tangent vector}
229The partial derivative symbol can also be an operator with a single
230argument.  It then represents a natural base element of a tangent
231vector\label{at1}.
232
233\example\index{EXCALC package ! example}
234
235\begin{verbatim}
236     a*@ x + b*@ y;
237
238     A*@  + B*@
239        X      Y
240\end{verbatim}
241
242\section{Exterior Differentiation}
243\index{exterior differentiation}
244Exterior differentiation of exterior forms is carried out by the
245operator \texttt{d}\label{d}.  Products are normally differentiated out,
246\emph{i.e.}
247
248\begin{verbatim}
249     pform x=0,y=k,z=m;
250
251     d(x * y);
252
253     X*d Y + d X^Y
254
255     d(r*y);
256
257     R*d Y
258
259     d(x*y^z);
260
261           K
262     ( - 1) *X*Y^d Z  + X*d Y^Z + d X^Y^Z
263\end{verbatim}
264
265This expansion can be suppressed by the command \texttt{NOXPND D}\label{NOXPNDD}.
266\index{NOXPND ! D}
267
268\begin{verbatim}
269     noxpnd d;
270
271     d(y^z);
272
273     d(Y^Z)
274\end{verbatim}
275
276To obtain a canonical form for an exterior product when the expansion
277is switched off, the operator \texttt{D} is shifted to the right if it
278appears in the leftmost place.
279
280\begin{verbatim}
281     d y ^ z;
282
283             K
284     - ( - 1) *Y^d Z + d(Y^Z)
285\end{verbatim}
286
287Expansion is performed again when the command \texttt{XPND D}\label{XPNDD}
288is executed. \index{XPND ! D}
289
290Functions which are implicitly defined by the \texttt{FDOMAIN} command are
291expanded into partial derivatives:
292
293\begin{verbatim}
294     pform x=0,y=0,z=0,f=0;
295
296     fdomain f=f(x,y);
297
298     d f;
299
300     @  F*d X + @  F*d Y
301      X          Y
302\end{verbatim}
303
304If an argument of an implicitly defined function has further
305dependencies the chain rule will be applied \emph{e.g.} \index{chain rule}
306
307
308\begin{verbatim}
309     fdomain y=y(z);
310
311     d f;
312
313     @  F*d X + @  F*@  Y*d Z
314      X          Y    Z
315\end{verbatim}
316
317Expansion into partial derivatives can be inhibited by
318\texttt{NOXPND @}\label{NOXPNDA}
319and enabled again by \texttt{XPND @}\label{XPNDA}.
320\index{NOXPND ! "@} \index{XPND ! "@}
321
322The operator is of course aware of the rules that a repeated
323application always leads to zero and that there is no exterior form of
324higher degree than the dimension of the space.
325
326\begin{verbatim}
327     d d x;
328
329     0
330
331     pform u=k;
332     spacedim k;
333
334     d u;
335
336     0
337\end{verbatim}
338\section{Inner Product}
339\index{inner product ! exterior form}
340The inner product between a vector and an exterior form is represented
341by the diphthong \texttt{\_\textbar} \label{innerp} (underscore or-bar), which is the
342notation of many textbooks.  If the exterior form is an exterior
343product, the inner product is carried through any factor.
344\index{\_\textbar operator}
345
346\example\index{EXCALC package ! example}
347
348\begin{verbatim}
349     pform x=0,y=k,z=m;
350
351     tvector u,v;
352
353     u _| (x*y^z);
354
355              K
356     X*(( - 1) *Y^U _| Z + U _| Y^Z)
357\end{verbatim}
358
359In repeated applications of the inner product to the same exterior
360form the vector arguments are ordered \emph{e.g.}
361
362\begin{verbatim}
363     (u+x*v) _| (u _| (3*z));
364
365     - 3*U _| V _| Z
366\end{verbatim}
367
368The duality of natural base elements is also known by the system, \emph{i.e.}
369
370\begin{verbatim}
371     pform {x,y}=0;
372
373     (a*@ x+b*@(y)) _| (3*d x-d y);
374
375     3*A - B
376\end{verbatim}
377
378\section{Lie Derivative}
379
380\index{Lie Derivative}
381The Lie derivative can be taken between a vector and an exterior form
382or between two vectors.  It is represented by the infix operator \texttt{\textbar\_}
383\label{lie}.  In the case of Lie differentiating, an exterior form by
384a vector, the Lie derivative is expressed through inner products and
385exterior differentiations, \emph{i.e.} \index{\textbar\_ operator}
386
387\begin{verbatim}
388     pform z=k;
389
390     tvector u;
391
392     u |_ z;
393
394     U _| d Z + d(U _| Z)
395\end{verbatim}
396
397If the arguments of the Lie derivative are vectors, the vectors are
398ordered using the anticommutivity property, and functions (zero forms)
399are differentiated out.
400
401\example\index{EXCALC package ! example}
402
403\begin{verbatim}
404     tvector u,v;
405
406     v |_ u;
407
408     - U |_ V
409
410     pform x=0,y=0;
411
412     (x*u) |_ (y*v);
413
414     - U*Y*V _| d X + V*X*U _| d Y + X*Y*U |_ V
415\end{verbatim}
416
417\section{Hodge-* Duality Operator}
418
419\index{Hodge-* duality operator} \index{"\# ! Hodge-* operator}
420The Hodge-*\label{hodge} duality operator maps an exterior form of degree
421\texttt{K} to an exterior form of degree \texttt{N-K}, where \texttt{N} is the
422dimension of the space.  The double application of the operator must
423lead back to the original exterior form up to a factor. The following
424example shows how the factor is chosen here
425
426\begin{verbatim}
427     spacedim n;
428     pform x=k;
429
430     # # x;
431
432             2
433           (K  + K*N)
434     ( - 1)          *X*SGN
435\end{verbatim}
436\pagebreak
437\index{SGN ! indeterminate sign} \index{coframe}
438The indeterminate SGN in the above example denotes the sign of the
439determinant of the metric. It can be assigned a value or will be
440automatically set if more of the metric structure is specified (via
441COFRAME), \emph{i.e.} it is then set to $g/|g|$, where $g$ is the
442determinant of the metric.  If the Hodge-* operator appears in an
443exterior product of maximal degree as the leftmost factor, the Hodge-*
444is shifted to the right according to
445
446\begin{verbatim}
447     pform {x,y}=k;
448
449     # x ^ y;
450
451             2
452           (K  + K*N)
453     ( - 1)          *X^# Y
454\end{verbatim}
455
456More simplifications are performed if a coframe is defined.
457
458
459
460\section{Variational Derivative}
461
462\index{derivative ! variational} \index{variational derivative}
463\ttindex{VARDF}
464The function \texttt{VARDF}\label{VARDF} returns as its value the
465variation of a given Lagrangian n-form with respect to a specified
466exterior form (a field of the Lagrangian).  In the shared variable
467\ttindex{BNDEQ"!*}
468\texttt{BNDEQ!*}, the expression is stored that has to yield zero if
469integrated over the boundary.
470
471Syntax:
472
473\hspace*{2em} \k{VARDF}(\s{Lagrangian n-form},\s{exterior form})
474
475\example\index{EXCALC package ! example}
476
477\begin{verbatim}
478  spacedim 4;
479
480  pform l=4,a=1,j=3;
481
482  l:=-1/2*d a ^ # d a - a^# j$  %Lagrangian of the e.m. field
483
484  vardf(l,a);
485
486  - (# J + d # d A)             %Maxwell's equations
487
488  bndeq!*;
489
490  - 'A^# d A                    %Equation at the boundary
491\end{verbatim}
492Restrictions:
493
494In the current implementation, the Lagrangian must be built up by the
495fields and the operations \texttt{d}, \texttt{\#}, and \texttt{@}. Variation
496with respect to indexed quantities is currently not allowed.
497
498For the calculation of the conserved currents induced by symmetry
499operators (vector fields), the function \texttt{NOETHER}\label{NOETHER}
500\index{NOETHER function}
501is provided.  It has the syntax:
502
503\hspace*{2em}
504\k{NOETHER}(\s{Lagrangian n-form},\s{field},\s{symmetry generator})
505
506\example\index{EXCALC package ! example}
507
508\begin{verbatim}
509  pform l=4,a=1,f=2;
510
511  spacedim 4;
512
513  l := -1/2*d a^#d a;   %Free Maxwell field;
514
515  tvector x;        %An unspecified generator;
516
517  noether(l,a,x);
518
519    - 2*d(x _| a)^# d a + d a^x _| # d a - x _| d a^# d a
520   --------------------------------------------------------
521                           2
522
523
524\end{verbatim}
525
526The above expression would be the canonical energy
527momentum 3-forms of the Maxwell field, if X is interpreted
528as a translation;
529
530
531
532\section{Handling of Indices}
533\index{exterior form ! with indices}
534Exterior forms and vectors may have indices.  On input, the indices
535are given as arguments of the object.  A positive argument denotes a
536superscript and a negative argument a subscript.  On output, the
537indexed quantity is displayed two dimensionally if \texttt{NAT} is on.
538\index{NAT flag}
539Indices may be identifiers or numbers.
540
541\example\index{EXCALC package ! example}
542
543\begin{verbatim}
544     pform om(k,l)=m,e(k)=1;
545
546     e(k)^e(-l);
547
548      K
549     E ^E
550         L
551
552     om(4,-2);
553
554       4
555     OM
556        2
557\end{verbatim}
558
559In the current release, full simplification is performed only if an
560index range is specified.  It is hoped that this restriction can be
561removed soon.  If the index range (the values that the indices can
562obtain) is specified, the given expression is evaluated for all
563possible index values, and the summation convention is understood.
564
565\example\label{INDEXRANGE}\index{EXCALC package ! example}
566
567\begin{verbatim}
568     indexrange t,r,ph,z;
569
570     pform e(k)=1,s(k,l)=2;
571
572     w := e(k)*e(-k);
573
574              T       R        PH       Z
575     W := E *E  + E *E  + E  *E   + E *E
576           T       R       PH        Z
577
578
579     s(k,l):=e(k)^e(l);
580
581      T T
582     S    := 0
583
584      R T       T  R
585     S    := - E ^E
586
587      PH T       T  PH
588     S     := - E ^E
589
590       .
591       .
592       .
593
594\end{verbatim}
595
596If the expression to be evaluated is not an assignment, the values of
597the expression are displayed as an assignment to an indexed variable
598with name \texttt{NS}.  This is done only on output, \emph{i.e.} no actual
599binding to the variable NS occurs.
600\index{NS dummy variable}
601
602\begin{verbatim}
603     e(k)^e(l);
604
605       T T
606     NS    := 0
607
608       R T       T  R
609     NS    := - E ^E
610       .
611       .
612       .
613\end{verbatim}
614
615It should be noted, however, that the index positions on the variable
616NS can sometimes not be uniquely determined by the system (because of
617possible reorderings in the expression). Generally it is advisable to
618use assignments to display complicated expressions.
619
620A range can also be assigned to individual index-names. For example,
621the declaration
622
623\begin{verbatim}
624    indexrange {k,l}={x,y,z},{u,v,w}={1,2};
625\end{verbatim}
626
627would assign to the index identifiers k,l the range values x,y,z and
628to the index identifiers u,v,w the range values 1,2. The use of an
629index identifier not listed in previous indexrange statements has the
630range of the union of all given index ranges.
631
632With the above example of an indexrange statement, the following
633index evaluations would take place
634
635\begin{verbatim}
636     pform w n=0;
637
638     w(k)*w(-k);
639
640         X       Y       Z
641     W *W  + W *W  + W *W
642      X       Y       Z
643
644     w(u)*w(-u);
645
646         1       2
647     W *W  + W *W
648      1       2
649
650     w(r)*w(-r);
651
652         1       2       X       Y       Z
653     W *W  + W *W  + W *W  + W *W  + W *W
654      1       2       X       Y       Z
655\end{verbatim}
656
657In certain cases, one would like to inhibit the summation over
658specified index names, or at all.  For this the command
659
660\index{NOSUM command}
661\hspace*{2em} \k{NOSUM} \s{indexname$_1$}, \ldots;\label{NOSUM}
662
663and the switch \texttt{NOSUM} are \index{NOSUM switch}
664available.  The command \texttt{NOSUM} has the effect that summation is
665not performed over those indices which had been listed.  The command
666\texttt{RENOSUM}\label{RENOSUM} enables summation again.  The switch \texttt{NOSUM},
667if on, inhibits any summation. \index{RENOSUM command}
668
669\label{INDEXSYMMETRIES} \index{INDEXSYMMETRIES command}
670It is possible to declare symmetry properties for an indexed quantity by
671the command \texttt{INDEX\_SYMMETRIES}. A prototypical example is as
672follows
673
674\begin{verbatim}
675
676    index_symmetries u(k,l,m,n): symmetric     in {k,l},{m,n}
677                                 antisymmetric in {{k,l},{m,n}},
678                     g(k,l),h(k,l): symmetric;
679
680\end{verbatim}
681
682It declares the object \texttt{u} symmetric in the first two and last
683two indices and antisymmetric with respect to commutation of the given
684index pairs. If an object is completely symmetric or antisymmetric,
685the indices need not to be given after the corresponding keyword as
686shown above for \texttt{g} and \texttt{h}.
687
688If applicable, this command should
689be issued, since great savings in memory and execution time result.
690Only strict components are printed.
691
692The commands symmetric and antisymmetric of earlier releases have no
693effect.
694
695
696\section{Metric Structures}
697
698\index{metric structure} \index{coframe}
699A metric structure is defined in {\bf EXCALC} by specifying a set of
700basis one-forms (the coframe) together with the metric.
701
702Syntax:\label{COFRAME}
703
704\begin{tabbing}
705\hspace*{2em} \k{COFRAME} \=
706\s{identifier}\s{(index$_1$)}=\s{expression$_1$}, \\
707\> \s{identifier}\s{(index$_2$)}=\s{expression$_2$}, \\
708\> . \\
709\> . \\
710\> . \\
711\> \s{identifier}\s{(index$_n$)}=\s{expression$_n$} \\
712\> \hspace{1em} \k{WITH} \k{METRIC} \s{name}=\s{expression}; \\
713\end{tabbing}
714
715\index{euclidean metric} \index{COFRAME ! WITH METRIC}
716This statement automatically sets the dimension of the space and the
717index range. The clause \texttt{WITH METRIC} can be omitted if the metric
718\index{COFRAME ! WITH SIGNATURE}
719is Euclidean and the shorthand \texttt{WITH SIGNATURE \s{diagonal elements}}
720\label{SIGNATURE} can be used in the case of a pseudo-Euclidean metric. The
721splitting of a metric structure in its metric tensor coefficients and
722basis one-forms is completely arbitrary including the extremes of an
723orthonormal frame and a coordinate frame.
724
725\example\index{EXCALC package ! example}
726
727\begin{verbatim}
728 coframe e r=d r, e(ph)=r*d ph
729   with metric g=e(r)*e(r)+e(ph)*e(ph);    %Polar coframe
730
731 coframe e(r)=d r,e(ph)=r*d(ph);           %Same as before
732
733 coframe o(t)=d t, o x=d x
734   with signature -1,1;                    %A Lorentz coframe
735
736 coframe b(xi)=d xi, b(eta)=d eta          %A lightcone coframe
737   with metric w=-1/2*(b(xi)*b(eta)+b(eta)*b(xi));
738
739 coframe e r=d r, e ph=d ph                %Polar coordinate
740   with metric g=e r*e r+r**2*e ph*e ph;   %basis
741
742\end{verbatim}
743
744Individual elements of the metric can be accessed just by calling them
745with the desired indices. The value of the determinant of the
746\index{determinant ! in DETM"!*} \ttindex{DETM"!*}
747covariant metric is stored in the variable \texttt{DETM!*}.  The metric
748is not needed for lowering or raising of indices as the system
749performs this automatically, \emph{i.e.} no matter in what index
750position values were assigned to an indexed quantity, the values can
751be retrieved for any index position just by writing the indexed
752quantity with the desired indices.
753
754\example\index{EXCALC package ! example}
755
756\begin{verbatim}
757     coframe e t=d t,e x=d x,e y=d y
758      with signature -1,1,1;
759
760     pform f(k,l)=0;
761
762     index_symmetries f(k,l): antisymmetric;
763
764     f(k,l) := 0$
765     f(-t,-x):=ex$ f(-x,-y):=b$
766     on nero;
767
768     f(k,-l);
769
770       X
771     NS     := - EX
772         T
773
774       T
775     NS    := - EX
776         X
777
778       Y
779     NS     := - B
780         X
781
782       X
783     NS      := B
784         Y
785\end{verbatim}
786
787Any expression containing differentials of the coordinate functions will
788be transformed into an expression of the basis one-forms.The system also
789knows how to take the exterior derivative of the basis one-forms.
790
791\index{spherical coordinates}
792\example (Spherical coordinates)\index{EXCALC package ! example}
793
794\begin{verbatim}
795     coframe e(r)=d(r), e(th)=r*d(th), e(ph)=r*sin(th)*d(ph);
796
797     d r^d th;
798
799       R  TH
800     (E ^E  )/R
801
802     d(e(th));
803
804       R  TH
805     (E ^E  )/R
806
807
808     pform f=0;
809
810     fdomain f=f(r,th,ph);
811
812     factor e;
813
814     on rat;
815
816     d f;       %The "gradient" of F in spherical coordinates;
817
818      R          TH              PH
819     E *@  F + (E  *@   F)/R + (E  *@   F)/(R*SIN(TH))
820         R           TH              PH
821\end{verbatim}
822
823The frame dual to the frame defined by the \texttt{COFRAME} command can
824be introduced by \k{FRAME} command. \index{FRAME command}
825
826\hspace*{2em} \k{FRAME} \s{identifier};\label{FRAME}
827
828This command causes the
829dual property to be recognized, and the tangent vectors of the
830coordinate functions are replaced by the frame basis vectors.
831
832\example\index{EXCALC package ! example}
833
834\begin{verbatim}
835   coframe b r=d r,b ph=r*d ph,e z=d z; %Cylindrical coframe;
836
837   frame x;
838
839   on nero;
840
841   x(-k) _| b(l);
842
843       R
844   NS    := 1
845     R
846
847        PH
848   NS      := 1
849     PH
850
851       Z
852   NS    := 1
853     Z
854
855   x(-k) |_ x(-l);       %The commutator of the dual frame;
856
857
858   NS     := X  /R
859     PH R     PH
860
861
862   NS     := ( - X  )/R  %i.e. it is not a coordinate base;
863     R PH         PH
864
865\end{verbatim}
866
867\index{DISPLAYFRAME command} \index{tracing ! EXCALC}
868As a convenience, the frames can be displayed at any point in a program
869by the command \texttt{DISPLAYFRAME;}\label{DISPLAYFRAME}.
870
871\index{Hodge-* duality operator}
872The Hodge-* duality operator returns the explicitly constructed dual
873element if applied to coframe base elements. The metric is properly
874taken into account.
875
876\index{Levi-Cevita tensor} \ttindex{EPS}
877The total antisymmetric Levi-Cevita tensor \texttt{EPS}\label{EPS} is
878also available.  The value of \texttt{EPS} with an even permutation of the
879indices in a covariant position is taken to be +1.
880
881
882\section{Riemannian Connections}
883
884\index{Riemannian Connections}
885The command \texttt{RIEMANNCONX} is provided for calculating the
886\index{RIEMANNCONX command} \label{RIEMANNCONX}
887connection 1 forms.  The values are stored on the name given to \texttt{RIEMANNCONX}.
888This command is far more efficient than calculating the
889connection from the differential of the basis one-forms and using
890inner products.
891
892\example (Calculate the connection 1-form and curvature 2-form on S(2))
893\index{EXCALC package ! example}
894
895\begin{verbatim}
896   coframe e th=r*d th,e ph=r*sin(th)*d ph;
897
898   riemannconx om;
899
900   om(k,-l);                 %Display the connection forms;
901
902     TH
903   NS      := 0
904        TH
905
906     PH         PH
907   NS      := (E  *COS(TH))/(SIN(TH)*R)
908        TH
909
910     TH            PH
911   NS      := ( - E  *COS(TH))/(SIN(TH)*R)
912        PH
913
914     PH
915   NS      := 0
916        PH
917
918   pform curv(k,l)=2;
919
920
921   curv(k,-l):=d om(k,-l) + om(k,-m)^om(m-l);
922                 %The curvature forms
923
924       TH
925   CURV      := 0
926          TH
927
928       PH            TH  PH   2
929   CURV      := ( - E  ^E  )/R
930          TH               %Of course it was a sphere with
931                           %radius R.
932
933       TH         TH  PH   2
934   CURV      := (E  ^E  )/R
935          PH
936
937       PH
938   CURV      := 0
939          PH
940\end{verbatim}
941
942\section{Killing Vectors}
943
944\index{Killing Vectors}
945The command \texttt{KILLING\_VECTOR} is provided for calculating the
946\index{KILLING_VECTOR command} \label{KILLING_VECTOR}
947determining system of partial differential equations of Killing vectors for
948a given metric structure provided by the coframe statement.  The result is
949a list where the first entry is a vector constructed from the identifier
950given to the command and the second entry consists of a list of partial
951differential equations for the coefficients of this vector.
952
953\example (Calculate the determining pde's for a Killing vector of S(2))
954\index{EXCALC package ! example}
955\begin{verbatim}
956
957coframe e th = d th,e ph = sin th*d ph;
958
959killing_vector u;
960
961
962      ph        th
963{@  *u   + @  *u  ,
964  ph        th
965
966       th
967 {@  (u  ),
968   th
969
970       ph         2        th
971  @  (u  )*sin(th)  + @  (u  ),
972   th                  ph
973
974           th        ph
975  cos(th)*u   + @  (u  )*sin(th)}}
976                 ph
977
978\end{verbatim}
979
980
981\section{Ordering and Structuring}
982
983\index{ordering ! exterior form} \index{FORDER command}
984The ordering of an exterior form or vector can be changed by the
985command \texttt{FORDER}.\label{FORDER}  In an expression, the first
986identifier or kernel in the arguments of \texttt{FORDER} is ordered ahead
987of the second, and so on, and ordered ahead of all not appearing as
988arguments.  This ordering is done on the internal level and not only
989on output.  The execution of this statement can therefore have
990tremendous effects on computation time and memory requirements.
991\texttt{REMFORDER}\label{REMFORDER} brings back standard ordering for those
992elements that are listed as arguments. \index{REMFORDER command}
993
994An expression can be put in a more structured form by renaming a
995subexpression.  This is done with the command \texttt{KEEP} which
996has the syntax \index{KEEP command}\label{KEEP}
997
998\hspace*{2em} \k{KEEP}
999\s{name$_1$}=\s{expression$_1$},\s{name$_2$}=\s{expression$_2$}, \ldots
1000
1001The effect is that rules are set up for simplifying \s{name} without
1002introducing its definition in an expression. In an expression the system
1003also tries by reordering to generate as many instances of \s{name} as
1004possible.
1005
1006\example\index{EXCALC package ! example}
1007
1008\begin{verbatim}
1009     pform x=0,y=0,z=0,f=0,j=3;
1010
1011     keep j=d x^d y^d z;
1012
1013     j;
1014
1015     J
1016
1017     d j;
1018
1019     0
1020
1021     j^d x;
1022
1023     0
1024
1025     fdomain f=f(x);
1026
1027     d f^d y^d z;
1028
1029     @  F*J
1030      X
1031\end{verbatim}
1032
1033\index{exterior product}
1034The capabilities of \texttt{KEEP} are currently very limited.  Only exterior
1035products should occur as righthand sides in \texttt{KEEP}.
1036
1037
1038\section{Summary of Operators and Commands}
1039Table~\ref{EXCALC:sum} summarizes EXCALC commands and the page number they are
1040defined on.
1041
1042\begin{table}
1043\begin{tabular}{l l r}
1044\index{"\^{} ! exterior multiplication} \index{wedge}
1045\texttt{\^{ }}  &  Exterior Multiplication & \pageref{wedge} \\
1046\index{"@ ! partial differentiation}
1047\texttt{@}  & Partial Differentiation & \pageref{at}  \\
1048\index{"@ ! tangent vector}
1049\texttt{@}  & Tangent Vector  & \pageref{at1}  \\
1050\index{"\# ! Hodge-* operator}
1051\texttt{\#}  & Hodge-* Operator & \pageref{hodge} \\
1052\index{\_\textbar operator}
1053\texttt{\_\textbar}  & Inner Product  & \pageref{innerp} \\
1054\index{\textbar\_ operator}
1055\texttt{\textbar\_}  & Lie Derivative  & \pageref{lie}  \\
1056\index{COFRAME command}
1057\texttt{COFRAME} & Declaration of a coframe & \pageref{COFRAME} \\
1058\index{d ! exterior differentiation}
1059\texttt{d} &  Exterior differentiation & \pageref{d} \\
1060\index{DISPLAYFRAME command}
1061\texttt{DISPLAYFRAME} & Displays the frame & \pageref{DISPLAYFRAME}\\
1062\index{EPS ! Levi-Civita tensor}
1063\texttt{EPS} & Levi-Civita tensor  & \pageref{EPS}  \\
1064\index{EXDEGREE}
1065\texttt{EXDEGREE} & Calculates the exterior degree of an expression & \pageref{EXDEGREE}  \\
1066\index{FDOMAIN command}
1067\texttt{FDOMAIN} & Declaration of implicit dependencies &\pageref{FDOMAIN} \\
1068\index{FORDER command}
1069\texttt{FORDER} & Ordering command  & \pageref{FORDER} \\
1070\index{FRAME command}
1071\texttt{FRAME} & Declares the frame dual to the coframe & \pageref{FRAME} \\
1072\index{INDEXRANGE command}
1073\texttt{INDEXRANGE} & Declaration of indices & \pageref{INDEXRANGE} \\
1074\index{INDEX\_SYMMETRIES command}
1075\texttt{INDEX\_SYMMETRIES} & Declares arbitrary index symmetry properties  & \pageref{INDEXSYMMETRIES} \\
1076\index{KEEP command}
1077\texttt{KEEP} & Structuring command  & \pageref{KEEP} \\
1078\index{KILLING_VECTOR command}
1079\texttt{KILLING\_VECTOR} & Structuring command  & \pageref{KILLING_VECTOR} \\
1080\index{METRIC command}
1081\texttt{METRIC} & Clause of COFRAME to specify a metric & \pageref{COFRAME} \\
1082\index{NOETHER function}
1083\texttt{NOETHER} & Calculates the Noether current & \pageref{NOETHER} \\
1084\index{NOSUM command}
1085\texttt{NOSUM} & Inhibits summation convention & \pageref{NOSUM} \\
1086\index{NOXPND command}
1087\texttt{NOXPND d} & Inhibits the use of product rule for d &
1088\pageref{NOXPNDD} \\
1089\index{NOXPND "@ command}
1090\texttt{NOXPND @} & Inhibits expansion into partial derivatives &
1091\pageref{NOXPNDA} \\
1092\index{PFORM command}
1093\texttt{PFORM} & Declaration of exterior forms & \pageref{PFORM} \\
1094\index{REMFORDER command}
1095\texttt{REMFORDER} & Clears ordering  & \pageref{REMFORDER} \\
1096\index{RENOSUM command}
1097\texttt{RENOSUM} & Enables summation convention & \pageref{RENOSUM} \\
1098\index{RIEMANNCONX command}
1099\texttt{RIEMANNCONX} & Calculation of a Riemannian Connection &
1100\pageref{RIEMANNCONX} \\
1101\index{SIGNATURE command}
1102\texttt{SIGNATURE} & Clause of COFRAME to specify a pseudo- & \pageref{SIGNATURE} \\
1103  & Euclidean metric &   \\
1104\index{SPACEDIM command}
1105\texttt{SPACEDIM} & Command to set the dimension of a space &
1106\pageref{SPACEDIM} \\
1107\index{TVECTOR command}
1108\texttt{TVECTOR} & Declaration of vectors  & \pageref{TVECTOR} \\
1109\ttindex{VARDF}
1110\texttt{VARDF} & Variational derivative  & \pageref{VARDF} \\
1111\index{XPND command}
1112\texttt{XPND d} & Enables the use of product rule for d & \pageref{XPNDD} \\
1113  & (default)  &   \\
1114\index{XPND ! "@}
1115\texttt{XPND @} & Enables expansion into partial derivatives & \pageref{XPNDA} \\
1116  & (default)
1117\end{tabular}
1118\caption{EXCALC Command Summary}\label{EXCALC:sum}
1119\end{table}
1120\newpage
1121\section{Examples}
1122
1123The following examples should illustrate the use of {\bf EXCALC}. It is not
1124intended to show the most efficient or most elegant way of stating the
1125problems; rather the variety of syntactic constructs are exemplified.
1126The examples are on a test file distributed with {\bf EXCALC}.
1127\index{EXCALC package ! example}
1128{\small
1129\begin{verbatim}
1130
1131% Problem: Calculate the PDE's for the isovector of the heat equation.
1132% --------
1133%         (c.f. B.K. Harrison, f.B. Estabrook, "Geometric Approach...",
1134%          J. Math. Phys. 12, 653, 1971)
1135
1136% The heat equation @   psi = @  psi is equivalent to the set of exterior
1137%                    xx        t
1138
1139% equations (with u=@ psi, y=@ psi):
1140%                    T        x
1141
1142
1143pform {psi,u,x,y,t}=0,a=1,{da,b}=2;
1144
1145a := d psi - u*d t - y*d x;
1146
1147da := - d u^d t - d y^d x;
1148
1149b := u*d x^d t - d y^d t;
1150
1151
1152% Now calculate the PDE's for the isovector.
1153
1154tvector v;
1155
1156pform {vpsi,vt,vu,vx,vy}=0;
1157fdomain vpsi=vpsi(psi,t,u,x,y),vt=vt(psi,t,u,x,y),vu=vu(psi,t,u,x,y),
1158                               vx=vx(psi,t,u,x,y),vy=vy(psi,t,u,x,y);
1159
1160v := vpsi*@ psi + vt*@ t + vu*@ u + vx*@ x + vy*@ y;
1161
1162
1163factor d;
1164on rat;
1165
1166i1 := v |_ a - l*a;
1167
1168pform o=1;
1169
1170o := ot*d t + ox*d x + ou*d u + oy*d y;
1171
1172fdomain f=f(psi,t,u,x,y);
1173
1174i11 := v _| d a - l*a + d f;
1175
1176let vx=-@(f,y),vt=-@(f,u),vu=@(f,t)+u*@(f,psi),vy=@(f,x)+y*@(f,psi),
1177    vpsi=f-u*@(f,u)-y*@(f,y);
1178
1179factor ^;
1180
1181i2 := v |_ b - xi*b - o^a + zeta*da;
1182
1183let ou=0,oy=@(f,u,psi),ox=-u*@(f,u,psi),
1184    ot=@(f,x,psi)+u*@(f,y,psi)+y*@(f,psi,psi);
1185
1186i2;
1187
1188let zeta=-@(f,u,x)-@(f,u,y)*u-@(f,u,psi)*y;
1189
1190i2;
1191
1192let xi=-@(f,t,u)-u*@(f,u,psi)+@(f,x,y)+u*@(f,y,y)+y*@(f,y,psi)+@(f,psi);
1193
1194i2;
1195
1196let @(f,u,u)=0;
1197
1198i2;      % These PDE's have to be solved.
1199
1200
1201clear a,da,b,v,i1,i11,o,i2,xi,t;
1202remfdomain f,vpsi,vt,vu,vx,vy;
1203clear @(f,u,u);
1204
1205
1206% Problem:
1207% --------
1208% Calculate the integrability conditions for the system of PDE's:
1209% (c.f. B.F. Schutz, "Geometrical Methods of Mathematical Physics"
1210% Cambridge University Press, 1984, p. 156)
1211
1212
1213% @ z /@ x + a1*z  + b1*z  = c1
1214%    1           1       2
1215
1216% @ z /@ y + a2*z  + b2*z  = c2
1217%    1           1       2
1218
1219% @ z /@ x + f1*z  + g1*z  = h1
1220%    2           1       2
1221
1222% @ z /@ y + f2*z  + g2*z  = h2
1223%    2           1       2      ;
1224
1225
1226pform w(k)=1,integ(k)=4,{z(k),x,y}=0,{a,b,c,f,g,h}=1,
1227      {a1,a2,b1,b2,c1,c2,f1,f2,g1,g2,h1,h2}=0;
1228
1229fdomain  a1=a1(x,y),a2=a2(x,y),b1=b1(x,y),b2=b2(x,y),
1230         c1=c1(x,y),c2=c2(x,y),f1=f1(x,y),f2=f2(x,y),
1231         g1=g1(x,y),g2=g2(x,y),h1=h1(x,y),h2=h2(x,y);
1232
1233
1234a:=a1*d x+a2*d y$
1235b:=b1*d x+b2*d y$
1236c:=c1*d x+c2*d y$
1237f:=f1*d x+f2*d y$
1238g:=g1*d x+g2*d y$
1239h:=h1*d x+h2*d y$
1240
1241% The equivalent exterior system:
1242factor d;
1243w(1) := d z(-1) + z(-1)*a + z(-2)*b - c;
1244w(2) := d z(-2) + z(-1)*f + z(-2)*g - h;
1245indexrange 1,2;
1246factor z;
1247% The integrability conditions:
1248
1249integ(k) := d w(k) ^ w(1) ^ w(2);
1250
1251clear a,b,c,f,g,h,x,y,w(k),integ(k),z(k);
1252remfdomain a1,a2,b1,c1,c2,f1,f2,g1,g2,h1,h2;
1253
1254% Problem:
1255% --------
1256% Calculate the PDE's for the generators of the d-theta symmetries of
1257% the Lagrangian system of the planar Kepler problem.
1258% c.f. W.Sarlet, F.Cantrijn, Siam Review 23, 467, 1981
1259% Verify that time translation is a d-theta symmetry and calculate the
1260% corresponding integral.
1261
1262pform {t,q(k),v(k),lam(k),tau,xi(k),eta(k)}=0,theta=1,f=0,
1263      {l,glq(k),glv(k),glt}=0;
1264
1265tvector gam,y;
1266
1267indexrange 1,2;
1268
1269fdomain tau=tau(t,q(k),v(k)),xi=xi(t,q(k),v(k)),f=f(t,q(k),v(k));
1270
1271l := 1/2*(v(1)**2 + v(2)**2) + m/r$      % The Lagrangian.
1272
1273pform r=0;
1274fdomain r=r(q(k));
1275let @(r,q 1)=q(1)/r,@(r,q 2)=q(2)/r,q(1)**2+q(2)**2=r**2;
1276
1277lam(k) := -m*q(k)/r;                                % The force.
1278
1279gam := @ t + v(k)*@(q(k)) + lam(k)*@(v(k))$
1280
1281eta(k) := gam _| d xi(k) - v(k)*gam _| d tau$
1282
1283y  := tau*@ t + xi(k)*@(q(k)) + eta(k)*@(v(k))$     % Symmetry generator.
1284
1285theta := l*d t + @(l,v(k))*(d q(k) - v(k)*d t)$
1286
1287factor @;
1288
1289s := y |_ theta - d f$
1290
1291glq(k) := @(q k) _| s;
1292glv(k) := @(v k) _| s;
1293glt := @(t) _| s;
1294
1295% Translation in time must generate a symmetry.
1296xi(k) := 0;
1297tau := 1;
1298
1299glq k := glq k;
1300glv k := glv k;
1301glt;
1302
1303% The corresponding integral is of course the energy.
1304integ := - y _| theta;
1305
1306
1307clear l,lam k,gam,eta k,y,theta,s,glq k,glv k,glt,t,q k,v k,tau,xi k;
1308remfdomain r,f,tau,xi;
1309
1310% Problem:
1311% --------
1312% Calculate the "gradient" and "Laplacian" of a function and the "curl"
1313% and "divergence" of a one-form in elliptic coordinates.
1314
1315
1316coframe e u = sqrt(cosh(v)**2 - sin(u)**2)*d u,
1317        e v = sqrt(cosh(v)**2 - sin(u)**2)*d v,
1318        e phi = cos u*sinh v*d phi;
1319
1320pform f=0;
1321
1322fdomain f=f(u,v,phi);
1323
1324factor e,^;
1325on rat,gcd;
1326order cosh v, sin u;
1327% The gradient:
1328d f;
1329
1330factor @;
1331% The Laplacian:
1332# d # d f;
1333
1334% Another way of calculating the Laplacian:
1335-#vardf(1/2*d f^#d f,f);
1336
1337remfac @;
1338
1339% Now calculate the "curl" and the "divergence" of a one-form.
1340
1341pform w=1,a(k)=0;
1342
1343fdomain a=a(u,v,phi);
1344
1345w := a(-k)*e k;
1346% The curl:
1347x := # d w;
1348
1349factor @;
1350% The divergence:
1351y := # d # w;
1352
1353
1354remfac @;
1355clear x,y,w,u,v,phi,e k,a k;
1356remfdomain a,f;
1357
1358
1359% Problem:
1360% --------
1361% Calculate in a spherical coordinate system the Navier Stokes equations.
1362
1363coframe e r=d r, e theta =r*d theta, e phi = r*sin theta *d phi;
1364frame x;
1365
1366fdomain v=v(t,r,theta,phi),p=p(r,theta,phi);
1367
1368pform v(k)=0,p=0,w=1;
1369
1370% We first calculate the convective derivative.
1371
1372w := v(-k)*e(k)$
1373
1374factor e; on rat;
1375
1376cdv := @(w,t) + (v(k)*x(-k)) |_ w - 1/2*d(v(k)*v(-k));
1377
1378%next we calculate the viscous terms;
1379
1380visc := nu*(d#d# w - #d#d w) + mu*d#d# w;
1381
1382% Finally we add the pressure term and print the components of the
1383% whole equation.
1384
1385pform nasteq=1,nast(k)=0;
1386
1387nasteq := cdv - visc + 1/rho*d p$
1388
1389factor @;
1390
1391nast(-k) := x(-k) _| nasteq;
1392
1393remfac @,e;
1394
1395clear v k,x k,nast k,cdv,visc,p,w,nasteq,e k;
1396remfdomain p,v;
1397
1398
1399% Problem:
1400% --------
1401% Calculate from the Lagrangian of a vibrating rod the equation of
1402% motion and show that the invariance under time translation leads
1403% to a conserved current.
1404
1405pform {y,x,t,q,j}=0,lagr=2;
1406
1407fdomain y=y(x,t),q=q(x),j=j(x);
1408
1409factor ^;
1410
1411lagr := 1/2*(rho*q*@(y,t)**2 - e*j*@(y,x,x)**2)*d x^d t;
1412
1413vardf(lagr,y);
1414
1415% The Lagrangian does not explicitly depend on time; therefore the
1416% vector field @ t generates a symmetry. The conserved current is
1417
1418pform c=1;
1419factor d;
1420
1421c := noether(lagr,y,@ t);
1422
1423% The exterior derivative of this must be zero or a multiple of the
1424% equation of motion (weak conservation law) to be a conserved current.
1425
1426remfac d;
1427
1428d c;
1429
1430% i.e. it is a multiple of the equation of motion.
1431
1432clear lagr,c,j,y,q;
1433remfdomain y,q,j;
1434
1435% Problem:
1436% --------
1437% Show that the metric structure given by Eguchi and Hanson induces a
1438% self-dual curvature.
1439% c.f. T. Eguchi, P.B. Gilkey, A.J. Hanson, "Gravitation, Gauge Theories
1440% and Differential Geometry", Physics Reports 66, 213, 1980
1441
1442for all x let cos(x)**2=1-sin(x)**2;
1443
1444pform f=0,g=0;
1445fdomain f=f(r), g=g(r);
1446
1447coframe   o(r) = f*d r,
1448      o(theta) = (r/2)*(sin(psi)*d theta - sin(theta)*cos(psi)*d phi),
1449        o(phi) = (r/2)*(-cos(psi)*d theta - sin(theta)*sin(psi)*d phi),
1450        o(psi) = (r/2)*g*(d psi + cos(theta)*d phi);
1451
1452frame e;
1453
1454
1455pform gamma(a,b)=1,curv2(a,b)=2;
1456index_symmetries gamma(a,b),curv2(a,b): antisymmetric;
1457
1458factor o;
1459
1460gamma(-a,-b) := -(1/2)*( e(-a) _| (e(-c) _| (d o(-b)))
1461		        -e(-b) _| (e(-a) _| (d o(-c)))
1462		        +e(-c) _| (e(-b) _| (d o(-a))) )*o(c)$
1463
1464
1465curv2(-a,b) := d gamma(-a,b) + gamma(-c,b)^gamma(-a,c)$
1466
1467let f=1/g,g=sqrt(1-(a/r)**4);
1468
1469pform chck(k,l)=2;
1470index_symmetries chck(k,l): antisymmetric;
1471
1472% The following has to be zero for a self-dual curvature.
1473
1474chck(k,l) := 1/2*eps(k,l,m,n)*curv2(-m,-n) + curv2(k,l);
1475
1476clear gamma(a,b),curv2(a,b),f,g,chck(a,b),o(k),e(k),r,phi,psi;
1477remfdomain f,g;
1478
1479% Example: 6-dimensional FRW model with quadratic curvature terms in
1480% -------
1481% the Lagrangian (Lanczos and Gauss-Bonnet terms).
1482% cf. Henriques, Nuclear Physics, B277, 621 (1986)
1483
1484for all x let cos(x)**2+sin(x)**2=1;
1485
1486pform {r,s}=0;
1487fdomain r=r(t),s=s(t);
1488
1489coframe o(t) = d t,
1490        o(1) = r*d u/(1 + k*(u**2)/4),
1491        o(2) = r*u*d theta/(1 + k*(u**2)/4),
1492        o(3) = r*u*sin(theta)*d phi/(1 + k*(u**2)/4),
1493        o(4) = s*d v1,
1494        o(5) = s*sin(v1)*d v2
1495 with metric g =-o(t)*o(t)+o(1)*o(1)+o(2)*o(2)+o(3)*o(3)
1496                +o(4)*o(4)+o(5)*o(5);
1497
1498frame e;
1499
1500on nero; factor o,^;
1501
1502riemannconx om;
1503
1504pform curv(k,l)=2,{riemann(a,b,c,d),ricci(a,b),riccisc}=0;
1505
1506index_symmetries curv(k,l): antisymmetric,
1507                 riemann(k,l,m,n): antisymmetric in {k,l},{m,n}
1508                                   symmetric in {{k,l},{m,n}},
1509                 ricci(k,l): symmetric;
1510
1511curv(k,l) := d om(k,l) + om(k,-m)^om(m,l);
1512
1513riemann(a,b,c,d) := e(d) _| (e (c) _| curv(a,b));
1514
1515% The rest is done in the Ricci calculus language,
1516
1517ricci(-a,-b) := riemann(c,-a,-d,-b)*g(-c,d);
1518
1519riccisc := ricci(-a,-b)*g(a,b);
1520
1521pform {laglanc,inv1,inv2} = 0;
1522
1523index_symmetries riemc3(k,l),riemri(k,l),
1524                 hlang(k,l),einst(k,l): symmetric;
1525
1526pform {riemc3(i,j),riemri(i,j)}=0;
1527
1528riemc3(-i,-j) := riemann(-i,-k,-l,-m)*riemann(-j,k,l,m)$
1529inv1 := riemc3(-i,-j)*g(i,j);
1530riemri(-i,-j) := 2*riemann(-i,-k,-j,-l)*ricci(k,l)$
1531inv2 := ricci(-a,-b)*ricci(a,b);
1532laglanc := (1/2)*(inv1 - 4*inv2 + riccisc**2);
1533
1534
1535pform {einst(a,b),hlang(a,b)}=0;
1536
1537hlang(-i,-j) := 2*(riemc3(-i,-j) - riemri(-i,-j) -
1538		   2*ricci(-i,-k)*ricci(-j,K) +
1539		   riccisc*ricci(-i,-j) - (1/2)*laglanc*g(-i,-j));
1540
1541% The complete Einstein tensor:
1542
1543einst(-i,-j) := (ricci(-i,-j) - (1/2)*riccisc*g(-i,-j))*alp1 +
1544		hlang(-i,-j)*alp2$
1545
1546alp1 := 1$
1547factor alp2;
1548
1549einst(-i,-j) := einst(-i,-j);
1550
1551clear o(k),e(k),riemc3(i,j),riemri(i,j),curv(k,l),riemann(a,b,c,d),
1552      ricci(a,b),riccisc,t,u,v1,v2,theta,phi,r,om(k,l),einst(a,b),
1553      hlang(a,b);
1554
1555remfdomain r,s;
1556
1557% Problem:
1558% --------
1559% Calculate for a given coframe and given torsion the Riemannian part and
1560% the torsion induced part of the connection. Calculate the curvature.
1561
1562% For a more elaborate example see E.Schruefer, F.W. Hehl, J.D. McCrea,
1563% "Application of the REDUCE package EXCALC to the Poincare gauge field
1564% theory of gravity", GRG Journal, vol. 19, (1988)  197--218
1565
1566pform {ff, gg}=0;
1567
1568fdomain ff=ff(r), gg=gg(r);
1569
1570coframe o(4) = d u + 2*b0*cos(theta)*d phi,
1571        o(1) = ff*(d u + 2*b0*cos(theta)*d phi) + d r,
1572        o(2) = gg*d theta,
1573        o(3) = gg*sin(theta)*d phi
1574 with metric g = -o(4)*o(1)-o(4)*o(1)+o(2)*o(2)+o(3)*o(3);
1575
1576frame e;
1577
1578pform {tor(a),gwt(a)}=2,gamma(a,b)=1,
1579      {u1,u3,u5}=0;
1580
1581index_symmetries gamma(a,b): antisymmetric;
1582
1583fdomain u1=u1(r),u3=u3(r),u5=u5(r);
1584
1585tor(4) := 0$
1586
1587tor(1) := -u5*o(4)^o(1) - 2*u3*o(2)^o(3)$
1588
1589tor(2) := u1*o(4)^o(2) + u3*o(4)^o(3)$
1590
1591tor(3) := u1*o(4)^o(3) - u3*o(4)^o(2)$
1592
1593gwt(-a) := d o(-a) - tor(-a)$
1594
1595% The following is the combined connection.
1596% The Riemannian part could have equally well been calculated by the
1597% RIEMANNCONX statement.
1598
1599gamma(-a,-b) := (1/2)*( e(-b) _| (e(-c) _| gwt(-a))
1600	               +e(-c) _| (e(-a) _| gwt(-b))
1601                       -e(-a) _| (e(-b) _| gwt(-c)) )*o(c);
1602
1603pform curv(a,b)=2;
1604index_symmetries curv(a,b): antisymmetric;
1605factor ^;
1606
1607curv(-a,b) := d gamma(-a,b) + gamma(-c,b)^gamma(-a,c);
1608
1609clear o(k),e(k),curv(a,b),gamma(a,b),theta,phi,x,y,z,r,s,t,u,v,p,q,c,cs;
1610remfdomain u1,u3,u5,ff,gg;
1611
1612showtime;
1613end;
1614
1615\end{verbatim}
1616}
1617\end{document}
1618