Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1993
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1993

[Date Index] [Thread Index] [Author Index]

Search the Archive

MathTensor - New Version

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: MathTensor - New Version
  • From: Steven M. Christensen <stevec at yoda.physics.unc.edu>
  • Date: Tue, 5 Jan 93 13:07:19 EST

*********************************************************
*         NEW VERSION OF MATHTENSOR RELEASED            *
*             ACADEMIC DISCOUNTS EXTENDED               *
*********************************************************

MathSolutions, Inc. is pleased to announce the release of
MathTensor version 2.1.5.  In addition, special academic discounts
are being extended into 1993.

Included with the new release is a supplement to the manual.

For more information, contact MathSolutions at mathtensor at wri.com or
at:

MathSolutions, Inc.
PO Box 16175
Chapel Hill, NC 27516 USA
Phone/Fax: 919-967-9853

New to this version are:

****************
*  Ttransform  *
****************

Ttransform is an easy-to-use function for performing general coordinate
transformations on tensorial objects.  Here is an example from
gravitational physics:

Example: General Relativity --- Kruskal coordinates

Transform the Schwarzschild metric of a black hole from
Schwarzschild to Kruskal coordinates. This transformation
does not involve the angular coordinates, so it is sufficient
to work in a two dimensional spacetime. In Schwarzschild
coordinates r, t, the Schwarzschild line element is

ds^2 = (1-(2 M)/r)^(-1) dr^2 - (1-(2 M)/r)) dt^2 .

Kruskal gave the transformation

X = (r/(2 M)-1)^(1/2) exp[r/(4 M)] cosh[t/(4 M)]

T = (r/(2 M)-1)^(1/2) exp[r/ 4 M)] sinh[t/(4 M)]

to Kruskal coordinates X, T. Use Ttransform to calculate
the form of the metric tensor in Kruskal coordinates.

(* Clear any previous assignments. *)

In[2]:= Clear[ga,gb]

(* Define the dimension. *)

In[3]:= Dimension = 2

Out[3]= 2

(* Define the coordinates. *)

In[4]:= coords = {r,t}

Out[4]= {r, t}

(* Define the transformations giving the kruskal coordinates {X,T} in
terms of {r,t}. *)

In[5]:= trans = {(r/(2 M) - 1)^(1/2) Exp[r/(4 M)] Cosh[t/(4 M)],
(r/(2 M) - 1)^(1/2) Exp[r/(4 M)] Sinh[t/(4 M)]}

          r/(4 M)            r         t     r/(4 M)            r         t
Out[5]= {E        Sqrt[-1 + ---] Cosh[---], E        Sqrt[-1 + ---] Sinh[---]}
                            2 M       4 M                      2 M       4 M

(* Let ga[la,lb] be the Schwarzschild metric for r,t.
The independent covariant components of the metric are assigned below. *)

In[6]:= DefineTensor[ga,{{2,1},1}]

(* Set -2, -2 component. *)

In[7]:= ga[-2,-2] = -(1 - (2 M)/r)

             2 M
Out[7]= -1 + ---
              r

(* Set -2, -1 component. *)

In[8]:= ga[-2,-1] = 0

Out[8]= 0

(* Set -1, -1 component. *)

In[9]:= ga[-1,-1] = (1 - (2 M)/r)^(-1)

           1
Out[9]= -------
            2 M
        1 - ---
             r

(* gb will denote the transformed metric. *)

In[10]:= DefineTensor[gb,{{2,1},1}]

Calculate gb from ga.

The transformation of coordinates and metric are in the same
direction, from Schwarzschild to Kruskal, so the last argument 
of Ttransform is 1.

The metric components of gb[la,lb] refer to the Kruskal coordinates
X, T, but they will appear as functions of r, t, since ga[la,lb]
and the right-hand-sides of the transformation equations are
given as functions of r, t. In fact, that is the usual way that
the Kruskal metric is written, since r and t cannot be expressed
in a simple algebraic form in terms of X, T.

In[11]:= Ttransform[gb,ga[la,lb],coords,trans,1]
Components assigned to gb

(* Display the result. *)

In[12]:= Table[gb[-i,-j],{i,2},{j,2}]

                  3                  3
              32 M              -32 M
