ctensor


ctensor is a component tensor manipulation package. component tensor manipulation means that geometrical tensor objects are represented as arrays or matrices. tensor operations such as contraction or covariant differentiation are carried out by actually summing over repeated (dummy) indices with do statements. that is, one explicitly performs operations on the appropriate tensor components stored in an array or matrix

to use the ctensor package, type load(ctensor). to begin an interactive session with ctensor , type csetup() . you are first asked to specify the dimension of the manifold. if the dimension is 2, 3 or 4 then the list of coordinates defaults to [x,y], [x,y,z] or [x,y,z,t] respectively. these names may be changed by assigning a new list of coordinates to the variable ct_coords and the user is queried about this. next, the user enters the metric - either directly or from a file by specifying its ordinal position. the metric is stored in the matrix lg. the metric inverse is computed and stored in the matrix ug

when a metric base is used, ctensor can compute the following tensors:

     lg  -- ug
       \      \
        lcs -- mcs -- ric -- uric
                  \      \       \
                   \      tracer - ein -- lein
                    \
                     riem -- lriem -- weyl
                         \
                          uriem
ctensor can also work using moving frames. when cframe_flag is set to true, the following tensors can be calculated:
     lfg -- ufg
         \
     fri -- fr -- lcs -- mcs -- lriem -- ric -- uric
          \                       |  \      \       \
           lg -- ug               |   weyl   tracer - ein -- lein
                                  |\
                                  | riem
                                  |
                                  \uriem

functions

init_ctensor ()
reset package ctensor. it removes all arrays and matrices used by 'ctensor', resets all flags, resets 'dim' to 4, and resets the frame metric to the Lorentz-frame
ct_coordsys (coordinate_system, extra_arg)
ct_coordsys (coordinate_system)
sets up a predefined coordinate system and metric
 symbol               dim coordinates       
--------------------------------------------
 cartesian2d           2  [x,y]             
 polar                 2  [r,phi]           
 elliptic              2  [u,v]             
 confocalelliptic      2  [u,v]             
 bipolar               2  [u,v]             
 parabolic             2  [u,v]             

 cartesian3d           3  [x,y,z]           
 polarcylindrical      3  [r,theta,z]       
 ellipticcylindrical   3  [u,v,z]           
 confocalellipsoidal   3  [u,v,w]           
 bipolarcylindrical    3  [u,v,z]           
 paraboliccylindrical  3  [u,v,z]           
 paraboloidal          3  [u,v,phi]         
 conical               3  [u,v,w]           
 toroidal              3  [phi,u,v]         
 spherical             3  [r,theta,phi]     
 oblatespheroidal      3  [u,v,phi]         
 oblatespheroidalsqrt  3  [u,v,phi]
 prolatespheroidal     3  [u,v,phi]         
 prolatespheroidalsqrt 3  [u,v,phi]
 ellipsoidal           3  [r,theta,phi]     
 
 cartesian4d           4  [x,y,z,t]         
 spherical4d           4  [r,theta,eta,phi] 
 exteriorschwarzschild 4  [t,r,theta,phi]   
 interiorschwarzschild 4  [t,z,u,v]         
 kerr_newman           4  [t,r,theta,phi]   
