Scientific Supercomputing at the NIH

Mathematica

Description

Mathematica is a fully integrated environment for technical and scientific computing. Mathematica combines numerical and symbolic computation, visualization, and programming in a single, flexible interactive system. The Mathematica system is very broad, and provides a systematic interface to all sorts of computations, from traditional numeric and symbolic computation, to visualization, to data format conversion, and the creation of user interfaces.

Version

Type mathematica -version at the prompt.

How to Use

Running the Mathematica GUI Interactively

To run the Mathematica graphics interface, an X-Windows connection is required. Open an X-Windows connection to helix.nih.gov, and check that it is working by typing 'xclock' at the prompt.

[user@helix ~]$ mathematica &

You should see the Mathematica splash image as below:

Mathematica splash image

and then the main Mathematica Notebook window will appear.

To run a demo, in the main Mathematica window, go to File->Open. Enter the filename /usr/local/math-5000/Documentation/English/Demos/Animations.nb. You should see a window appear with several graphic images. Double-click on one of them to animate:

Mathematica demo image

Run Mathematica interactively without the GUI

It is also possible to run Mathematica interactively on the command-line, without the GUI. This would be useful if you do not wish to use Xwindows, and is obviously most useful for calculations rather than interactive graphics. Sample session (user input in bold):

[user@helix ~]$ math
Mathematica 6.0 for Linux x86 (64-bit)
Copyright 1988-2007 Wolfram Research, Inc.

In[1]:= data=ReadList["rmsdplot.list",{Number,Number,Number}];

In[2]:= [..enter other Mathematica commands..]

In[22]:= Exit[]
[user@helix ~]$

Run Mathematica using a math command file

You can insert Mathematica commands into a math command file, and run that file interactively at the prompt. This is convenient if you perform the same Mathematica tasks frequently. Sample session with a Math command file bfactorplot.math.

[user@helix ~]$ math
Mathematica 6.0 for Linux x86 (64-bit)
Copyright 1988-2007 Wolfram Research, Inc.

In[1]:= <<bfactorplot.math
In[2]:= Exit[]
[user@helix ~]$

Alternatively, you can type directly at the command prompt:

[user@helix ~] math -run "<<rmsd.math"

Below is an example of the command file "rmsd.math", which produces EPS graphic output.

----------------------------file rmsd.math---------------------------------- (* file geomanal/rmsdplot.math -- make a plot rmsd vs residue *) (*===>*) data=ReadList["rmsdplot.list",{Number,Number,Number}]; SetOptions[Plot,DisplayFunction->Identity] column0 = Transpose[data][[1]]; column1 = Transpose[data][[2]]; column2 = Transpose[data][[3]]; len=Length[column0]; b1=Join[column0,column1]; b2=Partition[b1,len]; b3=Transpose[b2]; xmax=Max[column0]; xmin=Min[column0]; y1max=Max[column1]; y1min=Min[column1]; y2max=Max[column2]; y2min=Min[column2]; plot1= ListPlot[b3, AxesLabel->{"Res. No.","RMSD"}, Ticks->{Range[0,xmax+5,50],Range[0.0, y1max+0.2 ,0.5]}, PlotLabel->"Backbone",Axes->{0,0},PlotJoined->True, PlotRange->{{0,xmax+2 }, {0., y1max +0.1 }}, AxesStyle->{PostScript ["/Times-Roman findfont 13 scalefont setfont"]} ]; s1=Join[column0,column2]; s2=Partition[s1,len]; s3=Transpose[s2]; Export["a.eps",plot1] Exit[] ------------------------------------------------------------------------------

Tip: The output graphics file "a.eps" can be converted to a PDF with the command epstopdf a.eps producing the PDF file "a.pdf".

Documentation

Wolfram Mathematica Documentation Center

Mathematica FAQs