Out[12]= {{----------, 0}, {0, ----------}}
             r/(2 M)             r/(2 M)
            E        r          E        r

This result means that the line element in Kruskal coordinates 
has the well-known form,

ds^2 = 32 M^3 r^(-1) Exp[-r/(2 M)] (dX^2 - dT^2).


**********************
*      OrderCD       *
**********************

In previous versions of MathTensor there has been only one function
that could be used to reorder covariant derivatives on a tensor
object, CommuteCD.  A number of users of MathTensor have asked
for a function that will reorder all the indices into alphabetical
order at once.  The new OrderCD function does this. 

(* Define a two index tensor. *)

In[2]:= DefineTensor[A,"A",{{1,2},1}]

(* Take several covariant derivatives.  In this case they are
not in alphabetical order. *)

In[3]:= CD[A[la,lb],lf,le,ld,lc]

Out[3]= A
         ab;fedc

(* The OrderCD function reorders the covariant derivatives and
generates the appropriate Riemann tensor terms.  This expression is
still equal to A       , but now contains A       .  All derivatives
                ab;fedc                    ab;cdef
on all terms are put in alphabetical order as well. *)

In[4]:= OrderCD[%]

                p               p               p               p
Out[4]= A     R       + A     R       + A     R       + A     R       + 
         pb;f  a cd;e    pb;e  a cd;f    pb;d  a ce;f    pb;f  a de;c
 
             p               p               p               p
>    A     R       + A     R       + A     R       + A     R       + 
      pb;c  a de;f    pb;e  a df;c    pb;d  a ef;c    pb;c  a ef;d
 
             p               p               p               p
>    A     R       + A     R       + A     R       + A     R       + 
      ap;f  b cd;e    ap;e  b cd;f    ap;d  b ce;f    ap;f  b de;c
 
             p               p               p               p
>    A     R       + A     R       + A     R       + A     R       + 
      ap;c  b de;f    ap;e  b df;c    ap;d  b ef;c    ap;c  b ef;d
 
               p               p           p              p
>    A     R       + A     R       + A   R        + A   R        + 
      ab;p  ced ;f    ab;p  dfe ;c    pb  a cd;ef    pb  a de;cf
 
           p              p              p              p
>    A   R        + A   R        + A   R        + A   R        + A        + 
      pb  a ef;cd    ap  b cd;ef    ap  b de;cf    ap  b ef;cd    ab;cdef
 
              p              p              p              p
>    A      R     + A      R     + A      R     + A      R     + 
      pb;ef  a cd    pb;df  a ce    pb;de  a cf    pb;cf  a de
 
              p              p              p              p
>    A      R     + A      R     + A      R     + A      R     + 
      pb;ce  a df    pb;cd  a ef    ap;ef  b cd    ap;df  b ce
 
              p              p              p              p
>    A      R     + A      R     + A      R     + A      R     + 
      ap;de  b cf    ap;cf  b de    ap;ce  b df    ap;cd  b ef
 
           p     q           p     q           p     q           p     q
>    A   R     R     + A   R     R     + A   R     R     + A   R     R     + 
      pq  a ef  b cd    pq  a df  b ce    pq  a ce  b df    pq  a cd  b ef
 
             p     q           p     q           p     q           p     q
>    A   R     R     + A   R     R     - A   R     R     - A   R     R     + 
      pb  qfa   cde     ap  qfb   cde     pb  qea   cdf     ap  qeb   cdf
 
                p                pq                pq              p
>    A      R     + A   R     R     + A   R     R     + A      R     + 
      ab;pf  ced     pb  qadf  ce      ap  qbdf  ce      ab;pe  cfd
 
                p           p     q           p     q              p
>    A      R     + A   R     R     + A   R     R     + A      R     + 
      ab;pd  cfe     pb  qda   cfe     ap  qdb   cfe     ab;pc  dfe
 
                  pq                pq
>    A   R     R     + A   R     R
      pb  qacd  ef      ap  qbcd  ef


**********************
*     Components     *
**********************

The Components function is used to compute the components of the
Riemann tensor, Ricci tensor, Einstein tensor, affine connection, and
Weyl tensor given the spacetime dimension and metric tensor.  The
latest version of Components permits you to set up the simplification
rules you want to use to put the results of Components into the desired
form.  You can also treat metrics having a small parameter
perturbatively by series expansion.

