The installation mechanism for MathTensor has been updated for Mathematica 8 (and should also work for most earlier versions). The rest of this page has been left for those using earlier versions of MathTensor or Mathematica. If you run across problems, the older text might be of help. Also, at the bottom of this, there are Notes and Error comments. If you have any questions, send us email at steve@smc.vnet.net. Note that some of the loading statements in the MathTensor book are changed in version 2.2.2.
If you have received the software on a CD, you will need to put the CD into your computer's CD/DVD drive and copy the MathTensor files to a convenient directory/folder called MathTensor on one of your disk drives. Write down the location of the MathTensor directory/folder.
You will then need to create a line in your init.m file for your Mathematica installation. Typically, you can go to the documentation for init.m which can be found at
http://reference.wolfram.com/mathematica/ref/file/init.m.html
Click on the MORE INFORMATION link there to find out just which init.m file you need to edit and where it is.
Then, make a line like
$Path = Join[$Path,{"C:\\Home Directory\\MathTensor"}]
for Windows (note the \\ instead of \). You must replace the Home Directory entry with the actual location of the MathTensor directory. For MacOSX/Unix/Linux, use something like
$Path = Join[$Path,{"/homedirectory/MathTensor/"}]
where homedirectory is replaced by the acutal directory you use.
After you have done this, start a brand new Mathematica session and type
$Path
Check to see if the MathTensor directory you put in the $Path line in your init.m file is there correctly. (In Windows, the \\ will appear as \.)
Next, you will need to email the result of typing
$MachineID
in Mathematica on the machine you plan to run MathTensor on to steve@smc.vnet.net. A file called mathtensorpass.m will be emailed back. You must put this file into the MathTensor folder/directory with the other MathTensor.m files.
Now, in a new Mathematica session, type
<<MathTensor.m
If your setup is correct, you should get a Copyright message and a few other messages. If you get any error messages, report them immedidately.
To load the Components programs instead of MathTensor, enter
<<Components.m
This will also give you a Copyright statement and should give no error messages.
DO NOT try to load both MathTensor.m and Components.m into the same Mathematica session. This will not work and will give you a lot of error messages.
Note that all the Syntax and Unprotect issues mentioned in the old instructions below have been fixed in version 2.2.2 and are not needed in the init.m file.
If you have recieved 2.2.2 via email, details on getting the MathTensor files should have been included with the email.
Finally, in a Mathematica 8 session, before you load MathTensor.m, go to the Mathematica->Preferences window. In the Format type for new output cells: set this to OutputForm before loading MathTensor.
November 18, 2010 - So far MathTensor seems to be compatible with Mathematica 8. If you have any issues, email us immediately. The free form input is not supported currently.
December 15, 2009 - On Windows Vista machines, some users have found that the init.m file to be used to set $Path and other needed commands is
C:\ProgramData\Mathematica\Kernel\init.m
Documentation for init.m can be found at
http://reference.wolfram.com/mathematica/ref/file/init.m.html
October 28, 2009 - The MakeSum function, as used in Section 4.1.10 of the MathTensor book, will no longer work in Mathematica 7 or higher unless the following is added to init.m or done at the beginning of a MathTensor session.
Unprotect[Sum]
Sum[tens_] := tens
Protect[Sum]
This is not needed in Mathematica 6 or lower,
November 25, 2008 - For Mathematica 7 and 8, it is now necessary to add the line
Unprotect[RiemannR]
to the init.m file - typically this file is in the Library/Mathematica/Kernel subdirectory of your user directory.
May 23, 2008 - On systems with Mathematica 6 or higher, 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.
A user recently reported this -
Have just installed MathTensor and managed to get it to load and recognise the password file. Just a couple of comments on what seems to be mac/Mathematica 6.x specific stuff that you might want to add to the install instructions before I forget!
(1) In my installation at least, there is no init.m file in the Applications/Mathematica path. Instead I used the local one in /Users/Library/Mathematica/, which I guess means I have only installed for one user and not globally. If you edit it in Mathematica you get the package editor, which seems to work fine. Sometimes the mac front end (mostly the packaging system for applications) makes it a bit difficult to see the nuts and bolts of the UNIX which is underneath! I didn't need any double slashes in the path for it to work.
(2) The password file was slightly more problematic - I tried to use the default mac TextEdit to produce an rtf and rename it, but that doesn't seem to read in Mathematica (could be the old windows/UNIX carriage return, linefeed incompatibility?) After that I tried to make a mathematica package file (.m) but that didn't work either. Finally I resorted to vim to get a really pure ASCII file, which works fine. You might like to add a comment somewhere to indicate that you need to really use a low level editor to get it to read properly? I guess emacs would work too, but I haven't tried it.
Another user sent this suggestion -
Simplified Installation Instructions suggested by Alessandro Stecchina:
We will create a MathTensor Loader notebook which will take care of all the settings required to run MathTensor. (This is written for a Windows system and might need to be modified slightly for Mac or Unix systems.)
0 - Start a new Mathematica session
1 - In Mathematica evaluate $BaseDirectory or $UserBaseDirectory. This will give you a Mathematica folder that contains an Applications folder. The Applications folder is the place to install the MathTensor package-folder. This is the recommended place for 3rd party packages in Mathematca 6.x or higher. So go ahead and place the MathTensor package-folder inside the Applications folder inside $BaseDirectory or inside $UserBaseDirectory At the conclusion you should have the structure:
...\Mathematica\Applications
\MathTensor package folder (called mathtensor or MathTensor, or something smilar)
\package files
2 - Create a new blank notebook and paste the following code in one cell:
-------------------------------------------------------------------------------
Unprotect[TensorQ];
$Path = Join[$Path, {$BaseDirectory <> "\Applications\mathtensor"}];
Off[Syntax::"com"];
<< mathtens.m
postfunc[x_Graphics | x_Graphics3D] := x;
postfunc[x_] := OutputForm[x];
$Post := postfunc;
--------------------------------------------------------------------------------
Some users of Mathematica 7 and 8 find that the postfunc lines above cause problems. They can be left out.
3 -Depending on your operating system or configuration, you may need to:
Replace $BaseDirectory with $UserBaseDirectory if you have installed MathTensor in $UserBaseDirectory. Replace "mathtensor" with the folder name containing the MathTensor package (for ex. MathTensor) Replace "mathtens.m" with the appropriate filename for launching MathTensor (for ex. MathTensor.m) Deepending on your operating system, you may need to slightly change the folder separators in the string "\Applications\mathtensor". Just look at how the $BaseDirectory string is made and copy the separator
4 - Save the notebook as "MathTensor Loader" (or whatever else you wish) in the folder where you keep your regular notebooks.
5 - Evaluate the cell
If all is well you have loaded MathTensor and you can do some testing to see that everything is ok. Try also:
as you see graphics cells are output in standard (graphics) form. All the rest is in OutputForm
If you like to save your work, just use the Save as... menu command and choose a name and location for your notebook. It will be saved with the loader cell inside, so next time you can just open it and launch MathTensor from it. Otherwise, every time you wish to use MathTensor from scratch, just open the MathTensor Loader notebook and evaluate the cell.
That's it!
October 1, 2007 - On Macintosh OS X systems running Mathematica 6 or higher, 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 or higher folder and follow the UNIX instructions below. If you are not using Mathematica 6 or higher, use the files in the other folder and follow the Macintosh instructions.
May 5, 2007 - In Mathematica 6 or higher, 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
The $PreRead discussion on page 39 of the MathTensor book no longer works and should not be used.
Windows or Macintosh (OS 9 or less):
Copy the MathTensor folder in the CD disk into the AddOns/Applications folder.
Go to the AddOns/Applications directory.
Copy the mathtensor.tar.gz to this directory. Then run
A MathTensor directory will be created containing the MathTensor files. Most versions of Unix/Linux
$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,{"(drive with Mathematica directory):AddOns:Applications:MathTensor 2.2"}]
$Path= Join[$Path,{"/Users/
/MathTensor 2.2 "}] $Path= Join[$Path,{"(drive/Mathematica directory)/AddOns/Applications/MathTensor"}]
To test the $Path, you need to restart Mathematica and then type
Some users have received a message like:
Syntax::sntoct1: 3 octal digits are required after \ to construct an 8-bit character.
being part of the $Path statement in the init.m file. This can be fixed by using the string
<<MathTensor.m (Macintosh or Unix/Linux/OSX)
If you use the Components function, you load with
<<Components.m (Macintosh or Unix/Linux/OSX)
Notes
DefineTensor[esc-a-esc,"esc-a-esc",{{1,2},1}]
Book Errors/Bug Fixes
There are several misprints or changes in the MathTensor Book:
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 369: The PairAntisymmetrize entry should say and anti-symmetrizes over all the pairs.
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. 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 2011 MathTensor, Inc.
MathTensor is a Trademark of MathTensor, Inc.
Mathematica is a Registered Trademark of Wolfram Research, Inc.
This page was last updated on July 30, 2011.