MathTensor Technical Information


Installation Instructions

November 7, 2007 - On systems with Mathematica 6, the placement of the init.m file that needs to be read (see below) to set the $Path and other items has moved to /Library/Mathematica/Kernel/init.m (or sometimes in the Library folder in the user's home folder). On Windows machines, the appropriate init.m file is intallation dependent and may be in a place like

..\Wolfram Research\Mathematica\6.0\SystemFiles\Kernel\Packages\init.m

or

..\Application Data\Mathematica\Kernel\init.m

where the ..\ in front depends on where you have Mathematica installed.

October 1, 2007 - On Macintosh OS X systems running Mathematica 6, we have found it better to install the UNIX/Linux version of MathTensor. So, on the Macintosh CD, if you are using Mathematica 6, use the mathtensor.tar.gz file in the Mathematica 6 folder and follow the UNIX instructions below. If you are not using Mathematica 6, use the files in the other folder and follow the Macintosh instructions.

May 5, 2007 - In Mathematica 6, you will need to set the output form for tensors in a different way. See Step 5 below for more details.

July 11, 2003 - Mathematica 5 or higher differences. Some users have reported that when they move to Mathematica 5 or higher, they are having load problems with MathTensor. One is that it appears that a TensorQ function has been added in Mathematica 5 or higher which will conflict with MathTensor's TensorQ function and give errors when loading. The quick fix for this is to just do

Unprotect[TensorQ]

in Mathematica before you try to load MathTensor. Alternatively, you can add the Unprotect line in your init.m file after the Off[Syntax::"com"] line discussed in Step 7 below. This last option will not permit you to use Mathematica's TensorQ at any time of course. This will be corrected in a future release.

The $PreRead discussion on page 39 of the MathTensor book no longer works and should not be used.

Also, in the Windows version at least, it may be necessary to put type \\ instead of \ in your $Path statement in init.m. See below for details on init.m. If you have any other problems, report them to mathtensor@smc.vnet.net immediately.

Note that new instructions for Mathematica 4.1, 4.2 or higher on Macintosh have been added due to differences in how to edit the init.m file. If you have moved to OSX, email steve@smc.vnet.net for details on new files that you will need to get in order to run MathTensor. Three new files are needed. See below for some further details.

Please read this entire document before you start the installation.

These instructions assume some knowledge of how Mathematica works. It is suggested that you read the installation details for Mathematica before proceeding with the Instructions below. It is assumed that you are running version 3.0 or higher of Mathematica. If you have any problems with installation, report them immediately to us at mathtensor@wolfram.com.

If you are using a version of Mathematica older that 3.0, contact MathTensor, Inc. for different instructions. Because certain functions (especially front end formatting functions) do not work in older versions of Mathematica, we recommend you upgrade. Instructions for computer platforms vary slightly. These will be noted when needed.

By far, the most problems that are reported are due to either a mis-typing of one of the $Path commands below or mis-placement of the init.m file.

Step 1:

Locate the CD containing the MathTensor software and place it in your CD drive. (If you have an older MathTensor release that came on floppy, you can replace the word CD with floppy.)

Step 2:

Macintosh/PowerMac Systems: Once the CD disk icon appears on the screen, click on it to open it up. There you will find two MathTensor folders. One is for systems running OS 9 or less. The second labeled MathTensor OSX is for OSX only. You only need to install the folder that corresponds to the version of Mathematica you are running.

Windows Systems: Click on your My Computer icon to open it up and then on the CD drive icon to open it. On some systems when you put the CD in your drive, the CD folder may open up automatically, In the folder window, you will find a MathTensor folder.

Unix/Linux Systems: Typically, your system will have some sort of file manager window tool. On Sun Solaris systems, this is called the File Manager. Open up the File Manager. You may have to go to a File menu in order to get the machine to find the CD. Usually, a CD drive window with then appear. It will contain a file called mathtensor.tar.gz.

Step 3:

When you installed Mathematica 3.0 or higher on your system, the directory where its files are located contains an AddOns\Applications subdirectory. This location varies depending on your computer type and directory structure. You will need to find this subdirectory on your machine.

Windows or Macintosh (OS 9 or less):

Copy the MathTensor folder in the CD disk into the AddOns/Applications folder.

Macintosh OSX:

It is easiest to copy the MathTensor OSX folder to your home directory, usually in the /User directory with your login name.

Unix/Linux:

Go to the AddOns/Applications directory.

Copy the mathtensor.tar.gz to this directory. Then run

gunzip mathtensor.tar.gz

tar xvf mathtensor.tar

A MathTensor directory will be created containing the MathTensor files. Most versions of Unix/Linux

Step 4:

You now need to find the Configuration\Kernel folder (directory) in your Mathematica directory. In this directory you will find the init.m file. This file needs to be edited (within Mathematica usually by finding the file with the File->Open menu items) to include a line like

Windows:

$Path=Join[$Path,{"(drive:Mathematica directory)\AddOns\Applications\MathTensor"}]

For example, after a typical Mathematica install, the above line will look like:

$Path=Join[$Path,{"C:\Program Files\Wolfram Research\Mathematica\3.0\AddOns\Applications\MathTensor"}].

Macintosh OS9 or lower:

$Path= Join[$Path,{"(drive with Mathematica directory):AddOns:Applications:MathTensor 2.2"}]

Macintosh OSX:

$Path= Join[$Path,{"/Users//MathTensor 2.2 "}]

Unix/Linux:

$Path= Join[$Path,{"(drive/Mathematica directory)/AddOns/Applications/MathTensor"}]

to the VERY END of the file after the End[] statement. You must put in the full path name of the Mathematica directory where the AddOns\Applications subdirectory is located. This replaces the (drive ... ) objects above. Make very sure to type all the brackets, quotes, and spaces exactly correct. Not typing this line correctly is the most common installation mistake. Save the editing into the init.m file.

We have noticed that the installation for Mathematica 4.1 or higher on the Macintosh requires a slightly different placement of the $Path and Syntax lines (see below) in the init.m file. These two lines need to be before the End[] statement rather than after it. When you edit the init.m file, a dialog box may appear asking if you want the file to be loaded automatically during Mathematica startup. You need to answer yes to this by clicking the top button in the box.

To test the $Path, you need to restart Mathematica and then type

$Path

Your path to your MathTensor directory/folder should appear in the output of this. If it does not appear exactly or is incorrect, you will need to re-edit the init.m file.

Some users have received a message like:

Syntax::sntoct1: 3 octal digits are required after \ to construct an 8-bit character.

This is due to the form

\Mathematica\4.0\AddOns

being part of the $Path statement in the init.m file. This can be fixed by using the string

\Mathematica\\4.0\AddOns

instead.

In Mathematica 5 or higher for Windows you may need to put \\ instead of just \ in each place in the init.m $Path line. One of our users comments also that in his case:

In Mathtensor with Mathematica 5 or higher for Windows it is not only necessary to use two \\ slashes for one in the init file ($PATH) but also within notebooks when reading/writing (within my experience in Windows XP). Example lines follow. Components["C:\\RuleTheWaves\\Kazanas\\Partitioned\\formal.m", \ "C:\RuleTheWaves\Kazanas\Partitioned\Heat.m", \ "C:\RuleTheWaves\Kazanas\Partitioned\Heat.out"]

Notice that I had to double the backslashes to read, but not to write. I believe it is OK to use doubles in both places. The backslashes that follow commas are not really in the notebooks, at least not as such (visibly) !!!!!!!!!! They evidently result from mouse-copying from notebooks that have long lines broken for continuation and then pasting in this e-mail. Evidently, Mathematica 5 or higher uses the "\" as a hidden symbol for continuing lines.

In one case I had to use

<< "MathTens.m"

with the quotes in place; other times I have not had to do that. There may be invisible characters accidentally typed in the notebook that required the quotes in that line.

Step 5:

Before loading MathTensor 2.2, go to the Cell menu item and go to Default Output Format Type and then select OutputForm. This gives what we consider to be a better looking screen appearance for the superscripts and subscripts.

In Mathematica 6, this is done in the Mathematica->Preferences window. In the Format type for new output cells: set this to OutputForm before loading MathTensor.

Step 6:

Currently, for Unix/Linux systems only, you will need to get a password. In a Mathematica session, type

$MachineID

and email the result to MathTensor, Inc. at mathtensor@wolfram.com. A password will be issued. Once you have the password, create a file called mathtensorpass.m in the same directory as your MathTensor files. In that file put the two lines:

$MachineID
password

where $MachineID is the number you email to us put inside the quotes and password is the number you get from us.

Step 7:

If you are using Mathematica 4 or higher on any system, you will need to add the following line to your init.m file after the $Path statement:

Off[Syntax::"com"]

Mathematica 4 and higher appears to have a new warning message that looks for particular comma structures in code. These structures in MathTensor do not affect computations but do cause warning messages like

Syntax::com: Warning: comma encountered with no adjacent expression; the expression will be treated as Null.

during loading. The Off line above causes these warnings not to be generated. Future versions of MathTensor will not require this fix.

Step 8:

If the $Path is correct and in the Unix/Linux case you have a valid password, you can now start MathTensor by typing

<<MathTensor.m (Macintosh or Unix/Linux/OSX)

<<MathTens.m (Windows)

command. MathTensor should now load giving the Copyright symbol and other information about MathTensor default settings.

If you use the Components function, you load with

<<Components.m (Macintosh or Unix/Linux/OSX)

<<Componen.m (Windows)

You can now use MathTensor. Report any problems to MathTensor, Inc. Do not report problems with MathTensor to Wolfram Research first. While you may have purchased the product there, they do not provide support for MathTensor.

Notes

It is now possible in Mathematica 3.0 or higher and MathTensor 2.2 to have Greek tensor names (still not indices, but soon) by doing something like:

DefineTensor[esc-a-esc,"esc-a-esc",{{1,2},1}]

where esc is the escape key. An alpha symbol should appear on the screen in the DefineTensor and later in any expression where you type in esc-a-esc[la,lb].

The use of MathTensorFast.m described in the MathTensor book is no longer supported. In versions shipped after November 1998, the VariationalDerivative function has been changed to automatically symmetrize the output indices.

Book Errors/Bug Fixes

It is our policy to report bugs and other problems openly and to try to give fixes as soon as possible.

There are several misprints or changes in the MathTensor Book:

Page 39: the $PreRead part of this page should be deleted. It no longer works in current Mathematica versions.

Page 102: In the RiemannRule13, 1/4 should be 1/2. (if your calculation uses RiemannRule13, contact us)

Page 103: In the RiemannRule19, there is an R0 in the second term. This should just be an R.

Page 180: In the box at the top, AbosrbKdelta should be AbsorbKdelta.

Page 292: The file name CompOut.m two-thirds the way down the page should read CylOut.m.

Page 296: The output of DSolve in Out[22] will not appear this way in recent versions of Mathematica. This is a bug in Mathematica and has been reported to Wolfram Research.

Page 309: In the second line, GaussBonnetMetricProdctFourDimensions should be GaussBonnetMetricProductFourDimensions.

Page 369: The PairAntisymmetrize entry should say and anti-symmetrizes over all the pairs.

Bug in Variation: The value for Variation[CD[ScalarR,la],Metricg] is incorrect in placement of two indices. If you use this structure, contact us for a replacement file.

Bug: The Ttransform function does not work properly in certain situations where there are mixed covariant and contravariant indices. It does work when the indices are one or the other. To use Ttransform, write mixed tensors in terms of non-mixed ones and metric tensors.

Bug: The CommuteCD and OrderCD functions do not work properly when Rmsign is set to -1. Default is Rmsign = 1, so the bug does not occur if you have not set Rmsign to -1. If you do not use Rmsign=-1, this will not affect any computations. If you have to set Rmsign to -1, contact us.

Bug: RiemannRule38 is defective. If you run a program and it says that RiemannRule38 has been used, you will get an erroneous answer. A new fix for this is being developed, Contact Steve Christensen if you see this problem.

Comment: Tsimplify will not always work if you don't run Expand on an expression with tensors inside ( )'s. Always run Expand before running Tsimplify.


Send comments or questions to steve@smc.vnet.net
© Copyright 2007 MathTensor, Inc.
MathTensor is a Trademark of MathTensor, Inc.
Mathematica is a Registered Trademark of Wolfram Research, Inc.
This page was last updated on November 8, 2007.