Forgot to load lapack in a few examples
[maxima.git] / doc / info / Ctensor.texi
blob60f3f6b05295fa34b8657a7d24f4370690ac605c
1 @menu
2 * Introduction to ctensor::
3 * Functions and Variables for ctensor::
4 @end menu
6 @node Introduction to ctensor, Functions and Variables for ctensor, Package ctensor, Package ctensor
7 @section Introduction to ctensor
9 @code{ctensor} is a component tensor manipulation package.  To use the @code{ctensor}
10 package, type @code{load("ctensor")}.
11 To begin an interactive session with @code{ctensor}, type @code{csetup()}.  You are
12 first asked to specify the dimension of the manifold. If the dimension
13 is 2, 3 or 4 then the list of coordinates defaults to @code{[x,y]}, @code{[x,y,z]}
14 or @code{[x,y,z,t]} respectively.
15 These names may be changed by assigning a new list of coordinates to
16 the variable @code{ct_coords} (described below) and the user is queried about
17 this. Care must be taken to avoid the coordinate names conflicting
18 with other object definitions.
20 Next, the user enters the metric either directly or from a file by
21 specifying its ordinal position.
22 @c NO SUCH FILE !
23 @c As an example of a file of common metrics, see @code{share/tensor/metrics.mac}.
24 The metric is stored in the matrix
25 @code{lg}. Finally, the metric inverse is computed and stored in the matrix
26 @code{ug}. One has the option of carrying out all calculations in a power
27 series.
29 A sample protocol is begun below for the static, spherically symmetric
30 metric (standard coordinates) which will be applied to the problem of
31 deriving Einstein's vacuum equations (which lead to the Schwarzschild
32 solution) as an example. Many of the functions in @code{ctensor} will be
33 displayed for the standard metric as examples.
35 @example
36 (%i1) load("ctensor");
37 (%o1)      /share/tensor/ctensor.mac
38 (%i2) csetup();
39 Enter the dimension of the coordinate system:
41 Do you wish to change the coordinate names?
43 Do you want to
44 1. Enter a new metric?
46 2. Enter a metric from a file?
48 3. Approximate a metric with a Taylor series?
51 Is the matrix  1. Diagonal  2. Symmetric  3. Antisymmetric  4. General
52 Answer 1, 2, 3 or 4
54 Row 1 Column 1:
56 Row 2 Column 2:
57 x^2;
58 Row 3 Column 3:
59 x^2*sin(y)^2;
60 Row 4 Column 4:
61 -d;
63 Matrix entered.
64 Enter functional dependencies with the DEPENDS function or 'N' if none
65 depends([a,d],x);
66 Do you wish to see the metric?
68                           [ a  0       0        0  ]
69                           [                        ]
70                           [     2                  ]
71                           [ 0  x       0        0  ]
72                           [                        ]
73                           [         2    2         ]
74                           [ 0  0   x  sin (y)   0  ]
75                           [                        ]
76                           [ 0  0       0       - d ]
77 (%o2)                                done
78 (%i3) christof(mcs);
79                                             a
80                                              x
81 (%t3)                          mcs        = ---
82                                   1, 1, 1   2 a
84                                              1
85 (%t4)                           mcs        = -
86                                    1, 2, 2   x
88                                              1
89 (%t5)                           mcs        = -
90                                    1, 3, 3   x
92                                             d
93                                              x
94 (%t6)                          mcs        = ---
95                                   1, 4, 4   2 d
97                                               x
98 (%t7)                          mcs        = - -
99                                   2, 2, 1     a
101                                            cos(y)
102 (%t8)                         mcs        = ------
103                                  2, 3, 3   sin(y)
105                                                2
106                                           x sin (y)
107 (%t9)                      mcs        = - ---------
108                               3, 3, 1         a
110 (%t10)                   mcs        = - cos(y) sin(y)
111                             3, 3, 2
113                                             d
114                                              x
115 (%t11)                         mcs        = ---
116                                   4, 4, 1   2 a
117 (%o11)                               done
119 @end example
121 @opencatbox{Categories:}
122 @category{Tensors}
123 @category{Share packages}
124 @category{Package ctensor}
125 @closecatbox
127 @c end concepts ctensor
128 @node Functions and Variables for ctensor,  , Introduction to ctensor, Package ctensor
130 @section Functions and Variables for ctensor
132 @subsection Initialization and setup
133 @anchor{csetup}
134 @deffn {Function} csetup ()
135 A function in the @code{ctensor} (component tensor) package
136 which initializes the package and allows the user to enter a metric
137 interactively. See @code{ctensor} for more details.
139 @opencatbox{Categories:}
140 @category{Package ctensor}
141 @closecatbox
142 @end deffn
143 @anchor{cmetric}
144 @deffn {Function} cmetric @
145 @fname{cmetric} (@var{dis}) @
146 @fname{cmetric} ()
148 A function in the @code{ctensor} (component tensor) package
149 that computes the metric inverse and sets up the package for
150 further calculations.
152 If @code{cframe_flag} is @code{false}, the function computes the inverse metric
153 @code{ug} from the (user-defined) matrix @code{lg}. The metric determinant is
154 also computed and stored in the variable @code{gdet}. Furthermore, the
155 package determines if the metric is diagonal and sets the value
156 of @code{diagmetric} accordingly. If the optional argument @var{dis}
157 is present and not equal to @code{false}, the user is prompted to see
158 the metric inverse.
160 If @code{cframe_flag} is @code{true}, the function expects that the values of
161 @code{fri} (the inverse frame matrix) and @code{lfg} (the frame metric) are
162 defined. From these, the frame matrix @code{fr} and the inverse frame
163 metric @code{ufg} are computed.
165 @opencatbox{Categories:}
166 @category{Package ctensor}
167 @closecatbox
168 @end deffn
169 @anchor{ct}
170 @deffn {Function} ct_coordsys @
171 @fname{ct_coordsys} (@var{coordinate_system}, @var{extra_arg}) @
172 @fname{ct_coordsys} (@var{coordinate_system})
174 Sets up a predefined coordinate system and metric. The argument
175 @var{coordinate_system} can be one of the following symbols:
177 @example
179  SYMBOL             Dim Coordinates     Description/comments
180  ------------------------------------------------------------------
181  cartesian2d           2  [x,y]             Cartesian 2D coordinate
182                                             system
183  polar                 2  [r,phi]           Polar coordinate system
184  elliptic              2  [u,v]             Elliptic coord. system
185  confocalelliptic      2  [u,v]             Confocal elliptic
186                                             coordinates
187  bipolar               2  [u,v]             Bipolar coord. system
188  parabolic             2  [u,v]             Parabolic coord. system
189  cartesian3d           3  [x,y,z]           Cartesian 3D coordinate
190                                             system
191  polarcylindrical      3  [r,theta,z]       Polar 2D with
192                                             cylindrical z
193  ellipticcylindrical   3  [u,v,z]           Elliptic 2D with
194                                             cylindrical z
195  confocalellipsoidal   3  [u,v,w]           Confocal ellipsoidal
196  bipolarcylindrical    3  [u,v,z]           Bipolar 2D with
197                                             cylindrical z
198  paraboliccylindrical  3  [u,v,z]           Parabolic 2D with
199                                             cylindrical z
200  paraboloidal          3  [u,v,phi]         Paraboloidal coords.
201  conical               3  [u,v,w]           Conical coordinates
202  toroidal              3  [phi,u,v]         Toroidal coordinates
203  spherical             3  [r,theta,phi]     Spherical coord. system
204  oblatespheroidal      3  [u,v,phi]         Oblate spheroidal
205                                             coordinates
206  oblatespheroidalsqrt  3  [u,v,phi]
207  prolatespheroidal     3  [u,v,phi]         Prolate spheroidal
208                                             coordinates
209  prolatespheroidalsqrt 3  [u,v,phi]
210  ellipsoidal           3  [r,theta,phi]     Ellipsoidal coordinates
211  cartesian4d           4  [x,y,z,t]         Cartesian 4D coordinate
212                                             system
213  spherical4d           4  [r,theta,eta,phi] Spherical 4D coordinate
214                                             system
215  exteriorschwarzschild 4  [t,r,theta,phi]   Schwarzschild metric
216  interiorschwarzschild 4  [t,z,u,v]         Interior Schwarzschild
217                                             metric
218  kerr_newman           4  [t,r,theta,phi]   Charged axially
219                                             symmetric metric
220 @end example
222 @code{coordinate_system} can also be a list of transformation functions,
223 followed by a list containing the coordinate variables. For instance,
224 you can specify a spherical metric as follows:
226 @c ===beg===
227 @c load("ctensor");
228 @c ct_coordsys([r*cos(theta)*cos(phi),r*cos(theta)*sin(phi),
229 @c             r*sin(theta),[r,theta,phi]]);
230 @c lg:trigsimp(lg);
231 @c ct_coords;
232 @c dim;
233 @c ===end===
234 @example
236 (%i1) load("ctensor");
237 (%o1)       /share/tensor/ctensor.mac
238 (%i2) ct_coordsys([r*cos(theta)*cos(phi),r*cos(theta)*sin(phi),
239       r*sin(theta),[r,theta,phi]]);
240 (%o2)                                done
241 (%i3) lg:trigsimp(lg);
242                            [ 1  0         0        ]
243                            [                       ]
244                            [     2                 ]
245 (%o3)                      [ 0  r         0        ]
246                            [                       ]
247                            [         2    2        ]
248                            [ 0  0   r  cos (theta) ]
249 (%i4) ct_coords;
250 (%o4)                           [r, theta, phi]
251 (%i5) dim;
252 (%o5)                                  3
254 @end example
256 Transformation functions can also be used when @code{cframe_flag} is @code{true}:
258 @c ===beg===
259 @c load("ctensor");
260 @c cframe_flag:true;
261 @c ct_coordsys([r*cos(theta)*cos(phi),r*cos(theta)*sin(phi),
262 @c             r*sin(theta),[r,theta,phi]]);
263 @c fri;
264 @c cmetric();
265 @c lg:trigsimp(lg);
266 @c ===end===
267 @example
269 (%i1) load("ctensor");
270 (%o1)       /share/tensor/ctensor.mac
271 (%i2) cframe_flag:true;
272 (%o2)                                true
273 (%i3) ct_coordsys([r*cos(theta)*cos(phi),r*cos(theta)*sin(phi),
274       r*sin(theta),[r,theta,phi]]);
275 (%o3)                                done
276 (%i4) fri;
277 (%o4)
278  [cos(phi)cos(theta) -cos(phi) r sin(theta) -sin(phi) r cos(theta)]
279  [                                                                ]
280  [sin(phi)cos(theta) -sin(phi) r sin(theta)  cos(phi) r cos(theta)]
281  [                                                                ]
282  [    sin(theta)           r cos(theta)                0          ]
284 (%i5) cmetric();
285 (%o5)                                false
286 (%i6) lg:trigsimp(lg);
287                            [ 1  0         0        ]
288                            [                       ]
289                            [     2                 ]
290 (%o6)                      [ 0  r         0        ]
291                            [                       ]
292                            [         2    2        ]
293                            [ 0  0   r  cos (theta) ]
295 @end example
297 The optional argument @var{extra_arg} can be any one of the following:
298 @c LOOKING AT share/tensor/ctensor.mac CIRCA LINE 837, misner IS RECOGNIZED ALSO; WHAT EFFECT DOES IT HAVE ??
300 @code{cylindrical} tells @code{ct_coordsys} to attach an additional cylindrical coordinate.
302 @code{minkowski} tells @code{ct_coordsys} to attach an additional coordinate with negative metric signature.
304 @code{all} tells @code{ct_coordsys} to call @code{cmetric} and @code{christof(false)} after setting up the metric.
306 @c GLOBAL VARIABLE verbose IS USED IN ctensor.mac IN JUST THIS ONE CONTEXT
307 If the global variable @code{verbose} is set to @code{true}, @code{ct_coordsys} displays the values of @code{dim}, @code{ct_coords}, and either @code{lg} or @code{lfg} and @code{fri}, depending on the value of @code{cframe_flag}.
309 @opencatbox{Categories:}
310 @category{Package ctensor}
311 @closecatbox
312 @end deffn
313 @anchor{init}
314 @deffn {Function} init_ctensor ()
315 Initializes the @code{ctensor} package.
317 The @code{init_ctensor} function reinitializes the @code{ctensor} package. It removes all arrays and matrices used by @code{ctensor}, resets all flags, resets @code{dim} to 4, and resets the frame metric to the Lorentz-frame.
319 @opencatbox{Categories:}
320 @category{Package ctensor}
321 @closecatbox
322 @end deffn
325 @subsection The tensors of curved space
327 The main purpose of the @code{ctensor} package is to compute the tensors
328 of curved space(time), most notably the tensors used in general
329 relativity.
331 When a metric base is used, @code{ctensor} can compute the following tensors:
333 @example
335  lg  -- ug
336    \      \
337     lcs -- mcs -- ric -- uric
338               \      \       \
339                \      tracer - ein -- lein
340                 \
341                  riem -- lriem -- weyl
342                      \
343                       uriem
346 @end example
348 @code{ctensor} can also work using moving frames. When @code{cframe_flag} is
349 set to @code{true}, the following tensors can be calculated:
351 @example
353  lfg -- ufg
354      \
355  fri -- fr -- lcs -- mcs -- lriem -- ric -- uric
356       \                       |  \      \       \
357        lg -- ug               |   weyl   tracer - ein -- lein
358                               |\
359                               | riem
360                               |
361                               \uriem
363 @end example
364 @anchor{christof}
365 @deffn {Function} christof (@var{dis})
366 A function in the @code{ctensor} (component tensor)
367 package.  It computes the Christoffel symbols of both
368 kinds.  The argument @var{dis} determines which results are to be immediately
369 displayed.  The Christoffel symbols of the first and second kinds are
370 stored in the arrays @code{lcs[i,j,k]} and @code{mcs[i,j,k]} respectively and
371 defined to be symmetric in the first two indices. If the argument to
372 @code{christof} is @code{lcs} or @code{mcs} then the unique non-zero values of @code{lcs[i,j,k]}
373 or @code{mcs[i,j,k]}, respectively, will be displayed. If the argument is @code{all}
374 then the unique non-zero values of @code{lcs[i,j,k]} and @code{mcs[i,j,k]} will be
375 displayed.  If the argument is @code{false} then the display of the elements
376 will not occur. The array elements @code{mcs[i,j,k]} are defined in such a
377 manner that the final index is contravariant.
379 @opencatbox{Categories:}
380 @category{Package ctensor}
381 @closecatbox
382 @end deffn
383 @anchor{ricci}
384 @deffn {Function} ricci (@var{dis})
385 A function in the @code{ctensor} (component tensor)
386 package. @code{ricci} computes the covariant (symmetric)
387 components @code{ric[i,j]} of the Ricci tensor.  If the argument @var{dis} is @code{true},
388 then the non-zero components are displayed.
390 @opencatbox{Categories:}
391 @category{Package ctensor}
392 @closecatbox
393 @end deffn
394 @anchor{uricci}
395 @deffn {Function} uricci (@var{dis})
396 This function first computes the
397 covariant components @code{ric[i,j]} of the Ricci tensor.
398 Then the mixed Ricci tensor is computed using the
399 contravariant metric tensor.  If the value of the argument @var{dis}
400 is @code{true}, then these mixed components, @code{uric[i,j]} (the
401 index @code{i} is covariant and the index @code{j} is contravariant), will be displayed
402 directly.  Otherwise, @code{ricci(false)} will simply compute the entries
403 of the array @code{uric[i,j]} without displaying the results.
405 @opencatbox{Categories:}
406 @category{Package ctensor}
407 @closecatbox
408 @end deffn
409 @anchor{scurvature}
410 @deffn {Function} scurvature ()
411 Returns the scalar curvature (obtained by contracting
412 the Ricci tensor) of the Riemannian manifold with the given metric.
414 @opencatbox{Categories:}
415 @category{Package ctensor}
416 @closecatbox
417 @end deffn
418 @anchor{einstein}
419 @deffn {Function} einstein (@var{dis})
420 A function in the @code{ctensor} (component tensor)
421 package.  @code{einstein} computes the mixed Einstein tensor
422 after the Christoffel symbols and Ricci tensor have been obtained
423 (with the functions @code{christof} and @code{ricci}).  If the argument @var{dis} is
424 @code{true}, then the non-zero values of the mixed Einstein tensor @code{ein[i,j]}
425 will be displayed where @code{j} is the contravariant index.
426 The variable @code{rateinstein} will cause the rational simplification on
427 these components. If @code{ratfac} is @code{true} then the components will
428 also be factored.
430 @opencatbox{Categories:}
431 @category{Package ctensor}
432 @closecatbox
433 @end deffn
434 @anchor{leinstein}
435 @deffn {Function} leinstein (@var{dis})
436 Covariant Einstein-tensor. @code{leinstein} stores the values of the covariant Einstein tensor in the array @code{lein}. The covariant Einstein-tensor is computed from the mixed Einstein tensor @code{ein} by multiplying it with the metric tensor. If the argument @var{dis} is @code{true}, then the non-zero values of the covariant Einstein tensor are displayed.
438 @opencatbox{Categories:}
439 @category{Package ctensor}
440 @closecatbox
441 @end deffn
442 @anchor{riemann}
443 @deffn {Function} riemann (@var{dis})
444 A function in the @code{ctensor} (component tensor)
445 package.  @code{riemann} computes the Riemann curvature tensor
446 from the given metric and the corresponding Christoffel symbols. The following
447 index conventions are used:
449 @example
450                 l      _l       _l       _l   _m    _l   _m
451  R[i,j,k,l] =  R    = |      - |      + |    |   - |    |
452                 ijk     ij,k     ik,j     mk   ij    mj   ik
453 @end example
455 This notation is consistent with the notation used by the @code{itensor}
456 package and its @code{icurvature} function.
457 If the optional argument @var{dis} is @code{true},
458 the unique non-zero components @code{riem[i,j,k,l]} will be displayed.
459 As with the Einstein tensor, various switches set by the user
460 control the simplification of the components of the Riemann tensor.
461 If @code{ratriemann} is @code{true}, then
462 rational simplification will be done. If @code{ratfac}
463 is @code{true} then
464 each of the components will also be factored.
466 If the variable @code{cframe_flag} is @code{false}, the Riemann tensor is
467 computed directly from the Christoffel-symbols. If @code{cframe_flag} is
468 @code{true}, the covariant Riemann-tensor is computed first from the
469 frame field coefficients.
471 @opencatbox{Categories:}
472 @category{Package ctensor}
473 @closecatbox
474 @end deffn
475 @anchor{lriemann}
476 @deffn {Function} lriemann (@var{dis})
477 Covariant Riemann-tensor (@code{lriem[]}).
479 Computes the covariant Riemann-tensor as the array @code{lriem}. If the
480 argument @var{dis} is @code{true}, unique non-zero values are displayed.
482 If the variable @code{cframe_flag} is @code{true}, the covariant Riemann
483 tensor is computed directly from the frame field coefficients. Otherwise,
484 the (3,1) Riemann tensor is computed first.
486 For information on index ordering, see @code{riemann}.
488 @opencatbox{Categories:}
489 @category{Package ctensor}
490 @closecatbox
491 @end deffn
492 @anchor{uriemann}
493 @deffn {Function} uriemann (@var{dis})
494 Computes the contravariant components of the Riemann
495 curvature tensor as array elements @code{uriem[i,j,k,l]}.  These are displayed
496 if @var{dis} is @code{true}.
498 @opencatbox{Categories:}
499 @category{Package ctensor}
500 @closecatbox
501 @end deffn
502 @anchor{rinvariant}
503 @deffn {Function} rinvariant ()
504 Forms the Kretschmann-invariant (@code{kinvariant}) obtained by
505 contracting the tensors
507 @example
508 lriem[i,j,k,l]*uriem[i,j,k,l].
509 @end example
511 This object is not automatically simplified since it can be very large.
513 @opencatbox{Categories:}
514 @category{Package ctensor}
515 @closecatbox
516 @end deffn
517 @anchor{weyl}
518 @deffn {Function} weyl (@var{dis})
519 Computes the Weyl conformal tensor.  If the argument @var{dis} is
520 @code{true}, the non-zero components @code{weyl[i,j,k,l]} will be displayed to the
521 user.  Otherwise, these components will simply be computed and stored.
522 If the switch @code{ratweyl} is set to @code{true}, then the components will be
523 rationally simplified; if @code{ratfac} is @code{true} then the results will be
524 factored as well.
526 @opencatbox{Categories:}
527 @category{Package ctensor}
528 @closecatbox
529 @end deffn
531 @subsection Taylor series expansion
533 The @code{ctensor} package has the ability to truncate results by assuming
534 that they are Taylor-series approximations. This behavior is controlled by
535 the @code{ctayswitch} variable; when set to true, @code{ctensor} makes use
536 internally of the function @code{ctaylor} when simplifying results.
538 The @code{ctaylor} function is invoked by the following @code{ctensor} functions:
540 @example
542     Function     Comments
543     ---------------------------------
544     christof()   For mcs only
545     ricci()
546     uricci()
547     einstein()
548     riemann()
549     weyl()
550     checkdiv()
551 @end example
552 @anchor{ctaylor}
553 @deffn {Function} ctaylor ()
555 The @code{ctaylor} function truncates its argument by converting
556 it to a Taylor-series using @code{taylor}, and then calling
557 @code{ratdisrep}. This has the combined effect of dropping terms
558 higher order in the expansion variable @code{ctayvar}. The order
559 of terms that should be dropped is defined by @code{ctaypov}; the
560 point around which the series expansion is carried out is specified
561 in @code{ctaypt}.
563 As an example, consider a simple metric that is a perturbation of
564 the Minkowski metric. Without further restrictions, even a diagonal
565 metric produces expressions for the Einstein tensor that are far too
566 complex:
568 @example
570 (%i1) load("ctensor");
571 (%o1)       /share/tensor/ctensor.mac
572 (%i2) ratfac:true;
573 (%o2)                                true
574 (%i3) derivabbrev:true;
575 (%o3)                                true
576 (%i4) ct_coords:[t,r,theta,phi];
577 (%o4)                         [t, r, theta, phi]
578 (%i5) lg:matrix([-1,0,0,0],[0,1,0,0],[0,0,r^2,0],
579                 [0,0,0,r^2*sin(theta)^2]);
580                         [ - 1  0  0         0        ]
581                         [                            ]
582                         [  0   1  0         0        ]
583                         [                            ]
584 (%o5)                   [          2                 ]
585                         [  0   0  r         0        ]
586                         [                            ]
587                         [              2    2        ]
588                         [  0   0  0   r  sin (theta) ]
589 (%i6) h:matrix([h11,0,0,0],[0,h22,0,0],[0,0,h33,0],[0,0,0,h44]);
590                             [ h11   0    0    0  ]
591                             [                    ]
592                             [  0   h22   0    0  ]
593 (%o6)                       [                    ]
594                             [  0    0   h33   0  ]
595                             [                    ]
596                             [  0    0    0   h44 ]
597 (%i7) depends(l,r);
598 (%o7)                               [l(r)]
599 (%i8) lg:lg+l*h;
600       [ h11 l - 1      0          0                 0            ]
601       [                                                          ]
602       [     0      h22 l + 1      0                 0            ]
603       [                                                          ]
604 (%o8) [                        2                                 ]
605       [     0          0      r  + h33 l            0            ]
606       [                                                          ]
607       [                                    2    2                ]
608       [     0          0          0       r  sin (theta) + h44 l ]
609 (%i9) cmetric(false);
610 (%o9)                                done
611 (%i10) einstein(false);
612 (%o10)                               done
613 (%i11) ntermst(ein);
614 [[1, 1], 62]
615 [[1, 2], 0]
616 [[1, 3], 0]
617 [[1, 4], 0]
618 [[2, 1], 0]
619 [[2, 2], 24]
620 [[2, 3], 0]
621 [[2, 4], 0]
622 [[3, 1], 0]
623 [[3, 2], 0]
624 [[3, 3], 46]
625 [[3, 4], 0]
626 [[4, 1], 0]
627 [[4, 2], 0]
628 [[4, 3], 0]
629 [[4, 4], 46]
630 (%o12)                               done
632 @end example
634 However, if we recompute this example as an approximation that is
635 linear in the variable @code{l}, we get much simpler expressions:
637 @example
639 (%i14) ctayswitch:true;
640 (%o14)                               true
641 (%i15) ctayvar:l;
642 (%o15)                                 l
643 (%i16) ctaypov:1;
644 (%o16)                                 1
645 (%i17) ctaypt:0;
646 (%o17)                                 0
647 (%i18) christof(false);
648 (%o18)                               done
649 (%i19) ricci(false);
650 (%o19)                               done
651 (%i20) einstein(false);
652 (%o20)                               done
653 (%i21) ntermst(ein);
654 [[1, 1], 6]
655 [[1, 2], 0]
656 [[1, 3], 0]
657 [[1, 4], 0]
658 [[2, 1], 0]
659 [[2, 2], 13]
660 [[2, 3], 2]
661 [[2, 4], 0]
662 [[3, 1], 0]
663 [[3, 2], 2]
664 [[3, 3], 9]
665 [[3, 4], 0]
666 [[4, 1], 0]
667 [[4, 2], 0]
668 [[4, 3], 0]
669 [[4, 4], 9]
670 (%o21)                               done
671 (%i22) ratsimp(ein[1,1]);
672                          2      2  4               2     2
673 (%o22) - (((h11 h22 - h11 ) (l )  r  - 2 h33 l    r ) sin (theta)
674                               r               r r
676                             2               2      4    2
677               - 2 h44 l    r  - h33 h44 (l ) )/(4 r  sin (theta))
678                        r r                r
682 @end example
684 This capability can be useful, for instance, when working in the weak
685 field limit far from a gravitational source.
687 @opencatbox{Categories:}
688 @category{Package ctensor}
689 @closecatbox
690 @end deffn
693 @subsection Frame fields
695 When the variable @code{cframe_flag} is set to true, the @code{ctensor} package
696 performs its calculations using a moving frame.
697 @anchor{frame}
698 @deffn {Function} frame_bracket (@var{fr}, @var{fri}, @var{diagframe})
699 The frame bracket (@code{fb[]}).
701 Computes the frame bracket according to the following definition:
703 @example
704    c          c         c        d     e
705 ifb   = ( ifri    - ifri    ) ifr   ifr
706    ab         d,e       e,d      a     b
707 @end example
709 @opencatbox{Categories:}
710 @category{Package ctensor}
711 @closecatbox
712 @end deffn
714 @subsection Algebraic classification
716 A new feature (as of November, 2004) of @code{ctensor} is its ability to
717 compute the Petrov classification of a 4-dimensional spacetime metric.
718 For a demonstration of this capability, see the file
719 @code{share/tensor/petrov.dem}.
720 @anchor{nptetrad}
721 @deffn {Function} nptetrad ()
722 Computes a Newman-Penrose null tetrad (@code{np}) and its raised-index
723 counterpart (@code{npi}). See @code{petrov} for an example.
725 The null tetrad is constructed on the assumption that a four-dimensional
726 orthonormal frame metric with metric signature (-,+,+,+) is being used.
727 The components of the null tetrad are related to the inverse frame matrix
728 as follows:
730 @example
732 np  = (fri  + fri ) / sqrt(2)
733   1       1      2
735 np  = (fri  - fri ) / sqrt(2)
736   2       1      2
738 np  = (fri  + %i fri ) / sqrt(2)
739   3       3         4
741 np  = (fri  - %i fri ) / sqrt(2)
742   4       3         4
744 @end example
746 @opencatbox{Categories:}
747 @category{Package ctensor}
748 @closecatbox
749 @end deffn
750 @anchor{psi}
751 @deffn {Function} psi (@var{dis})
752 Computes the five Newman-Penrose coefficients @code{psi[0]}...@code{psi[4]}.
753 If @code{dis} is set to @code{true}, the coefficients are displayed.
754 See @code{petrov} for an example.
756 These coefficients are computed from the Weyl-tensor in a coordinate base.
757 If a frame base is used, the Weyl-tensor is first converted to a coordinate
758 base, which can be a computationally expensive procedure. For this reason,
759 in some cases it may be more advantageous to use a coordinate base in the
760 first place before the Weyl tensor is computed. Note however, that
761 constructing a Newman-Penrose null tetrad requires a frame base. Therefore,
762 a meaningful computation sequence may begin with a frame base, which
763 is then used to compute @code{lg} (computed automatically by @code{cmetric})
764 and then @code{ug}. See @code{petrov} for an example. At this point, you can switch back to a coordinate base
765 by setting @code{cframe_flag} to false before beginning to compute the
766 Christoffel symbols. Changing to a frame base at a later stage could yield
767 inconsistent results, as you may end up with a mixed bag of tensors, some
768 computed in a frame base, some in a coordinate base, with no means to
769 distinguish between the two.
771 @opencatbox{Categories:}
772 @category{Package ctensor}
773 @closecatbox
774 @end deffn
775 @anchor{petrov}
776 @deffn {Function} petrov ()
777 Computes the Petrov classification of the metric characterized by @code{psi[0]}...@code{psi[4]}.
779 For example, the following demonstrates how to obtain the Petrov-classification
780 of the Kerr metric:
782 @example
783 (%i1) load("ctensor");
784 (%o1)       /share/tensor/ctensor.mac
785 (%i2) (cframe_flag:true,gcd:spmod,ctrgsimp:true,ratfac:true);
786 (%o2)                                true
787 (%i3) ct_coordsys(exteriorschwarzschild,all);
788 (%o3)                                done
789 (%i4) ug:invert(lg)$
790 (%i5) weyl(false);
791 (%o5)                                done
792 (%i6) nptetrad(true);
793 (%t6) np =
795 [ sqrt(r - 2 m)           sqrt(r)                                 ]
796 [---------------   ---------------------    0            0        ]
797 [sqrt(2) sqrt(r)   sqrt(2) sqrt(r - 2 m)                          ]
798 [                                                                 ]
799 [ sqrt(r - 2 m)            sqrt(r)                                ]
800 [---------------  - ---------------------   0            0        ]
801 [sqrt(2) sqrt(r)    sqrt(2) sqrt(r - 2 m)                         ]
802 [                                                                 ]
803 [                                          r      %i r sin(theta) ]
804 [       0                    0          -------   --------------- ]
805 [                                       sqrt(2)       sqrt(2)     ]
806 [                                                                 ]
807 [                                          r       %i r sin(theta)]
808 [       0                    0          -------  - ---------------]
809 [                                       sqrt(2)        sqrt(2)    ]
811                              sqrt(r)         sqrt(r - 2 m)
812 (%t7) npi = matrix([- ---------------------,---------------, 0, 0],
813                       sqrt(2) sqrt(r - 2 m) sqrt(2) sqrt(r)
815           sqrt(r)            sqrt(r - 2 m)
816 [- ---------------------, - ---------------, 0, 0],
817    sqrt(2) sqrt(r - 2 m)    sqrt(2) sqrt(r)
819            1               %i
820 [0, 0, ---------, --------------------],
821        sqrt(2) r  sqrt(2) r sin(theta)
823            1                 %i
824 [0, 0, ---------, - --------------------])
825        sqrt(2) r    sqrt(2) r sin(theta)
827 (%o7)                                done
828 (%i7) psi(true);
829 (%t8)                              psi  = 0
830                                       0
832 (%t9)                              psi  = 0
833                                       1
835                                           m
836 (%t10)                             psi  = --
837                                       2    3
838                                           r
840 (%t11)                             psi  = 0
841                                       3
843 (%t12)                             psi  = 0
844                                       4
845 (%o12)                               done
846 (%i12) petrov();
847 (%o12)                                 D
849 @end example
851 The Petrov classification function is based on the algorithm published in
852 "Classifying geometries in general relativity: III Classification in practice"
853 by Pollney, Skea, and d'Inverno, Class. Quant. Grav. 17 2885-2902 (2000).
854 Except for some simple test cases, the implementation is untested as of
855 December 19, 2004, and is likely to contain errors.
857 @opencatbox{Categories:}
858 @category{Package ctensor}
859 @closecatbox
860 @end deffn
863 @subsection Torsion and nonmetricity
865 @code{ctensor} has the ability to compute and include torsion and nonmetricity
866 coefficients in the connection coefficients.
868 The torsion coefficients are calculated from a user-supplied tensor
869 @code{tr}, which should be a rank (2,1) tensor. From this, the torsion
870 coefficients @code{kt} are computed according to the following formulae:
872 @example
874               m          m      m
875        - g  tr   - g   tr   - tr   g
876           im  kj    jm   ki     ij  km
877 kt   = -------------------------------
878   ijk                 2
881   k     km
882 kt   = g   kt
883   ij         ijm
885 @end example
887 Note that only the mixed-index tensor is calculated and stored in the
888 array @code{kt}.
890 The nonmetricity coefficients are calculated from the user-supplied
891 nonmetricity vector @code{nm}. From this, the nonmetricity coefficients
892 @code{nmc} are computed as follows:
894 @example
896              k    k        km
897        -nm  D  - D  nm  + g   nm  g
898    k      i  j    i   j         m  ij
899 nmc  = ------------------------------
900    ij                2
902 @end example
904 where D stands for the Kronecker-delta.
906 When @code{ctorsion_flag} is set to @code{true}, the values of @code{kt}
907 are subtracted from the mixed-indexed connection coefficients computed by
908 @code{christof} and stored in @code{mcs}. Similarly, if @code{cnonmet_flag}
909 is set to @code{true}, the values of @code{nmc} are subtracted from the
910 mixed-indexed connection coefficients.
912 If necessary, @code{christof} calls the functions @code{contortion} and
913 @code{nonmetricity} in order to compute @code{kt} and @code{nm}.
914 @anchor{contortion}
915 @deffn {Function} contortion (@var{tr})
917 Computes the (2,1) contortion coefficients from the torsion tensor @var{tr}.
919 @opencatbox{Categories:}
920 @category{Package ctensor}
921 @closecatbox
922 @end deffn
923 @anchor{nonmetricity}
924 @deffn {Function} nonmetricity (@var{nm})
926 Computes the (2,1) nonmetricity coefficients from the nonmetricity
927 vector @var{nm}.
929 @opencatbox{Categories:}
930 @category{Package ctensor}
931 @closecatbox
932 @end deffn
936 @subsection Miscellaneous features
937 @anchor{ctransform}
938 @deffn {Function} ctransform (@var{M})
939 A function in the @code{ctensor} (component tensor)
940 package which will perform a coordinate transformation
941 upon an arbitrary square symmetric matrix @var{M}. The user must input the
942 functions which define the transformation.  (Formerly called @code{transform}.)
943 These may also be supplied in the form of a list as an optional second argument.
945 @opencatbox{Categories:}
946 @category{Package ctensor}
947 @closecatbox
948 @end deffn
949 @anchor{findde}
950 @deffn {Function} findde (@var{A}, @var{n})
952 returns a list of the unique differential equations (expressions)
953 corresponding to the elements of the @var{n} dimensional square
954 array @var{A}. Presently, @var{n} may be 2 or 3. @code{deindex} is a global list
955 containing the indices of @var{A} corresponding to these unique
956 differential equations. For the Einstein tensor (@code{ein}), which
957 is a two dimensional array, if computed for the metric in the example
958 below, @code{findde} gives the following independent differential equations:
961 @c ===beg===
962 @c load("ctensor");
963 @c derivabbrev:true;
964 @c dim:4;
965 @c lg:matrix([a, 0, 0, 0], [ 0, x^2, 0, 0],
966 @c                         [0, 0, x^2*sin(y)^2, 0], [0,0,0,-d]);
967 @c depends([a,d],x);
968 @c ct_coords:[x,y,z,t];
969 @c cmetric();
970 @c einstein(false);
971 @c findde(ein,2);
972 @c deindex;
973 @c ===end===
974 @example
975 (%i1) load("ctensor");
976 (%o1)       /share/tensor/ctensor.mac
977 (%i2) derivabbrev:true;
978 (%o2)                                true
979 (%i3) dim:4;
980 (%o3)                                  4
981 (%i4) lg:matrix([a, 0, 0, 0], [ 0, x^2, 0, 0],
982                               [0, 0, x^2*sin(y)^2, 0], [0,0,0,-d]);
983                           [ a  0       0        0  ]
984                           [                        ]
985                           [     2                  ]
986                           [ 0  x       0        0  ]
987 (%o4)                     [                        ]
988                           [         2    2         ]
989                           [ 0  0   x  sin (y)   0  ]
990                           [                        ]
991                           [ 0  0       0       - d ]
992 (%i5) depends([a,d],x);
993 (%o5)                            [a(x), d(x)]
994 (%i6) ct_coords:[x,y,z,t];
995 (%o6)                            [x, y, z, t]
996 (%i7) cmetric();
997 (%o7)                                done
998 (%i8) einstein(false);
999 (%o8)                                done
1000 (%i9) findde(ein,2);
1001                                             2
1002 (%o9) [d  x - a d + d, 2 a d d    x - a (d )  x - a  d d  x
1003         x                     x x         x        x    x
1005                                               2          2
1006                           + 2 a d d   - 2 a  d , a  x + a  - a]
1007                                    x       x      x
1008 (%i10) deindex;
1009 (%o10)                     [[1, 1], [2, 2], [4, 4]]
1010 @end example
1012 @opencatbox{Categories:}
1013 @category{Package ctensor}
1014 @closecatbox
1015 @end deffn
1016 @anchor{cograd}
1017 @deffn {Function} cograd ()
1018 Computes the covariant gradient of a scalar function allowing the
1019 user to choose the corresponding vector name as the example under
1020 @code{contragrad} illustrates.
1022 @opencatbox{Categories:}
1023 @category{Package ctensor}
1024 @closecatbox
1025 @end deffn
1026 @anchor{contragrad}
1027 @deffn {Function} contragrad ()
1029 Computes the contravariant gradient of a scalar function allowing
1030 @c "vector^F2name^F*" LOOKS LIKE IT NEEDS TO BE FIXED UP, NOT SURE HOW THOUGH
1031 the user to choose the corresponding vector name as the example
1032 below for the Schwarzschild metric illustrates:
1034 @c ===beg===
1035 @c load("ctensor");
1036 @c derivabbrev:true;
1037 @c ct_coordsys(exteriorschwarzschild,all);
1038 @c depends(f,r);
1039 @c cograd(f,g1);
1040 @c listarray(g1);
1041 @c contragrad(f,g2);
1042 @c listarray(g2);
1043 @c ===end===
1044 @example
1045 (%i1) load("ctensor");
1046 (%o1)       /share/tensor/ctensor.mac
1047 (%i2) derivabbrev:true;
1048 (%o2)                                true
1049 (%i3) ct_coordsys(exteriorschwarzschild,all);
1050 (%o3)                                done
1051 (%i4) depends(f,r);
1052 (%o4)                               [f(r)]
1053 (%i5) cograd(f,g1);
1054 (%o5)                                done
1055 (%i6) listarray(g1);
1056 (%o6)                            [0, f , 0, 0]
1057                                       r
1058 (%i7) contragrad(f,g2);
1059 (%o7)                                done
1060 (%i8) listarray(g2);
1061                                f  r - 2 f  m
1062                                 r        r
1063 (%o8)                      [0, -------------, 0, 0]
1064                                      r
1065 @end example
1067 @opencatbox{Categories:}
1068 @category{Package ctensor}
1069 @closecatbox
1070 @end deffn
1071 @anchor{ctensor_dscalar}
1072 @deffn {Function} dscalar ()
1073 computes the tensor d'Alembertian of the scalar function once
1074 dependencies have been declared upon the function. For example:
1076 @c ===beg===
1077 @c load("ctensor");
1078 @c derivabbrev:true;
1079 @c ct_coordsys(exteriorschwarzschild,all);
1080 @c depends(p,r);
1081 @c factor(dscalar(p));
1082 @c ===end===
1083 @example
1084 (%i1) load("ctensor");
1085 (%o1)       /share/tensor/ctensor.mac
1086 (%i2) derivabbrev:true;
1087 (%o2)                                true
1088 (%i3) ct_coordsys(exteriorschwarzschild,all);
1089 (%o3)                                done
1090 (%i4) depends(p,r);
1091 (%o4)                               [p(r)]
1092 (%i5) factor(dscalar(p));
1093 @group
1094                           2
1095                     p    r  - 2 m p    r + 2 p  r - 2 m p
1096                      r r           r r        r          r
1097 (%o5)               --------------------------------------
1098                                        2
1099                                       r
1100 @end group
1101 @end example
1103 @opencatbox{Categories:}
1104 @category{Package ctensor}
1105 @closecatbox
1106 @end deffn
1107 @anchor{checkdiv}
1108 @deffn {Function} checkdiv ()
1110 computes the covariant divergence of the mixed second rank tensor
1111 (whose first index must be covariant) by printing the
1112 corresponding n components of the vector field (the divergence) where
1113 n = @code{dim}. If the argument to the function is @code{g} then the
1114 divergence of the Einstein tensor will be formed and must be zero.
1115 In addition, the divergence (vector) is given the array name @code{div}.
1117 @opencatbox{Categories:}
1118 @category{Package ctensor}
1119 @closecatbox
1120 @end deffn
1121 @anchor{cgeodesic}
1122 @deffn {Function} cgeodesic (@var{dis})
1123 A function in the @code{ctensor} (component tensor)
1124 package.  @code{cgeodesic} computes the geodesic equations of
1125 motion for a given metric.  They are stored in the array @code{geod[i]}.  If
1126 the argument @var{dis} is @code{true} then these equations are displayed.
1128 @opencatbox{Categories:}
1129 @category{Package ctensor}
1130 @closecatbox
1131 @end deffn
1133 @anchor{bdvac}
1134 @deffn {Function} bdvac (@var{f})
1136 generates the covariant components of the vacuum field equations of
1137 the Brans- Dicke gravitational theory. The scalar field is specified
1138 by the argument @var{f}, which should be a (quoted) function name
1139 with functional dependencies, e.g., @code{'p(x)}.
1141 The components of the second rank covariant field tensor are
1142 represented by the array @code{bd}.
1144 @opencatbox{Categories:}
1145 @category{Package ctensor}
1146 @closecatbox
1147 @end deffn
1148 @anchor{invariant1}
1149 @deffn {Function} invariant1 ()
1151 generates the mixed Euler- Lagrange tensor (field equations) for the
1152 invariant density of R^2. The field equations are the components of an
1153 array named @code{inv1}.
1155 @opencatbox{Categories:}
1156 @category{Package ctensor}
1157 @closecatbox
1158 @end deffn
1159 @anchor{invariant2}
1160 @deffn {Function} invariant2 ()
1162 *** NOT YET IMPLEMENTED ***
1164 generates the mixed Euler- Lagrange tensor (field equations) for the
1165 invariant density of @code{ric[i,j]*uriem[i,j]}. The field equations are the
1166 components of an array named @code{inv2}.
1169 @opencatbox{Categories:}
1170 @category{Package ctensor}
1171 @closecatbox
1172 @end deffn
1173 @anchor{bimetric}
1174 @deffn {Function} bimetric ()
1176 *** NOT YET IMPLEMENTED ***
1178 generates the field equations of Rosen's bimetric theory. The field
1179 equations are the components of an array named @code{rosen}.
1181 @opencatbox{Categories:}
1182 @category{Package ctensor}
1183 @closecatbox
1184 @end deffn
1186 @subsection Utility functions
1187 @anchor{diagmatrixp}
1188 @deffn {Function} diagmatrixp (@var{M},@var{n})
1190 Returns @code{true} if the first @var{n} rows and @var{n} columns of @var{M}
1191 form a diagonal matrix or (2D) array.
1193 @opencatbox{Categories:}
1194 @category{Package ctensor}
1195 @category{Predicate functions}
1196 @closecatbox
1198 @end deffn
1199 @anchor{symmetricp}
1200 @deffn {Function} symmetricp (@var{M}, @var{n})
1202 Returns @code{true} if @var{M} is a @var{n} by @var{n} symmetric matrix or two-dimensional array,
1203 otherwise @code{false}.
1205 If @var{n} is less than the size of @var{M},
1206 @code{symmetricp} considers only the @var{n} by @var{n} submatrix (respectively, subarray)
1207 comprising rows 1 through @var{n} and columns 1 through @var{n}.
1209 @opencatbox{Categories:}
1210 @category{Package ctensor}
1211 @category{Predicate functions}
1212 @closecatbox
1214 @end deffn
1215 @anchor{ntermst}
1216 @deffn {Function} ntermst (@var{f})
1217 gives the user a quick picture of the "size" of the doubly subscripted
1218 tensor (array) @var{f}.  It prints two element lists where the second
1219 element corresponds to NTERMS of the components specified by the first
1220 elements.  In this way, it is possible to quickly find the non-zero
1221 expressions and attempt simplification.
1223 @opencatbox{Categories:}
1224 @category{Package ctensor}
1225 @closecatbox
1226 @end deffn
1227 @anchor{cdisplay}
1228 @deffn {Function} cdisplay (@var{ten})
1229 displays all the elements of the tensor @var{ten}, as represented by
1230 a multidimensional array. Tensors of rank 0 and 1, as well as other types
1231 of variables, are displayed as with @code{ldisplay}. Tensors of rank 2 are
1232 displayed as 2-dimensional matrices, while tensors of higher rank are displayed
1233 as a list of 2-dimensional matrices. For instance, the Riemann-tensor of
1234 the Schwarzschild metric can be viewed as:
1236 @example
1237 (%i1) load("ctensor");
1238 (%o1)       /share/tensor/ctensor.mac
1239 (%i2) ratfac:true;
1240 (%o2)                                true
1241 (%i3) ct_coordsys(exteriorschwarzschild,all);
1242 (%o3)                                done
1243 (%i4) riemann(false);
1244 (%o4)                                done
1245 (%i5) cdisplay(riem);
1246           [ 0               0                   0           0     ]
1247           [                                                       ]
1248           [                              2                        ]
1249           [      3 m (r - 2 m)   m    2 m                         ]
1250           [ 0  - ------------- + -- - ----      0           0     ]
1251           [            4          3     4                         ]
1252           [           r          r     r                          ]
1253           [                                                       ]
1254 riem    = [                                m (r - 2 m)            ]
1255     1, 1  [ 0               0              -----------      0     ]
1256           [                                     4                 ]
1257           [                                    r                  ]
1258           [                                                       ]
1259           [                                           m (r - 2 m) ]
1260           [ 0               0                   0     ----------- ]
1261           [                                                4      ]
1262           [                                               r       ]
1264                                 [    2 m (r - 2 m)       ]
1265                                 [ 0  -------------  0  0 ]
1266                                 [          4             ]
1267                                 [         r              ]
1268                      riem     = [                        ]
1269                          1, 2   [ 0        0        0  0 ]
1270                                 [                        ]
1271                                 [ 0        0        0  0 ]
1272                                 [                        ]
1273                                 [ 0        0        0  0 ]
1275                                 [         m (r - 2 m)    ]
1276                                 [ 0  0  - -----------  0 ]
1277                                 [              4         ]
1278                                 [             r          ]
1279                      riem     = [                        ]
1280                          1, 3   [ 0  0        0        0 ]
1281                                 [                        ]
1282                                 [ 0  0        0        0 ]
1283                                 [                        ]
1284                                 [ 0  0        0        0 ]
1286                                 [            m (r - 2 m) ]
1287                                 [ 0  0  0  - ----------- ]
1288                                 [                 4      ]
1289                                 [                r       ]
1290                      riem     = [                        ]
1291                          1, 4   [ 0  0  0        0       ]
1292                                 [                        ]
1293                                 [ 0  0  0        0       ]
1294                                 [                        ]
1295                                 [ 0  0  0        0       ]
1297                                [       0         0  0  0 ]
1298                                [                         ]
1299                                [       2 m               ]
1300                                [ - ------------  0  0  0 ]
1301                     riem     = [    2                    ]
1302                         2, 1   [   r  (r - 2 m)          ]
1303                                [                         ]
1304                                [       0         0  0  0 ]
1305                                [                         ]
1306                                [       0         0  0  0 ]
1308              [     2 m                                         ]
1309              [ ------------  0        0               0        ]
1310              [  2                                              ]
1311              [ r  (r - 2 m)                                    ]
1312              [                                                 ]
1313              [      0        0        0               0        ]
1314              [                                                 ]
1315   riem     = [                         m                       ]
1316       2, 2   [      0        0  - ------------        0        ]
1317              [                     2                           ]
1318              [                    r  (r - 2 m)                 ]
1319              [                                                 ]
1320              [                                         m       ]
1321              [      0        0        0         - ------------ ]
1322              [                                     2           ]
1323              [                                    r  (r - 2 m) ]
1325                                 [ 0  0       0        0 ]
1326                                 [                       ]
1327                                 [            m          ]
1328                                 [ 0  0  ------------  0 ]
1329                      riem     = [        2              ]
1330                          2, 3   [       r  (r - 2 m)    ]
1331                                 [                       ]
1332                                 [ 0  0       0        0 ]
1333                                 [                       ]
1334                                 [ 0  0       0        0 ]
1336                                 [ 0  0  0       0       ]
1337                                 [                       ]
1338                                 [               m       ]
1339                                 [ 0  0  0  ------------ ]
1340                      riem     = [           2           ]
1341                          2, 4   [          r  (r - 2 m) ]
1342                                 [                       ]
1343                                 [ 0  0  0       0       ]
1344                                 [                       ]
1345                                 [ 0  0  0       0       ]
1347                                       [ 0  0  0  0 ]
1348                                       [            ]
1349                                       [ 0  0  0  0 ]
1350                                       [            ]
1351                            riem     = [ m          ]
1352                                3, 1   [ -  0  0  0 ]
1353                                       [ r          ]
1354                                       [            ]
1355                                       [ 0  0  0  0 ]
1357                                       [ 0  0  0  0 ]
1358                                       [            ]
1359                                       [ 0  0  0  0 ]
1360                                       [            ]
1361                            riem     = [    m       ]
1362                                3, 2   [ 0  -  0  0 ]
1363                                       [    r       ]
1364                                       [            ]
1365                                       [ 0  0  0  0 ]
1367                                [   m                      ]
1368                                [ - -   0   0       0      ]
1369                                [   r                      ]
1370                                [                          ]
1371                                [        m                 ]
1372                                [  0   - -  0       0      ]
1373                     riem     = [        r                 ]
1374                         3, 3   [                          ]
1375                                [  0    0   0       0      ]
1376                                [                          ]
1377                                [              2 m - r     ]
1378                                [  0    0   0  ------- + 1 ]
1379                                [                 r        ]
1381                                     [ 0  0  0    0   ]
1382                                     [                ]
1383                                     [ 0  0  0    0   ]
1384                                     [                ]
1385                          riem     = [            2 m ]
1386                              3, 4   [ 0  0  0  - --- ]
1387                                     [             r  ]
1388                                     [                ]
1389                                     [ 0  0  0    0   ]
1391                                 [       0        0  0  0 ]
1392                                 [                        ]
1393                                 [       0        0  0  0 ]
1394                                 [                        ]
1395                      riem     = [       0        0  0  0 ]
1396                          4, 1   [                        ]
1397                                 [      2                 ]
1398                                 [ m sin (theta)          ]
1399                                 [ -------------  0  0  0 ]
1400                                 [       r                ]
1402                                 [ 0        0        0  0 ]
1403                                 [                        ]
1404                                 [ 0        0        0  0 ]
1405                                 [                        ]
1406                      riem     = [ 0        0        0  0 ]
1407                          4, 2   [                        ]
1408                                 [         2              ]
1409                                 [    m sin (theta)       ]
1410                                 [ 0  -------------  0  0 ]
1411                                 [          r             ]
1413                               [ 0  0          0          0 ]
1414                               [                            ]
1415                               [ 0  0          0          0 ]
1416                               [                            ]
1417                    riem     = [ 0  0          0          0 ]
1418                        4, 3   [                            ]
1419                               [                2           ]
1420                               [         2 m sin (theta)    ]
1421                               [ 0  0  - ---------------  0 ]
1422                               [                r           ]
1424            [        2                                             ]
1425            [   m sin (theta)                                      ]
1426            [ - -------------         0                0         0 ]
1427            [         r                                            ]
1428            [                                                      ]
1429            [                         2                            ]
1430            [                    m sin (theta)                     ]
1431 riem     = [        0         - -------------         0         0 ]
1432     4, 4   [                          r                           ]
1433            [                                                      ]
1434            [                                          2           ]
1435            [                                   2 m sin (theta)    ]
1436            [        0                0         ---------------  0 ]
1437            [                                          r           ]
1438            [                                                      ]
1439            [        0                0                0         0 ]
1441 (%o5)                                done
1443 @end example
1445 @opencatbox{Categories:}
1446 @category{Package ctensor}
1447 @closecatbox
1448 @end deffn
1449 @anchor{deleten}
1450 @deffn {Function} deleten (@var{L}, @var{n})
1451 Returns a new list consisting of @var{L} with the @var{n}'th element
1452 deleted.
1454 @opencatbox{Categories:}
1455 @category{Package ctensor}
1456 @closecatbox
1457 @end deffn
1459 @subsection Variables used by @code{ctensor}
1462 @anchor{dim}
1463 @defvr {Option variable} dim
1464 Default value: 4
1466 An option in the @code{ctensor} (component tensor)
1467 package.  @code{dim} is the dimension of the manifold with the
1468 default 4. The command @code{dim: n} will reset the dimension to any other
1469 value @code{n}.
1471 @opencatbox{Categories:}
1472 @category{Package ctensor}
1473 @closecatbox
1475 @end defvr
1477 @anchor{diagmetric}
1478 @defvr {Option variable} diagmetric
1479 Default value: @code{false}
1481 An option in the @code{ctensor} (component tensor)
1482 package.  If @code{diagmetric} is @code{true} special routines compute
1483 all geometrical objects (which contain the metric tensor explicitly)
1484 by taking into consideration the diagonality of the metric. Reduced
1485 run times will, of course, result. Note: this option is set
1486 automatically by @code{csetup} if a diagonal metric is specified.
1488 @opencatbox{Categories:}
1489 @category{Package ctensor}
1490 @closecatbox
1492 @end defvr
1494 @anchor{ctrgsimp}
1495 @defvr {Option variable} ctrgsimp
1497 Causes trigonometric simplifications to be used when tensors are computed. Presently,
1498 @code{ctrgsimp} affects only computations involving a moving frame.
1500 @opencatbox{Categories:}
1501 @category{Package ctensor}
1502 @category{Simplification flags and variables}
1503 @closecatbox
1505 @end defvr
1507 @anchor{cframe_flag}
1508 @defvr {Option variable} cframe_flag
1510 Causes computations to be performed relative to a moving frame as opposed to
1511 a holonomic metric. The frame is defined by the inverse frame array @code{fri}
1512 and the frame metric @code{lfg}. For computations using a Cartesian frame,
1513 @code{lfg} should be the unit matrix of the appropriate dimension; for
1514 computations in a Lorentz frame, @code{lfg} should have the appropriate
1515 signature.
1517 @opencatbox{Categories:}
1518 @category{Package ctensor}
1519 @closecatbox
1521 @end defvr
1523 @anchor{ctorsion_flag}
1524 @defvr {Option variable} ctorsion_flag
1526 Causes the contortion tensor to be included in the computation of the
1527 connection coefficients. The contortion tensor itself is computed by
1528 @code{contortion} from the user-supplied tensor @code{tr}.
1530 @opencatbox{Categories:}
1531 @category{Package ctensor}
1532 @closecatbox
1534 @end defvr
1536 @anchor{cnonmet_flag}
1537 @defvr {Option variable} cnonmet_flag
1539 Causes the nonmetricity coefficients to be included in the computation of
1540 the connection coefficients. The nonmetricity coefficients are computed
1541 from the user-supplied nonmetricity vector @code{nm} by the function
1542 @code{nonmetricity}.
1544 @opencatbox{Categories:}
1545 @category{Package ctensor}
1546 @closecatbox
1548 @end defvr
1550 @anchor{ctayswitch}
1551 @defvr {Option variable} ctayswitch
1553 If set to @code{true}, causes some @code{ctensor} computations to be carried out using
1554 Taylor-series expansions. Presently, @code{christof}, @code{ricci},
1555 @code{uricci}, @code{einstein}, and @code{weyl} take into account this
1556 setting.
1558 @opencatbox{Categories:}
1559 @category{Package ctensor}
1560 @closecatbox
1562 @end defvr
1564 @anchor{ctayvar}
1565 @defvr {Option variable} ctayvar
1567 Variable used for Taylor-series expansion if @code{ctayswitch} is set to
1568 @code{true}.
1570 @opencatbox{Categories:}
1571 @category{Package ctensor}
1572 @closecatbox
1574 @end defvr
1576 @anchor{ctaypov}
1577 @defvr {Option variable} ctaypov
1579 Maximum power used in Taylor-series expansion when @code{ctayswitch} is
1580 set to @code{true}.
1582 @opencatbox{Categories:}
1583 @category{Package ctensor}
1584 @closecatbox
1586 @end defvr
1588 @anchor{ctaypt}
1589 @defvr {Option variable} ctaypt
1591 Point around which Taylor-series expansion is carried out when
1592 @code{ctayswitch} is set to @code{true}.
1594 @opencatbox{Categories:}
1595 @category{Package ctensor}
1596 @closecatbox
1598 @end defvr
1600 @anchor{gdet}
1601 @defvr {System variable} gdet
1603 The determinant of the metric tensor @code{lg}. Computed by @code{cmetric} when
1604 @code{cframe_flag} is set to @code{false}.
1606 @opencatbox{Categories:}
1607 @category{Package ctensor}
1608 @closecatbox
1610 @end defvr
1612 @anchor{ratchristof}
1613 @defvr {Option variable} ratchristof
1615 Causes rational simplification to be applied by @code{christof}.
1617 @opencatbox{Categories:}
1618 @category{Package ctensor}
1619 @closecatbox
1621 @end defvr
1623 @anchor{rateinstein}
1624 @defvr {Option variable} rateinstein
1625 Default value: @code{true}
1627 If @code{true} rational simplification will be
1628 performed on the non-zero components of Einstein tensors; if
1629 @code{ratfac} is @code{true} then the components will also be factored.
1631 @opencatbox{Categories:}
1632 @category{Package ctensor}
1633 @closecatbox
1635 @end defvr
1636 @anchor{ratriemann}
1637 @defvr {Option variable} ratriemann
1638 Default value: @code{true}
1640 One of the switches which controls
1641 simplification of Riemann tensors; if @code{true}, then rational
1642 simplification will be done; if @code{ratfac} is @code{true} then each of the
1643 components will also be factored.
1645 @opencatbox{Categories:}
1646 @category{Package ctensor}
1647 @closecatbox
1649 @end defvr
1651 @anchor{ratweyl}
1652 @defvr {Option variable} ratweyl
1653 Default value: @code{true}
1655 If @code{true}, this switch causes the @code{weyl} function
1656 to apply rational simplification to the values of the Weyl tensor. If
1657 @code{ratfac} is @code{true}, then the components will also be factored.
1659 @opencatbox{Categories:}
1660 @category{Package ctensor}
1661 @closecatbox
1663 @end defvr
1665 @anchor{lfg}
1666 @defvr {Variable} lfg
1667 The covariant frame metric. By default, it is initialized to the 4-dimensional Lorentz frame with signature (+,+,+,-). Used when @code{cframe_flag} is @code{true}.
1669 @opencatbox{Categories:}
1670 @category{Package ctensor}
1671 @closecatbox
1673 @end defvr
1675 @anchor{ufg}
1676 @defvr {Variable} ufg
1677 The inverse frame metric. Computed from @code{lfg} when @code{cmetric} is called while @code{cframe_flag} is set to @code{true}.
1679 @opencatbox{Categories:}
1680 @category{Package ctensor}
1681 @closecatbox
1683 @end defvr
1685 @anchor{riem}
1686 @defvr {Variable} riem
1687 The (3,1) Riemann tensor. Computed when the function @code{riemann} is invoked. For information about index ordering, see the description of @code{riemann}.
1689 If @code{cframe_flag} is @code{true}, @code{riem} is computed from the covariant Riemann-tensor @code{lriem}.
1691 @opencatbox{Categories:}
1692 @category{Package ctensor}
1693 @closecatbox
1695 @end defvr
1697 @anchor{lriem}
1698 @defvr {Variable} lriem
1700 The covariant Riemann tensor. Computed by @code{lriemann}.
1702 @opencatbox{Categories:}
1703 @category{Package ctensor}
1704 @closecatbox
1706 @end defvr
1708 @anchor{uriem}
1709 @defvr {Variable} uriem
1711 The contravariant Riemann tensor. Computed by @code{uriemann}.
1713 @opencatbox{Categories:}
1714 @category{Package ctensor}
1715 @closecatbox
1717 @end defvr
1719 @anchor{ric}
1720 @defvr {Variable} ric
1722 The covariant Ricci-tensor. Computed by @code{ricci}.
1724 @opencatbox{Categories:}
1725 @category{Package ctensor}
1726 @closecatbox
1728 @end defvr
1730 @anchor{uric}
1731 @defvr {Variable} uric
1733 The mixed-index Ricci-tensor. Computed by @code{uricci}.
1735 @opencatbox{Categories:}
1736 @category{Package ctensor}
1737 @closecatbox
1739 @end defvr
1741 @anchor{lg}
1742 @defvr {Variable} lg
1744 The metric tensor. This tensor must be specified (as a @code{dim} by @code{dim} matrix)
1745 before other computations can be performed.
1747 @opencatbox{Categories:}
1748 @category{Package ctensor}
1749 @closecatbox
1751 @end defvr
1753 @anchor{ug}
1754 @defvr {Variable} ug
1756 The inverse of the metric tensor. Computed by @code{cmetric}.
1758 @opencatbox{Categories:}
1759 @category{Package ctensor}
1760 @closecatbox
1762 @end defvr
1764 @anchor{weyl_variable}
1765 @defvr {Variable} weyl
1767 The Weyl tensor. Computed by @code{weyl}.
1769 @opencatbox{Categories:}
1770 @category{Package ctensor}
1771 @closecatbox
1773 @end defvr
1775 @anchor{fb}
1776 @defvr {Variable} fb
1778 Frame bracket coefficients, as computed by @code{frame_bracket}.
1780 @opencatbox{Categories:}
1781 @category{Package ctensor}
1782 @closecatbox
1784 @end defvr
1786 @anchor{kinvariant}
1787 @defvr {Variable} kinvariant
1789 The Kretschmann invariant. Computed by @code{rinvariant}.
1791 @opencatbox{Categories:}
1792 @category{Package ctensor}
1793 @closecatbox
1795 @end defvr
1797 @anchor{np}
1798 @defvr {Variable} np
1800 A Newman-Penrose null tetrad. Computed by @code{nptetrad}.
1802 @opencatbox{Categories:}
1803 @category{Package ctensor}
1804 @closecatbox
1806 @end defvr
1808 @anchor{npi}
1809 @defvr {Variable} npi
1811 The raised-index Newman-Penrose null tetrad. Computed by @code{nptetrad}.
1812 Defined as @code{ug.np}. The product @code{np.transpose(npi)} is constant:
1814 @example
1815 (%i39) trigsimp(np.transpose(npi));
1816                               [  0   - 1  0  0 ]
1817                               [                ]
1818                               [ - 1   0   0  0 ]
1819 (%o39)                        [                ]
1820                               [  0    0   0  1 ]
1821                               [                ]
1822                               [  0    0   1  0 ]
1823 @end example
1825 @opencatbox{Categories:}
1826 @category{Package ctensor}
1827 @closecatbox
1829 @end defvr
1831 @anchor{tr}
1832 @defvr {Variable} tr
1834 User-supplied rank-3 tensor representing torsion. Used by @code{contortion}.
1836 @opencatbox{Categories:}
1837 @category{Package ctensor}
1838 @closecatbox
1839 @end defvr
1841 @anchor{kt}
1842 @defvr {Variable} kt
1844 The contortion tensor, computed from @code{tr} by @code{contortion}.
1846 @opencatbox{Categories:}
1847 @category{Package ctensor}
1848 @closecatbox
1849 @end defvr
1851 @anchor{nm}
1852 @defvr {Variable} nm
1854 User-supplied nonmetricity vector. Used by @code{nonmetricity}.
1856 @opencatbox{Categories:}
1857 @category{Package ctensor}
1858 @closecatbox
1859 @end defvr
1861 @anchor{nmc}
1862 @defvr {Variable} nmc
1864 The nonmetricity coefficients, computed from @code{nm} by @code{nonmetricity}.
1866 @opencatbox{Categories:}
1867 @category{Package ctensor}
1868 @closecatbox
1870 @end defvr
1872 @anchor{tensorkill}
1873 @defvr {System variable} tensorkill
1875 Variable indicating if the tensor package has been initialized. Set and used by
1876 @code{csetup}, reset by @code{init_ctensor}.
1878 @opencatbox{Categories:}
1879 @category{Package ctensor}
1880 @closecatbox
1882 @end defvr
1884 @anchor{ct_coords}
1885 @defvr {Option variable} ct_coords
1886 Default value: @code{[]}
1888 An option in the @code{ctensor} (component tensor)
1889 package.  @code{ct_coords} contains a list of coordinates.
1890 While normally defined when the function @code{csetup} is called,
1891 one may redefine the coordinates with the assignment
1892 @code{ct_coords: [j1, j2, ..., jn]} where the j's are the new coordinate names.
1893 See also @mrefdot{csetup}
1895 @opencatbox{Categories:}
1896 @category{Package ctensor}
1897 @closecatbox
1899 @end defvr
1901 @subsection Reserved names
1903 The following names are used internally by the @code{ctensor} package and
1904 should not be redefined:
1906 @example
1907   Name         Description
1908   ---------------------------------------------------------------------
1909   _lg()        Evaluates to lfg if frame metric used, lg otherwise
1910   _ug()        Evaluates to ufg if frame metric used, ug otherwise
1911   cleanup()    Removes items from the deindex list
1912   contract4()  Used by psi()
1913   filemet()    Used by csetup() when reading the metric from a file
1914   findde1()    Used by findde()
1915   findde2()    Used by findde()
1916   findde3()    Used by findde()
1917   kdelt()      Kronecker-delta (not generalized)
1918   newmet()     Used by csetup() for setting up a metric interactively
1919   setflags()   Used by init_ctensor()
1920   readvalue()
1921   resimp()
1922   sermet()     Used by csetup() for entering a metric as Taylor-series
1923   txyzsum()
1924   tmetric()    Frame metric, used by cmetric() when cframe_flag:true
1925   triemann()   Riemann-tensor in frame base, used when cframe_flag:true
1926   tricci()     Ricci-tensor in frame base, used when cframe_flag:true
1927   trrc()       Ricci rotation coefficients, used by christof()
1928   yesp()
1929 @end example
1932 @subsection Changes
1934 In November, 2004, the @code{ctensor} package was extensively rewritten.
1935 Many functions and variables have been renamed in order to make the
1936 package compatible with the commercial version of Macsyma.
1939 @example
1940   New Name     Old Name        Description
1941   ---------------------------------------------------------------------
1942   ctaylor()    DLGTAYLOR()     Taylor-series expansion of an expression
1943   lgeod[]      EM              Geodesic equations
1944   ein[]        G[]             Mixed Einstein-tensor
1945   ric[]        LR[]            Mixed Ricci-tensor
1946   ricci()      LRICCICOM()     Compute the mixed Ricci-tensor
1947   ctaypov      MINP            Maximum power in Taylor-series expansion
1948   cgeodesic()  MOTION          Compute geodesic equations
1949   ct_coords    OMEGA           Metric coordinates
1950   ctayvar      PARAM           Taylor-series expansion variable
1951   lriem[]      R[]             Covariant Riemann-tensor
1952   uriemann()   RAISERIEMANN()  Compute the contravariant Riemann-tensor
1953   ratriemann   RATRIEMAN       Rational simplif. of the Riemann-tensor
1954   uric[]       RICCI[]         Contravariant Ricci-tensor
1955   uricci()     RICCICOM()      Compute the contravariant Ricci-tensor
1956   cmetric()    SETMETRIC()     Set up the metric
1957   ctaypt       TAYPT           Point for Taylor-series expansion
1958   ctayswitch   TAYSWITCH       Taylor-series setting switch
1959   csetup()     TSETUP()        Start interactive setup session
1960   ctransform() TTRANSFORM()    Interactive coordinate transformation
1961   uriem[]      UR[]            Contravariant Riemann-tensor
1962   weyl[]       W[]             (3,1) Weyl-tensor
1964 @end example