--------------------------------------------- 
cmetric (dis)
cmetric ()
computes the metric inverse and sets up the package for further calculations
if cframe_flag is false, the function computes the inverse metric ug from the (user-defined) matrix lg. the metric determinant is also computed and stored in the variable gdet. furthermore, the package determines if the metric is diagonal and sets the value of diagmetric accordingly. if the optional argument dis is present and not equal to false, the user is prompted to see the metric inverse
if cframe_flag is true, the function expects that the values of fri (the inverse frame matrix) and lfg (the frame metric) are defined. from these, the frame matrix fr and the inverse frame metric ufg are computed
christof (arg)
computes the Christoffel symbols of both kinds. the arg determines which results are to be immediately displayed
the Christoffel symbols of the first and second kinds are stored in the arrays lcs[i,j,k] and mcs[i,j,k] respectively. if the argument to christof is lcs or mcs then the unique non-zero values of lcs[i,j,k] or mcs[i,j,k], respectively, will be displayed. if the argument is all then the unique non-zero values of lcs[i,j,k] and mcs[i,j,k] will be displayed. if the argument is false then the display of the elements will not occur
scurvature ()
returns the scalar curvature (obtained by contracting the Ricci tensor) of the Riemannian manifold with the given metric
ricci (dis)
ricci computes the covariant (symmetric) components ric[i,j] of the Ricci tensor. if the argument dis is true, then the non-zero components are displayed
uricci (dis)
this function first computes the covariant components ric[i,j] of the Ricci tensor. then the mixed Ricci tensor is computed using the contravariant metric tensor. if the value of the argument dis is true, then these mixed components, uric[i,j] (the index i is covariant and the index j is contravariant), will be displayed directly. otherwise, ricci(false) will simply compute the entries of the array uric[i,j] without displaying the results
einstein (dis)
computes the mixed Einstein tensor after the Christoffel symbols and Ricci tensor have been obtained (with the functions christof and ricci). if the argument dis is true, then the non-zero values of the mixed Einstein tensor ein[i,j] will be displayed where j is the contravariant index. the variable rateinstein will cause the rational simplification on these components. if ratfac is true then the components will also be factored
leinstein (dis)
covariant Einstein-tensor. leinstein stores the values of the covariant Einstein tensor in the array lein. the covariant Einstein-tensor is computed from the mixed Einstein tensor ein by multiplying it with the metric tensor. if the argument dis is true, then the non-zero values of the covariant Einstein tensor are displayed
riemann (dis)
computes the Riemann curvature tensor from the given metric and the corresponding Christoffel symbol
lriemann (dis)
computes the covariant Riemann-tensor as the array lriem. if the argument dis is true, unique non-zero values are displayed
If the variable cframe_flag is true, the covariant Riemann tensor is computed directly from the frame field coefficients. otherwise, the (3,1) Riemann tensor is computed first
uriemann (dis)
computes the contravariant components of the Riemann curvature tensor as array elements uriem[i,j,k,l]. these are displayed if dis is true
weyl (dis)
computes the Weyl conformal tensor. if the argument dis is true, the non-zero components weyl[i,j,k,l] will be displayed to the user. otherwise, these components will simply be computed and stored. if the switch ratweyl is set to true, then the components will be rationally simplified; if ratfac is true then the results will be factored as well
пример вычислений параметров пространства для сферы S³

/*   calculation of params for S³-space    */

kill (all) ;

r[1] : a * sin (theta[3]) ;
r[2] : a * cos (theta[3]) ;
x    : r[1] * cos (theta[1]) ;
y    : r[1] * sin (theta[1]) ;
z    : r[2] * cos (theta[2]) ;
w    : r[2] * sin (theta[2]) ;
X    : [x,y,z,w] ;

g[i,j] := trigsimp (diff (X, theta[i]) . diff (X, theta[j])) ;

lg : genmatrix (g,3,3,1,1) ;
ug : invert (lg) ;

load (ctensor) ;

dim : 3 ;
ct_coords : [theta[1],theta[2],theta[3]] ;

christof (lcs) ;
christof (mcs) ;
ricci (1) ;
riemann (1) ; 
еще один пример

load (ctensor) ; 

ct_coordsys ([ r*cos(theta)*cos(phi)
             , r*cos(theta)*sin(phi)
             , r*sin(theta)
             , [r,theta,phi]
             ]) ; 
lg:trigsimp (lg) ; 
ct_coords ; 
dim ; 

и еще один

load (ctensor) $ 

depends ([a, b], [t, r]) $ 
ct_coords : [t, r, A, P] $

lg : ident (4) $
lg[1,1] : - exp (2 * a) $ 
lg[2,2] : exp (2 * b) $ 
lg[3,3] : r^2 $ 
lg[4,4] : r^2 * sin(A)^2 $

cmetric() $ ug $ 

christof (mcs) ; christof (lcs)