As a simple example, we consider perturbations of flat spacetime using
the series expansion feature of Components to perturb about a given
metric.  For a perfectly general perturbation it is probably simpler to
work with symbolic indices within a MathTensor session. But for more
special perturbations, it is convenient to use Components. In this
example, the most general purely time-dependent perturbation about flat
spacetime is considered in the linear approximation. The coordinates
are called x1, x2, x3, and t. The ten components of the perturbation of
the symmetric metric tensor  are called h11[t], h21[t], h31[t], h41[t],
h22[t], h32[t], h42[t], h33[t], h43[t], h44[t]. They are taken to
depend only on the time coordinate t. The definition of CompSimp, which
determines the simplification and other operations done by the
Components function, expands to first order in a small parameter q
which is introduced as a factor in each perturbation term of the
metric. Here is the input file, which is called exIn.m.

(* exIn.m *)

Dimension = 4

x/: x[1] = x1
x/: x[2] = x2
x/: x[3] = x3
x/: x[4] = t

Metricg/: Metricg[-1, -1] = 1 + q h11[t]
Metricg/: Metricg[-2, -1] = q h21[t]
Metricg/: Metricg[-3, -1] = q h31[t]
Metricg/: Metricg[-4, -1] = q h41[t]
Metricg/: Metricg[-2, -2] = 1 + q h22[t]
Metricg/: Metricg[-3, -2] = q h32[t] 
Metricg/: Metricg[-4, -2] = q h41[t]
Metricg/: Metricg[-3, -3] = 1 + q h33[t]
Metricg/: Metricg[-4, -3] = q h43[t]
Metricg/: Metricg[-4, -4] = -1 + q h44[t]

Rmsign = 1
Rcsign = 1

CalcEinstein = 1 
CalcRiemann = 1 
CalcWeyl = 1 

CompSimpRules[1] = {} 
SetOptions[Expand, Trig->True]
SetOptions[Together, Trig->True]
CompSimp[a_] := Together[Series[Expand[a/.CompSimpRules[1]], {q,0,1}]]

(* end of file *)

Suppose that in a Mathematica session you have loaded Components.m
and issued the command Components["exIn.m","exOut.m","exOut.out"]
to produce the file exOut.m suitable for input to a later MathTensor 
session, and the file exOut.out with output in a more human
readable form. Here is an example MathTensor session which displays
and manipulates the calculated tensor components.

(* Load the output of the Components computation above. *)

In[1]:= << exOut.m
MetricgFlag has been turned off.

(* Display the independent Ricci tensor components. *)

In[2]:= Simplify[Table[RicciR[-i,-j],{i,4},{j,i}] ]

          h11''[t] q       2
Out[2]= {{---------- + O[q] }, 
              2
 
   h21''[t] q       2  h22''[t] q       2
  {---------- + O[q] , ---------- + O[q] }, 
       2                   2
 
   h31''[t] q       2  h32''[t] q       2
  {---------- + O[q] , ---------- + O[q] , 
       2                   2
 
   h33''[t] q       2
   ---------- + O[q] }, 
       2
 
       2      2      2
  {O[q] , O[q] , O[q] , 
 
   (-h11''[t] - h22''[t] - h33''[t]) q       2
   ----------------------------------- + O[q] }}
                    2

(* Here is the scalar curvature invariant. *)

In[3]:= ScalarR

                                                 2
Out[3]= (h11''[t] + h22''[t] + h33''[t]) q + O[q]

(* Here are three components of the Riemann tensor, namely,
R_{1212}, R_{2323}, and R_{3434}. *)

In[4]:= Simplify[Table[RiemannR[-i,-i-1,-i,-i-1],{i,1,3}] ] 

             2      2  -(h33''[t] q)       2
Out[4]= {O[q] , O[q] , ------------- + O[q] }
                             2

(* Here is the invariant square of the Ricci tensor. *)

In[5]:= MakeSum[RicciR[la,lb] RicciR[ua,ub] ]

                 2           2           2           2
         h11''[t]    h21''[t]    h22''[t]    h31''[t]
