Mathematica 9 is now available
Services & Resources / Wolfram Forums
MathGroup Archive
*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 Information (Long)

  • To: mathgroup at
  • Subject: MathTensor Information (Long)
  • From: Steven M. Christensen <stevec>
  • Date: Mon, 28 Jun 93 02:43:17 EDT

Following is my periodic posting of information about
MathTensor.  Thanks go to members of MathGroup who
have passed this information onto interested colleagues.

Steve Christensen


 MathTensor(tm)    Information Sheet (Retail Pricing)


   Prices Valid After June 15, 1993.

MathSolutions offers discounts to academic institutions
inside and outside the USA, dealers, and students.
Contact MathSolutions for rates.

See the end of this email for functionality new to
version 2.1.5.


Hardware Requirements:
MathTensor requires approximately 2 megabytes of disk space.
It is recommended that a workstation have at least 8 megabytes
of RAM memory.  The Macintosh version runs on machines with
8 megabytes or more.  DOS versions require at least 5 megabytes
of memory, but more is highly recommended.  The Windows 3.x version
works with 8 megabytes of RAM or more.

Software Requirements:
MathTensor requires Mathematica 1.2, 2.0, or greater. 

MathSolutions, Inc.
P.O. Box 16175
Chapel Hill, NC 27516
Telephone/Answering Machine/FAX:  919-967-9853
Email: mathtensor at

* MathTensor Product Price List: 

(Prices include media/manual/shipping via first class mail,
Upgrade contracts provide upgrades to MathTensor for one
year - a minimum of two upgrades - from date of shipment.)


No Upgrade           $550.00 
With Upgrade         $700.00    

Single Processor Workstations:

No Upgrade           $800.00 
With Upgrade        $1000.00

Convex/Multi-Processor Servers 

No Upgrade          $3000.00  
With Upgrade        $4000.00

Extra Manuals: $30.00     Federal Express Delivery add: $15.00 (in US)
                                                        $50.00 (outside US)

Upgrades and updates are only sent to users with Upgrade Contracts.
Volume discounts available.

Consulting contracts for MathTensor and Mathematica users
are also available.

** North Carolina residents add 6% sales tax
** Purchase orders are accepted.  
** Payment terms - NET 15
** Prices, availability and details of functionality of any products
or services mentioned on this page are subject to change without notice. 
** No credit card or letter of credit order

MathTensor is available in 1/4" tape (QIC-24) tar format, MS-DOS 3.5" floppies,
Macintosh 800K floppies, and Sun 3.5" bar format floppies.  Other formats
will be made available as needed but may require more time for shipment.

Copy Protection:
MathTensor, like Mathematica, requires a password on UNIX machines. This 
password must be obtained from MathSolutions, Inc.

Leonard Parker, Ph.D. and Steven M. Christensen, Ph.D.,
founders of MathSolutions, Inc.

-------------------- Order Form Cut Here  ---------------------------------

 MathTensor 2.1.5 Ordering Information (June 15, 1993)
	                                                  Price Number 	Total
