2 * Introduction to ctensor::
3 * Functions and Variables for ctensor::
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.
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
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.
36 (%i1) load("ctensor");
37 (%o1) /share/tensor/ctensor.mac
39 Enter the dimension of the coordinate system:
41 Do you wish to change the coordinate names?
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
64 Enter functional dependencies with the DEPENDS function or 'N' if none
66 Do you wish to see the metric?
107 (%t9) mcs = - ---------
110 (%t10) mcs = - cos(y) sin(y)
121 @opencatbox{Categories:}
123 @category{Share packages}
124 @category{Package ctensor}
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
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}
144 @deffn {Function} cmetric @
145 @fname{cmetric} (@var{dis}) @
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
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}
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:
179 SYMBOL Dim Coordinates Description/comments
180 ------------------------------------------------------------------
181 cartesian2d 2 [x,y] Cartesian 2D coordinate
183 polar 2 [r,phi] Polar coordinate system
184 elliptic 2 [u,v] Elliptic coord. system
185 confocalelliptic 2 [u,v] Confocal elliptic
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
191 polarcylindrical 3 [r,theta,z] Polar 2D with
193 ellipticcylindrical 3 [u,v,z] Elliptic 2D with
195 confocalellipsoidal 3 [u,v,w] Confocal ellipsoidal
196 bipolarcylindrical 3 [u,v,z] Bipolar 2D with
198 paraboliccylindrical 3 [u,v,z] Parabolic 2D with
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
206 oblatespheroidalsqrt 3 [u,v,phi]
207 prolatespheroidal 3 [u,v,phi] Prolate spheroidal
209 prolatespheroidalsqrt 3 [u,v,phi]
210 ellipsoidal 3 [r,theta,phi] Ellipsoidal coordinates
211 cartesian4d 4 [x,y,z,t] Cartesian 4D coordinate
213 spherical4d 4 [r,theta,eta,phi] Spherical 4D coordinate
215 exteriorschwarzschild 4 [t,r,theta,phi] Schwarzschild metric
216 interiorschwarzschild 4 [t,z,u,v] Interior Schwarzschild
218 kerr_newman 4 [t,r,theta,phi] Charged axially
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:
228 @c ct_coordsys([r*cos(theta)*cos(phi),r*cos(theta)*sin(phi),
229 @c r*sin(theta),[r,theta,phi]]);
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]]);
241 (%i3) lg:trigsimp(lg);
248 [ 0 0 r cos (theta) ]
250 (%o4) [r, theta, phi]
256 Transformation functions can also be used when @code{cframe_flag} is @code{true}:
261 @c ct_coordsys([r*cos(theta)*cos(phi),r*cos(theta)*sin(phi),
262 @c r*sin(theta),[r,theta,phi]]);
269 (%i1) load("ctensor");
270 (%o1) /share/tensor/ctensor.mac
271 (%i2) cframe_flag:true;
273 (%i3) ct_coordsys([r*cos(theta)*cos(phi),r*cos(theta)*sin(phi),
274 r*sin(theta),[r,theta,phi]]);
278 [cos(phi)cos(theta) -cos(phi) r sin(theta) -sin(phi) r cos(theta)]
280 [sin(phi)cos(theta) -sin(phi) r sin(theta) cos(phi) r cos(theta)]
282 [ sin(theta) r cos(theta) 0 ]
286 (%i6) lg:trigsimp(lg);
293 [ 0 0 r cos (theta) ]
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}
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}
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
331 When a metric base is used, @code{ctensor} can compute the following tensors:
337 lcs -- mcs -- ric -- uric
339 \ tracer - ein -- lein
341 riem -- lriem -- weyl
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:
355 fri -- fr -- lcs -- mcs -- lriem -- ric -- uric
357 lg -- ug | weyl tracer - ein -- lein
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}
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}
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}
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}
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
430 @opencatbox{Categories:}
431 @category{Package ctensor}
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}
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:
451 R[i,j,k,l] = R = | - | + | | - | |
452 ijk ij,k ik,j mk ij mj ik
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}
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}
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}
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}
503 @deffn {Function} rinvariant ()
504 Forms the Kretschmann-invariant (@code{kinvariant}) obtained by
505 contracting the tensors
508 lriem[i,j,k,l]*uriem[i,j,k,l].
511 This object is not automatically simplified since it can be very large.
513 @opencatbox{Categories:}
514 @category{Package ctensor}
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
526 @opencatbox{Categories:}
527 @category{Package ctensor}
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:
543 ---------------------------------
544 christof() For mcs only
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
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
570 (%i1) load("ctensor");
571 (%o1) /share/tensor/ctensor.mac
574 (%i3) derivabbrev: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]);
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]);
608 [ 0 0 0 r sin (theta) + h44 l ]
609 (%i9) cmetric(false);
611 (%i10) einstein(false);
634 However, if we recompute this example as an approximation that is
635 linear in the variable @code{l}, we get much simpler expressions:
639 (%i14) ctayswitch:true;
647 (%i18) christof(false);
651 (%i20) einstein(false);
671 (%i22) ratsimp(ein[1,1]);
673 (%o22) - (((h11 h22 - h11 ) (l ) r - 2 h33 l r ) sin (theta)
677 - 2 h44 l r - h33 h44 (l ) )/(4 r sin (theta))
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}
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.
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:
705 ifb = ( ifri - ifri ) ifr ifr
709 @opencatbox{Categories:}
710 @category{Package ctensor}
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}.
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
732 np = (fri + fri ) / sqrt(2)
735 np = (fri - fri ) / sqrt(2)
738 np = (fri + %i fri ) / sqrt(2)
741 np = (fri - %i fri ) / sqrt(2)
746 @opencatbox{Categories:}
747 @category{Package ctensor}
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}
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
783 (%i1) load("ctensor");
784 (%o1) /share/tensor/ctensor.mac
785 (%i2) (cframe_flag:true,gcd:spmod,ctrgsimp:true,ratfac:true);
787 (%i3) ct_coordsys(exteriorschwarzschild,all);
792 (%i6) nptetrad(true);
795 [ sqrt(r - 2 m) sqrt(r) ]
796 [--------------- --------------------- 0 0 ]
797 [sqrt(2) sqrt(r) sqrt(2) sqrt(r - 2 m) ]
799 [ sqrt(r - 2 m) sqrt(r) ]
800 [--------------- - --------------------- 0 0 ]
801 [sqrt(2) sqrt(r) sqrt(2) sqrt(r - 2 m) ]
803 [ r %i r sin(theta) ]
804 [ 0 0 ------- --------------- ]
808 [ 0 0 ------- - ---------------]
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)
820 [0, 0, ---------, --------------------],
821 sqrt(2) r sqrt(2) r sin(theta)
824 [0, 0, ---------, - --------------------])
825 sqrt(2) r sqrt(2) r sin(theta)
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}
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:
877 kt = -------------------------------
887 Note that only the mixed-index tensor is calculated and stored in the
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:
897 -nm D - D nm + g nm g
899 nmc = ------------------------------
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}.
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}
923 @anchor{nonmetricity}
924 @deffn {Function} nonmetricity (@var{nm})
926 Computes the (2,1) nonmetricity coefficients from the nonmetricity
929 @opencatbox{Categories:}
930 @category{Package ctensor}
936 @subsection Miscellaneous features
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}
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:
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]);
968 @c ct_coords:[x,y,z,t];
975 (%i1) load("ctensor");
976 (%o1) /share/tensor/ctensor.mac
977 (%i2) derivabbrev:true;
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]);
992 (%i5) depends([a,d],x);
994 (%i6) ct_coords:[x,y,z,t];
998 (%i8) einstein(false);
1000 (%i9) findde(ein,2);
1002 (%o9) [d x - a d + d, 2 a d d x - a (d ) x - a d d x
1006 + 2 a d d - 2 a d , a x + a - a]
1009 (%o10) [[1, 1], [2, 2], [4, 4]]
1012 @opencatbox{Categories:}
1013 @category{Package ctensor}
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}
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:
1036 @c derivabbrev:true;
1037 @c ct_coordsys(exteriorschwarzschild,all);
1041 @c contragrad(f,g2);
1045 (%i1) load("ctensor");
1046 (%o1) /share/tensor/ctensor.mac
1047 (%i2) derivabbrev:true;
1049 (%i3) ct_coordsys(exteriorschwarzschild,all);
1055 (%i6) listarray(g1);
1058 (%i7) contragrad(f,g2);
1060 (%i8) listarray(g2);
1063 (%o8) [0, -------------, 0, 0]
1067 @opencatbox{Categories:}
1068 @category{Package ctensor}
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:
1078 @c derivabbrev:true;
1079 @c ct_coordsys(exteriorschwarzschild,all);
1081 @c factor(dscalar(p));
1084 (%i1) load("ctensor");
1085 (%o1) /share/tensor/ctensor.mac
1086 (%i2) derivabbrev:true;
1088 (%i3) ct_coordsys(exteriorschwarzschild,all);
1092 (%i5) factor(dscalar(p));
1095 p r - 2 m p r + 2 p r - 2 m p
1097 (%o5) --------------------------------------
1103 @opencatbox{Categories:}
1104 @category{Package ctensor}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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:
1237 (%i1) load("ctensor");
1238 (%o1) /share/tensor/ctensor.mac
1241 (%i3) ct_coordsys(exteriorschwarzschild,all);
1243 (%i4) riemann(false);
1245 (%i5) cdisplay(riem);
1249 [ 3 m (r - 2 m) m 2 m ]
1250 [ 0 - ------------- + -- - ---- 0 0 ]
1254 riem = [ m (r - 2 m) ]
1255 1, 1 [ 0 0 ----------- 0 ]
1260 [ 0 0 0 ----------- ]
1265 [ 0 ------------- 0 0 ]
1276 [ 0 0 - ----------- 0 ]
1287 [ 0 0 0 - ----------- ]
1300 [ - ------------ 0 0 0 ]
1302 2, 1 [ r (r - 2 m) ]
1309 [ ------------ 0 0 0 ]
1316 2, 2 [ 0 0 - ------------ 0 ]
1321 [ 0 0 0 - ------------ ]
1328 [ 0 0 ------------ 0 ]
1330 2, 3 [ r (r - 2 m) ]
1339 [ 0 0 0 ------------ ]
1341 2, 4 [ r (r - 2 m) ]
1378 [ 0 0 0 ------- + 1 ]
1386 3, 4 [ 0 0 0 - --- ]
1399 [ ------------- 0 0 0 ]
1410 [ 0 ------------- 0 0 ]
1421 [ 0 0 - --------------- 0 ]
1426 [ - ------------- 0 0 0 ]
1431 riem = [ 0 - ------------- 0 0 ]
1436 [ 0 0 --------------- 0 ]
1445 @opencatbox{Categories:}
1446 @category{Package ctensor}
1450 @deffn {Function} deleten (@var{L}, @var{n})
1451 Returns a new list consisting of @var{L} with the @var{n}'th element
1454 @opencatbox{Categories:}
1455 @category{Package ctensor}
1459 @subsection Variables used by @code{ctensor}
1463 @defvr {Option variable} dim
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
1471 @opencatbox{Categories:}
1472 @category{Package ctensor}
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}
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}
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
1517 @opencatbox{Categories:}
1518 @category{Package ctensor}
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}
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}
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
1558 @opencatbox{Categories:}
1559 @category{Package ctensor}
1565 @defvr {Option variable} ctayvar
1567 Variable used for Taylor-series expansion if @code{ctayswitch} is set to
1570 @opencatbox{Categories:}
1571 @category{Package ctensor}
1577 @defvr {Option variable} ctaypov
1579 Maximum power used in Taylor-series expansion when @code{ctayswitch} is
1582 @opencatbox{Categories:}
1583 @category{Package ctensor}
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}
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}
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}
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}
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}
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}
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}
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}
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}
1698 @defvr {Variable} lriem
1700 The covariant Riemann tensor. Computed by @code{lriemann}.
1702 @opencatbox{Categories:}
1703 @category{Package ctensor}
1709 @defvr {Variable} uriem
1711 The contravariant Riemann tensor. Computed by @code{uriemann}.
1713 @opencatbox{Categories:}
1714 @category{Package ctensor}
1720 @defvr {Variable} ric
1722 The covariant Ricci-tensor. Computed by @code{ricci}.
1724 @opencatbox{Categories:}
1725 @category{Package ctensor}
1731 @defvr {Variable} uric
1733 The mixed-index Ricci-tensor. Computed by @code{uricci}.
1735 @opencatbox{Categories:}
1736 @category{Package ctensor}
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}
1754 @defvr {Variable} ug
1756 The inverse of the metric tensor. Computed by @code{cmetric}.
1758 @opencatbox{Categories:}
1759 @category{Package ctensor}
1764 @anchor{weyl_variable}
1765 @defvr {Variable} weyl
1767 The Weyl tensor. Computed by @code{weyl}.
1769 @opencatbox{Categories:}
1770 @category{Package ctensor}
1776 @defvr {Variable} fb
1778 Frame bracket coefficients, as computed by @code{frame_bracket}.
1780 @opencatbox{Categories:}
1781 @category{Package ctensor}
1787 @defvr {Variable} kinvariant
1789 The Kretschmann invariant. Computed by @code{rinvariant}.
1791 @opencatbox{Categories:}
1792 @category{Package ctensor}
1798 @defvr {Variable} np
1800 A Newman-Penrose null tetrad. Computed by @code{nptetrad}.
1802 @opencatbox{Categories:}
1803 @category{Package ctensor}
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:
1815 (%i39) trigsimp(np.transpose(npi));
1825 @opencatbox{Categories:}
1826 @category{Package ctensor}
1832 @defvr {Variable} tr
1834 User-supplied rank-3 tensor representing torsion. Used by @code{contortion}.
1836 @opencatbox{Categories:}
1837 @category{Package ctensor}
1842 @defvr {Variable} kt
1844 The contortion tensor, computed from @code{tr} by @code{contortion}.
1846 @opencatbox{Categories:}
1847 @category{Package ctensor}
1852 @defvr {Variable} nm
1854 User-supplied nonmetricity vector. Used by @code{nonmetricity}.
1856 @opencatbox{Categories:}
1857 @category{Package ctensor}
1862 @defvr {Variable} nmc
1864 The nonmetricity coefficients, computed from @code{nm} by @code{nonmetricity}.
1866 @opencatbox{Categories:}
1867 @category{Package ctensor}
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}
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}
1901 @subsection Reserved names
1903 The following names are used internally by the @code{ctensor} package and
1904 should not be redefined:
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()
1922 sermet() Used by csetup() for entering a metric as Taylor-series
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()
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.
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