Out[5]= (--------- + --------- + --------- + --------- + 
             4           2           4           2
 
             2
     h32''[t]     -h11''[t]   h22''[t]   h33''[t] 2
     --------- + (--------- - -------- - --------)  + 
         2            2          2          2
 
             2
     h33''[t]    2       3
     ---------) q  + O[q]
         4

>From the displayed components of the Ricci tensor, it is clear that
in vacuum, where all the components of the Ricci tensor must vanish,
there is no purely time-dependent perturbation of Minkowski 
space which is zero at early times and non-zero at later times. 
On the other hand, there are non-zero vacuum perturbations 
which are linear in t, but these are not physical.

*********************
*  Faster Loading   *
*********************

On some computers with low memory or slow disks, MathTensor can be slow
to load.  In version 2.1.5, a special loading file called
MathTensorFast.m has been added.  This loads a smaller version of
MathTensor which initially with contains fewer functions.  If a
function is needed that is not loaded by MathTensorFast.m, it is loaded
when used the first time.  This system has shown a speedup in loading
of about 40% on most computers.


*****************************************
* PairSymmetrize and PairAntisymmetrize *
*****************************************

The standard MathTensor Symmetrize and Antisymmetrize functions permit
symmetrization over a list of indices as in the following examples.

(* Define some arbitrary four index tensor. *)

In[2]:= DefineTensor[A,"A",{{1,2,3,4},1}]

(* With the usual Symmetrize or Antisymmetrize functions,
you can symmetrize over two indices. *)

In[3]:= Symmetrize[A[la,lb,lc,ld],{la,lc}]

        A     + A
         abcd    cbad
Out[3]= -------------
              2

(* You can also symmetrize or antisymmetrize over a list of indices. *)

In[4]:= Symmetrize[A[la,lb,lc,ld],{la,lb,lc,ld}]

        A       A       A       A       A       A       A       A
         abcd    abdc    acbd    acdb    adbc    adcb    bacd    badc
Out[4]= ----- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + 
         24      24      24      24      24      24      24      24
 
     A       A       A       A       A       A       A       A       A
      bcad    bcda    bdac    bdca    cabd    cadb    cbad    cbda    cdab
>    ----- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ----- + 
      24      24      24      24      24      24      24      24      24
 
     A       A       A       A       A       A       A
      cdba    dabc    dacb    dbac    dbca    dcab    dcba
>    ----- + ----- + ----- + ----- + ----- + ----- + -----
      24      24      24      24      24      24      24

(* With PairSymmetrize you can manipulate pairs of indices.
The resulting expression is symmetric under interchange of
the index pair {a,b} with the pair {c,d}. *)

In[5]:= PairSymmetrize[A[la,lb,lc,ld],{{la,lb},{lc,ld}}]

        A       A
         abcd    cdab
Out[5]= ----- + -----
          2       2

(* PairAntisymmetrize does the expected thing. *)

In[6]:= PairAntisymmetrize[A[la,lb,lc,ld],{{la,lb},{lc,ld}}]

        A       A
         abcd    cdab
Out[6]= ----- - -----
          2       2

(* Define a new six index tensor. *)

In[7]:= DefineTensor[B,"B",{{1,2,3,4,5,6},1}]

(* You can manipulate more than one pair of indices.  The resulting
expression is antisymmetric under interchange of any of the indicated
pairs of indices with each other, such as exchange of the pair {a,b}
with either of the other two pairs, {c,d} or {e,f}. *)

In[8]:= PairAntisymmetrize[B[la,lb,lc,ld,le,lf],{{la,lb},{lc,ld},{le,lf}}]

        B         B         B         B         B         B
         abcdef    abefcd    cdabef    cdefab    efabcd    efcdab
Out[8]= ------- - ------- - ------- + ------- + ------- - -------
           6         6         6         6         6         6

(* These new functions can also work on triples and other sets
of indices. *)

In[9]:= PairSymmetrize[B[la,lb,lc,ld,le,lf],{{la,lb,lc},{ld,le,lf}}]

        B         B
         abcdef    defabc
Out[9]= ------- + -------
           2         2


***********************
*     Bug Fixes       *
***********************

All known MathTensor problems have been fixed in 2.1.5.






  • Next by Date: Choosing branch cuts for elementary function
  • Next by thread: Choosing branch cuts for elementary function