o Personal Computers	
[ ] Macintosh (without upgrade, 800K 3.5" floppies)       $550	_____   _______

[ ] Macintosh (with upgrade, 800K 3.5" floppies)	  $700	_____	_______

[ ] DOS/Windows (without upgrade, 1.44 Meg 3.5" floppies) $550	_____	_______

[ ] DOS/Windows (with upgrade, 1.44 Meg 3.5" floppies)	  $700	_____	_______

o Single Processor Workstations**

[ ] NeXT Workstation (without upgrade, 1.44 Meg 3.5" DOS floppies)
							  $800	_____	_______

[ ] NeXT Workstation (with upgrade, 1.44 Meg 3.5" DOS floppies)
                     	                                 $1000	_____	_______
[ ] Sun Sparcstation (without upgrade, 3.5" Sun bar floppies)
	                                                  $800	_____	_______
[ ] Sun Sparcstation (with upgrade, 3.5" Sun bar floppies)
                    	                                 $1000	_____	_______
[ ] UNIX Workstation (without upgrade, 1/4" QIC-24 tar tape)
                 	                                  $800	_____	_______

[ ] UNIX Workstation (with upgrade, 1/4" QIC-24 tar tape)
               	                                         $1000	_____	_______
[ ] UNIX Workstation (without upgrade, 1/4" QIC-150 tar tape)
	                                                  $800	_____	_______

[ ] UNIX Workstation (with upgrade, 1/4" QIC-150 tar tape)
	                                                 $1000	_____	_______

Specify UNIX Workstation Type _______________________________

[ ] VMS Workstation (without upgrade, 1/4" QIC-24 tar tape)
	                                                  $800	_____	_______

[ ] VMS Workstation (with upgrade, 1/4" QIC-24 tar tape)
                                                         $1000	_____	_______

Give the Mathematica $MachineID by typing $MachineID
while in Mathematica __________________________

If your workstation for MathTensor does not have a $MachineID
(usually if you have a network license), type hostid at the UNIX
or VMS prompt and enter it here ______________________

o Convex/Multiprocessor Servers**

[ ] Convex (without upgrade, 1/4" QIC-24 tar tape)	$3000	_____	_______

[ ] Convex (with upgrade, 1/4" QIC-24 tar tape)	        $4000	_____	_______

[ ] Multiprocessor Server (without upgrade, 1/4" QIC-24 tar tape)
	                                                $3000	_____	_______

[ ] Multiprocessor Server (with upgrade, 1/4" QIC-24 tar tape)
 	                                                $4000	_____	_______

Specify Machine Type _______________________________

Give the Mathematica $MachineID by typing $MachineID
while in Mathematica __________________________

If your workstation for MathTensor does not have a $MachineID
(usually if you have a network license), type hostid at the UNIX
prompt and enter it here ______________________

[ ] Extra Manuals	                                 $30  _____     _______

[ ] Federal Express Delivery
(give shipping address and phone number)         $15 (US)               _______

                                                 $50 (Outside US)       _______

Subtotal                                                                _______
North Carolina residents add 6% sales tax                               _______

Order Total (Send PO or check in US Dollars) 
allow 4 weeks for delivery, no credit card orders, terms NET 15)		  	                                                                _______

All prices include shipping and one manual. Prices are subject to
change without notice.  

Upgrade gives the purchaser one year of MathTensor updates (minimum of 2).

** If your computer is on the Internet, it is also possible for us to
do a remote installation.  Contact MSI.

o Shipping Information:

Name: ________________________________________________

Address: __________________________________________________________


City: ___________________________  State: _________________________

Postal/Zip Code: __________________  Country: _____________________

PO Number __________________________

Telephone:  ________________________________

Fax: ________________________________

Email: ________________________________________

--------------------- End of Order Form ----------------------------------

Some of the users of MathTensor can be found at:

Wake Forest University
The University of Maryland
Insituto de Fisica Fundamental - Madrid, Spain
City College of New York
The University of Winnipeg -Canada
Stanford University
The University of California - Santa Barbara
Texas A&M University
The University of North Carolina - Chapel Hill
Universitat Konstanz - Germany
Schlumberger KK - Japan
Sumitomo Corporation - Japan
Oakland University
Louisiana Tech University
Lawrence Livermore Labs
Los Alamos Labs
The University of New Brunswick -Canada
United Technologies Research Center
Universitat Hannover - Germany
Reed College
Yale University
The University of Bergen - Norway
Cotton, Inc.
NASA - Langley
NASA - Goddard
National Center for Supercomputing Applications
Wolfram Research
The University of Wisconsin - Milwaukee
The Hebrew University of Jerusalem -Israel
Martin Marietta
Cornell University
Central Connecticut State University 
Universite de Liege - Belgium
Pune University - India
Cal State University - Fullerton
Queen's University - Canada
Utah State University
Southwestern University - Texas
University of South Florida
Deutsches Klimarenzentrum - Hamburg, Germany
University of Oklahoma - Norman
Montana State University
University of Chicago
University of Milan - Italy
Wellesley College
University of San Francisco
University of Cologne - Germany
University of California - San Diego
University of Berne - Switzerland
University d. Bundeswehr - Hamburg, Germany
University of Thessaloniki - Greece
University of California - San Diego
Royal Insitute of Technology (KTH) - Sweden
Univeritat d. Bundeswehr - Hamburg
University of Cologne - German
Hamamatsu Photonics - Japan
Linkoeping University - Sweden
University of Washington - Seattle
University of Cincinnati
W.R. Grace, Co.
Aberdeen Proving Ground
Nissin-High Voltage Co, Ltd. - Japan
Ibaraki University - Japan
University of California - Berkeley
Austin College
Mercyhurst College
Universidad De Puerto Rico
Unviversity of Alberta
University of Oregon
NeXT Computer Corporation
Queen's University - Canada
Tokyo Institute of Technology - Japan
Univ. Autonoma Metropolitana - Mexico
S3IS - France
PICA Software - Australia
RITME Informatique - France
Mount Sinai Hospital - New York
IVIC - Venezuela
Carnegie Mellon University
Choong Puk National University - Korea
Microsoft, Inc.
University of Texas - Austin
General Tire

and many others .......

MathTensor has been mentioned in articles in MacWorld, the
Mathematica Journal, Computers In Physics, Science, and PC Magazine.

"The idea of packages and special tools has been taken to
a kind of modern limit in the form of MathTensor, a tensor-
analysis package built on Mathematica." - Richard Crandall,
Howard Vollum Professor of Science, Reed College and Chief Scientist,
NeXT Computer, Inc., from Computers in Physics, Nov/Dec 1991.

"I would like to take this opportunity to tell you how pleased
I have been with MathTensor.  I have been using it to study
higher-dimensional cosmological solutions of Einstein's Equations.
It has been an indispensable tool for me.  You have done a great
job." - Dwight Vincent, University of Winnipeg - Canada, Feb 1992.

"Regarding my comments on MathTensor, you can be assured that they were 
coming out of my heart, and that they are TRUE. Yes, it is a very nice and 
useful tool. Many people, like myself, who are getting older and loosing the
patience (and in some cases the ability to do long tedious computations) to
deal with the "nitty gritty" of things can find here REAL HELP. Also, for those
of us who are daring and curious it opens up a door to tackle problems that
we otherwise wouldn't."  Juan Perez Mercader, Insituto de Fisica Fundamental -
Madrid, Spain, Feb 1992.

"MathTensor is an outstanding package for doing tensor
calculus.  Best of all is the support.  Questions receive
an immediate reply by email from both Leonard and Steve,
including advice which frequently goes far beyond the
original point.  Part of the MathTensor package is the
continuing insight of two researchers who use this mathematics
as their tool." - George Ruppeiner, Associate Professor of Physics,
University of South Florida, Sept 1992.

-----------------------General Information--------------------------


Tensor analysis is extensively used in applications in physics,
mathematics, engineering, and many other areas of scientific research.
Problems involving tensors often are extraordinarily large and can be
some of the most difficult computations in all of science. Equations
with thousands of terms are common and can only be manipulated by
computer mathematics systems like Mathematica.

MathTensor is the largest Mathematica package yet developed outside of
Wolfram Research. It adds over 250 new functions and objects to
Mathematica to give the user both elementary and advanced tensor
analysis functionality. MathTensor is a general tool for handling both
indicial and concrete tensor indices. Standard objects like Riemann
tensor, Ricci tensor, metric and others are built into the system along
with common functions like the covariant derivative, index commutation,
raising and lowering of indices, and various differential forms

MathTensor has been under development by Leonard Parker and Steven M.
Christensen since the first alpha test release of Mathematica. It
contains over 25,000 lines of Mathematica code contained in nearly 100
files totalling approximately 2.0 Megabytes of disk space. MathTensor
will run on any machine that runs Mathematica and has sufficient RAM
memory (generally 8 Megabytes or more) and disk space for file storage
and swap. MathTensor runs under versions 1.2 and 2.X of Mathematica.

MathSolutions, Inc. was formed by Leonard Parker and Steven M.
Christensen. MathSolutions has its office in Chapel Hill, North
Carolina. Both Parker and Christensen are theoretical physicists,
specializing in research in Einstein's Special and General Theory of
Relativity, quantum field theory, black hole theory, and cosmology.
Christensen is a Contributing Editor to the Mathematica Journal and
is the founder and Moderator of the MathGroup, Mathematica mailing

Parker obtained his Ph.D. in Physics from Harvard University and
Christensen his Ph.D. in Physics from the University of Texas at Austin.

MathTensor is a trademark of MathSolutions, Inc.  Mathematica is a
registered trademark of Wolfram Research, Inc.

----------------------MathTensor Examples ----------------------------

MathTensor provides commands for simplifying and manipulating tensor
expressions, as well as a knowledge base of transformation rules and 
definitions required for dealing with some of the more important tensors.
MathTensor is designed to work along with the functions of Mathematica
to provide users with the functions and objects they need to devise
their own custom tensor analysis programs.  MathTensor provides most
of the basic structures needed for doing tensor computations and for
programming new functions.  As MathTensor is used and special applications
are developed, they will be added to future versions of MathTensor.
The following pages give a few very elementary examples of how MathTensor

(* First, after starting Mathematica 2.X, we load a file which
in turn loads many other files containing the MathTensor function
and object definitions. *)

In[1]:= <<MathTensor.m

MathTensor (TM) 2.1.5 (UNIX (R)) (January 1, 1993)
by Leonard Parker and Steven M. Christensen
Copyright (c) 1991-1993 MathSolutions, Inc.
Runs with Mathematica (R) Versions 1.2, 2.0, or 2.1
Licensed to machine sunny.
No unit system is chosen. If you want one,
you must edit the file called Conventions.m,
or enter a command to interactively set units.
Units: {}
Sign conventions: Rmsign = 1 Rcsign = 1
MetricgSign = 1 DetgSign = -1
TensorForm turned on,
ShowTime turned off,
MetricgFlag = True.

(* MathTensor has a number of tensors already
defined.  Lower indices are entered with an "l" in
front, while upper indices are entered with a "u"
in front.  In output lines the indices are placed where
they should be on the tensor. *)

In[2]:= RiemannR[la,lb,lc,ld]

Out[2]= R

In[3]:= RiemannR[la,ub,lc,ud]

          b d
Out[3]= R
         a c

(* Operations like covariant differentiation are done simply
with the CD function, with the derivative index placed after
the tensor. *)

In[4]:= CD[RicciR[la,lb],uc]

Out[4]= R

(* The standard summation convention is recognized. Here
indices are summed using the standard Mathematica substitution
operation which in the case below simply renames the upper index. *)

In[5]:= % /. uc->ub

Out[5]= R

(* The DefineTensor function permits you to define your own
tensors. The input name of the object defined below is "tensor", and
its print name, which appears in output lines, is "t". The last argument
indicates that it will have two indices, which upon interchange result
in multiplication of the object by a weight factor of 1 -- that is, 
it is a symmetric tensor. *)

In[6]:= DefineTensor[tensor,"t",{{2,1},1}]

PermWeight::sym: Symmetries of t assigned
PermWeight::def: Object t defined

In[7]:= tensor[la,lb]

Out[7]= t

(* MathTensor now automatically reorders symmetric
indices into lexical order. *)

In[8]:= tensor[lb,la]

Out[8]= t

(* The standard symmetries of the Riemann tensor are built into
its definition. *)

In[9]:= RiemannR[lb,la,lc,ld]

Out[9]= -R

In[10]:= RiemannR[lc,ld,la,lb]

Out[10]= R

(* MathTensor knows that the appropriate sum of indices on the
Riemann tensor gives the Ricci tensor. *)

In[11]:= RiemannR[la,lb,ua,lc]

Out[11]= R
(* The sum of the indices on the Ricci tensor gives the Riemann
Scalar. *)

In[12]:= RicciR[la,ua]

Out[12]= R
(* Now we define a new tensor with four indices and no symmetries. *)

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

PermWeight::sym: Symmetries of T assigned
PermWeight::def: Object T defined

(* We produce a complicated product of seven of these tensor with multiple
summations of indices and then add it to another similar object. *)

In[14]:= SevenTensorTest := T[la,lb,uc,ud] T[lc,ld,ue,uf] T[le,lf,ug,uh]
 T[lg,li,ui,uj] * T[lh,lj,uk,ul] T[lk,ll,um,un] T[lm,ln,ua,ub] -
 T[la,lb,uc,ud] T[lc,le,ue,uf] * T[ld,lf,ug,uh] T[lg,lh,ui,uj] T[li,lj,uk,ul]
 T[lk,ll,um,un] T[lm,ln,ua,ub]

(* Trying to find some simplification of SevenTensorTest is not
easy by hand. *)

In[15]:= SevenTensorTest

            cd    ef    gh    ij    kl    mn    ab
Out[15]= T     T     T     T     T     T     T     - 
          ab    cd    ef    gi    hj    kl    mn
        cd    ef    gh    ij    kl    mn    ab
>    T     T     T     T     T     T     T
      ab    ce    df    gh    ij    kl    mn

(* But the MathTensor command Tsimplify rapidly finds that the two terms are
equal. *)

In[16]:= Tsimplify[%]

Out[16]= 0

(* Some terms differ only by the renaming of summation indices. *)

In[17]:= T[la,lb,lc,ld] RiemannR[ua,ub,uc,ud] +
 T[le,lf,lg,lh] RiemannR[ue,uf,ug,uh]

          abcd          efgh
Out[17]= R     T     + R     T
                abcd          efgh

(* MathTensor's canonicalization functions can rename indices and
combine terms.  *)

In[18]:= Canonicalize[%]

Out[18]= 2 R     T

(* MathTensor can symmetrize or antisymmetrize pairs of indices. *)

In[19]:= Symmetrize[T[la,lb,lc,ld], {la,lb}]

         T     + T
          abcd    bacd
Out[19]= -------------

In[20]:= Expand[%]

         T       T
          abcd    bacd
Out[20]= ----- + -----
           2       2

In[21]:= Antisymmetrize[%,{lc,ld}]

         T       T       T       T
          abcd    abdc    bacd    badc
         ----- - ----- + ----- - -----
           2       2       2       2
Out[21]= -----------------------------

In[22]:= Expand[%]

         T       T       T       T
          abcd    abdc    bacd    badc
Out[22]= ----- - ----- + ----- - -----
           4       4       4       4

(* MathTensor understands how to convert covariant to ordinary
partial derivatives with affine connection terms added. *)

In[23]:= CD[RicciR[la,lb],lc]

Out[23]= R

In[24]:= CDtoOD[%]

                  p          p
Out[24]= R     - G    R   - G    R
          ab,c     bc  pa     ac  pb

(* Using positive and negative index values, MathTensor can
deal with concrete contravariant or covariant indices. *)

In[25]:= RiemannR[1,2,3,4]

Out[25]= R

In[26]:= RiemannR[-1,2,-3,4]

           4 2
Out[26]= R
          3 1

(* We can set the dimension of the spacetime to some value, like 4. *)

In[27]:= Dimension = 4

Out[27]= 4

(* Then using the MakeSum function, we can explicitly write out
sums in terms of concrete indices. *)

In[28]:= MakeSum[RicciR[la,lb] RicciR[lc,ub]]

              1         2         3         4
Out[28]= R   R   + R   R   + R   R   + R   R
          1a   c    2a   c    3a   c    4a   c

(* Now we define tensor T with two indices that are symmetric. *)

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

PermWeight::sym: Symmetries of T assigned
PermWeight::def: Object T defined

(* Then the lower components of T can be defined in terms of 
the components of other tensors like the Ricci tensor. *)

In[30]:= SetComponents[T[la,lb],RicciR[la,lc] RicciR[lb,uc]]
Components assigned to T

(* We can ask for a specific covariant component of T. *)

In[31]:= T[-1,-1]

               1         2         3         4
Out[31]= R   R   + R   R   + R   R   + R   R
          11  1     21  1     31  1     41  1

(* One example application built into MathTensor does variations
with respect to the metric tensor of structures that are functions
of the metric tensor, Metricg.   The variation of the square root
of the determinant of the metric times the Riemann scalar gives
terms in the variation of the metric, called h. *)

In[32]:= Sqrt[Detg] ScalarR

Out[32]= Sqrt[g] R

In[33]:= Variation[%,Metricg]

   MetricgFlag is turned off by this operation

                    pq             p  q
Out33]= Sqrt[g] h      - Sqrt[g] h      + 
                 pq;              p ;q
  Sqrt[g] R g   h
                 pq                pq
  ----------------- - Sqrt[g] R   h
          2                    pq
(* A more complicated variation is just as easily found. *)

In[34]:= Sqrt[Detg] RicciR[la,lb] RicciR[ua,ub]

Out[34]= Sqrt[g] R   R

In[35]:= Variation[%,Metricg]

                    pq  r
         -(Sqrt[g] h      R  )
                      ;r   pq              p  rq
Out[35]=  --------------------- + Sqrt[g] h      R   - 
                   2                        q;    pr
            p qr                    r  pq
  Sqrt[g] h      R     Sqrt[g] h      R
           p ;    qr            pq;r
  ------------------ - ------------------ + 
          2                    2
                                 p     qr
                       Sqrt[g] h      R
               q  pr            p ;qr
  Sqrt[g] h      R   - ------------------ + 
           pq;r                2
           pq      rs
  Sqrt[g] g   R   R   h
               rs      pq                qr  p
  ----------------------- - Sqrt[g] R   R   h   - 
             2                       pq       r
               pr  q
  Sqrt[g] R   R   h
           pq       r

(* MathTensor's ApplyRules function permits the user to define large
sets of rules that can be applied to expressions to simplify them.
One set of rules that is provided as an example are the RiemannRules.
Familiar rules are applied in the next two examples. MathTensor includes
several functions DefUnique and RuleUnique that help the user devise
their own rules and save them for later use. *)

In[36]:= CD[RicciR[la,lb],ub]

Out[36]= R

In[37]:= ApplyRules[%,RiemannRules]

Out[37]= ---

In[38]:= RiemannR[la,lb,lc,ld] RiemannR[ua,uc,ub,ud]

Out[38]= R     R

In[39]:= ApplyRules[%,RiemannRules]

         R     R
Out[39]= -----------

(* Suppose we define a tensor with four indices. *)

In[40]:= DefineTensor[tensor,"t",{{1,2,3,4},1}]

PermWeight::sym: Symmetries of t assigned
PermWeight::def: Object t defined

(* MathTensor's multiple index facility permits the user to
add indices with one, two or three primes to be used as
extra non-spacetime indices. *)

In[41]:= AddIndexTypes

In[42]:= tensor[ala,blb,clc,ld]

Out[42]= t

(* Tools for building rules involving these extra indices are
provided.  Future releases of MathTensor will extend this
functionality. *)

(* Shipped with MathTensor is the file Components.m which may be
run separately from MathTensor.  Components.m takes a file like
SchwarzschildIn.m, listed next, and computes the components of the affine
connection, the Riemann tensor, Ricci tensor, Riemann scalar, Weyl
tensor, Einstein tensor and several other objects.  SchwarzschildIn.m
is the input file containing information about the famous Schwarzschild
metric.  This metric represents the curved space of a gravitating
spherically symmetric object with mass M in otherwise empty space. *)

---------------------- SchwarzschildIn.m file listing --------------------

(* Copyright (c) 1992 MathSolutions, Inc.*)
(* SchwarzschildIn.m *)

Dimension = 4

x/: x[1] = r
x/: x[2] = theta
x/: x[3] = phi
x/: x[4] = t
Metricg/: Metricg[-1, -1] = (1 - (2*G*M)/r)^(-1)
Metricg/: Metricg[-2, -1] = 0
Metricg/: Metricg[-3, -1] = 0
Metricg/: Metricg[-4, -1] = 0
Metricg/: Metricg[-2, -2] = r^2
Metricg/: Metricg[-3, -2] = 0
Metricg/: Metricg[-4, -2] = 0
Metricg/: Metricg[-3, -3] = r^2*Sin[theta]^2
Metricg/: Metricg[-4, -3] = 0
Metricg/: Metricg[-4, -4] = -(1 - (2*G*M)/r)

Rmsign = 1

Rcsign = 1

CalcEinstein = 1    

CalcRiemann = 1 

CalcWeyl = 1 

SetOptions[Expand, Trig->True]

SetOptions[Together, Trig->True]

CompSimp[a_] := Expand[Together[a/.CompSimpRules[1] ] ] 

CompSimpRules[1] = {} 

(* End of file SchwarzschildIn.m *)


(* If we load Components.m into Mathematica we can run the following
command to produce from SchwarzschildIn.m two new files,
SchwarzschildOut.m, which contains results that can be used immediately
in MathTensor, and SchwarzschildOut.out which can be printed.  The
computation below takes from just a few seconds to less than one minute
on typical workstations.  More complex metrics can take a bit longer.

In[1]:= <<Components.m

MathTensor (TM) 2.1.5 (UNIX (R)) (January 1, 1993)
              Components Package                
by Leonard Parker and Steven M. Christensen
Copyright (c) 1991-1993 MathSolutions, Inc.
Runs with Mathematica (R) Versions 1.2, 2.0, and 2.1.
Licensed to machine sunny.

In[2]:= Components["SchwarzschildIn.m","SchwarzschildOut.m",
 The following tensors have been calculated and stored
 in the file SchwarzschildOut.m in InputForm, and
 in the file SchwarzschildOut.out in OutputForm:
 You can edit SchwarzschildOut.out to print a record of the results.

(* The listing of the output file is too long to give here, but it
gives the calculated values of the components of the Riemann and 
related tensors in the Schwarzschild spacetime. *)

The names of the various commands and other objects available in
MathTensor is given below:

A List of MathTensor Functions and Objects (Pre-2.1.5, See 2.1.5
Announcement for details of new functions.)

Absorb			Epsilon			   InvertFast
Absorbg			EpsilonProductTensor	   Kdelta
AbsorbKdelta		EpsilonProductTensorRule   KdeltaRule
AbsorbRule		EpsilonSign		   Kill
AddIndexTypes		EpsilonToEpsDownRule	   Lap
AffineG			EpsilonToEpsUpRule	   LieD
AffineToMetric		EpsUp			   LieDtoCD
AffineToMetricRule	EpsUpToEpsDownRule	   LieDtoCDrule
AllSymmetries		EpsUpToEpsilonRule	   Lightc
Antisymmetrize		EqApart			   LorentzGaugeRule
ApplyRules		EqApply			   Lower
ApplyRulesRepeated	EqCancel		   Lowera
Arglist			EqCollect		   LowerAllPairs
ArglistAllTypes		EqDivide		   LowerAllTypes
AskSignsFlag		EqExpand		   Lowerb
AskSignsProcedure	EqExpandAll		   Lowerc
BianchiFirstPairRule	EqFactor		   LowerIndexAllTypesQ
BianchiSecondPairRule	EqFactorTerms		   LowerIndexaQ
CanAll			EqMinus			   LowerIndexbQ
CanApplyRules		EqPlus			   LowerIndexcQ
CanApplyRulesFast	EqPower			   LowerIndexQ
CanApplyRulesRepeated	EqReverse		   MakeAllSymmetries
CanDum			EqSimplify		   MakePermWeightGroup
Cannn			EqSolve			   MakeSum
CannnDum		EqSubtract		   Matchlist
CanNonInvert		EqTimes			   Matchlista
Canonicalize		EqTogether		   MatchlistAllTypes
CanSame			EqTwoDivide		   Matchlistb
CanSuperApplyRules	EqTwoPlus		   Matchlistc
CD			EqTwoSubtract		   MatchlistOrd
CDtoOD			EqTwoTimes		   $MathTensorVersionNumber
ClearComponents		esuUnits		   MaxwellA
ClearUnits		EvaluateODFlag		   MaxwellB
CommuteCD		Evenlist		   MaxwellCyclicEquation
Components		Explode			   MaxwellCyclicRule
CountNewDums		FirstCubicRiemannRule	   MaxwellDivergenceEquation
CoXD			FirstQuadraticRiemannRule  MaxwellDivergenceRule
DefineForm		FreeList		   MaxwellE
DefineTensor		FtoC			   MaxwellF
DefUnique		FtoCrule		   MaxwellJ
Detg			GaussianUnits		   Maxwellk1
DetgSign		GenLap			   Maxwellk3
Dimension		GravitationalUnits         Maxwellrho
Downdummylist		hbar			   MaxwellT
Downlist		HeavisideLorentzUnits	   MaxwellTexpression
Downuserlist		HodgeStar		   MaxwellTtoFrule
DualStar		Implode			   MaxwellVectorPotentialRule
Dum			IndexAllTypesQ		   Metricg
DumAllTypes		IndexaQ			   MetricgFlag
EinsteinG		IndexbQ			   MetricgFlagOff
EinsteinToRicciRule	IndexcQ			   MetricgFlagOn
emuUnits		IndexQ			   MetricgSign
Eps0			IndexTypes		   Mu0
EpsDown			IndicesAndNotOrderedQ	   NaturalUnits
EpsDownToEpsilonRule	InListQ			   NegIntegerQ
EpsDownToEpsUpRule	Invert			   NewtonG

NonTensorPart		       Symmetries
OD			       SymmetriesOfSymbol
Oddlist			       Symmetrize
OrderedArgsQ		       SyntaxCheck
Pair			       SyntaxCheckOff
PairAllTypes		       SyntaxCheckOn
PairAllTypesQ    	       TensorForm
PairaQ			       TensorPart
PairbQ			       TensorPartSameQ
PaircQ			       TensorQ
Pairdum			       TensorSimp
PairQ    		       TensorSimpAfter
PermWeight		       TraceFreeRicciR
PIntegrate		       TraceFreeRicciToRicciRule
PosIntegerQ		       Tsimplify
PrettyOff		       TsimplifyAfter
PrettyOn		       Units
Raise			       Unlist
Raisea			       Updowndummylist
RaiseAllTypes		       Updummylist
Raiseb			       Uplist
Raisec			       UpLo
RankForm		       UpLoa
RationalizedGaussianUnit       UpLob
RationalizedMKSUnits	       UpLoc
Rcsign			       UpperIndexAllTypesQ
RicciR			       UpperIndexaQ
RicciSquared		       UpperIndexbQ
RicciToAffine		       UpperIndexcQ
RicciToAffineRule	       UpperIndexQ
RicciToTraceFreeRicciRule      Upuserlist
RiemannCyclicFirstThreeRule    Var
RiemannCyclicSecondThreeRule   Varg
RiemannR		       Variation
RiemannRules		       VariationalDerivative
RiemannSquared		       VectorA
RiemannToAffine		       VectorAFlag
RiemannToAffineRule	       WeylC
RiemannToWeylRule	       WeylToRiemannRule
Rmsign			       XD
Rulelists		       XDtoCDflag
RuleUnique		       XP
RuleUniqueAllTypes	       ZeroFormQ

o New in version 2.1.5:

*  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 + ---

(* 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)

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

(* 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

(* 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] }, 
   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
  {O[q] , O[q] , O[q] , 
   (-h11''[t] - h22''[t] - h33''[t]) q       2
   ----------------------------------- + O[q] }}

(* Here is the scalar curvature invariant. *)

In[3]:= ScalarR

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] }

(* 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
     h32''[t]     -h11''[t]   h22''[t]   h33''[t] 2
     --------- + (--------- - -------- - --------)  + 
         2            2          2          2
     h33''[t]    2       3
     ---------) q  + O[q]

>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]= -------------

(* 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.

  • Prev by Date: D and InterpolatingFunction
  • Next by Date: Axes ticks in Plot
  • Previous by thread: Re: BNF form for MMA?
  • Next by thread: MathTensor Information (Long)