How to run Mathematica on KSU-Physics Machines

 

"Mathematica is probably the most powerful MATH tool, save the human brain and a good cup of java."

After using Mathematica in several projects I found that running Mathematica in batch mode is most convenient for me. Running in batch mode means that the program is run from a shell script under UNIX. The advantage of scripts is that it is easy to modify scripts to obtain new results. Mathematica is available on our UNIX cluster.

How does it work?
Suppose you want to solve your preferred differential equation, [ y'(x) ]^2 + 1 = 1/y , with a given start value y[0]=0.01 and save the result in a postscript file. Here is the script for that.

cat >tmpfile <<\EOF
AppendTo[$Echo, "stdout"]
NDSolve[{y'[x]^2 == 1/y[x]-1, y[0]==0.01}, y, {x,0,3},MaxSteps->Infinity]
Plot[Evaluate[y[x] /. %], {x, 0, 3}]
Display["dsolve.eps",%,"EPS"]
\EOF
math <tmpfile
ghostview dsolve.eps &

Save the script as dsolve.sh  , open a UNIX shell and type in source dsolve.sh. The script starts the Mathematica kernel (command = math) and creates an encapsulated postscript file dsolve.eps.

If you are interested in other examples, have a look at this script.

How to get Mathematica help: the Mathematica web site is a great resource of information and examples.


Eckhard von Toerne, last modified February, 2004