
Using Mathematica at CAMKGeneral information
Mathematica is a platform for all forms of computations. It's used mostly for symbolic math but can do much more. The full manual is available from the program level and on the web.
There are 7 Mathematica licenses available at CAMK. The software consists of two independent components  the graphical frontend and the kernel, so actually there are 7 frontend licenses and 7 kernel licenses. Each of them can be used separatelly, e.g. the frontend for editing notebooks and the kernel for calculations in the text mode (useful in the batch system). Since users tend to "forget" to close their interactive sessions, while the number of licenses is small, there are some restrictions enforced. Currently:
Running Mathematica in the queueing system (on cluster nodes)When running Mathematica in the queueing system it is required to use
Various ways of using Mathematica under the queueing system are presented below. Please refer to
Batch processing. Mathematica can read commands from a notebook file or a plain text file. The latter is recommended for batch processing since you can easily edit the commands in your favourite text editor without using the Mathematica frontend. Here is an example infile.m:
2+2 Integrate[x,{x,0,1}]To process it and save the output to outfile.m file type math < infile.m > outfile.m or to get more "raw" output add option noprompt math nopromt < infile.m > outfile.m  experimnt! Here is an example job script: #PBS N batch_math1 TipTo convert Mathematica notebook file into plain text file use Mathematica's Front End features:1. Select the cell or set of cells that contain the commands you wish to be written to the infile text file. 2. These cells will be defined as initialization cells by clicking on Cell> Cell Properties> Initialization_Cell in the menu bar. 3. Generate a text file by choosing from menu File> Save_As_Special...> Package_Format TipBy default only output lines go to standard output. If you want also input lines to appear there add in the first line of yourinfile : AppendTo[$Echo, "stdout"] Note about plots: there is no graphic output to the screen in this mode. You should export plots to a file or better  save the data to a file and create plots with apropriate software like gnuplot or xmgrace (mathematica graphics looks really awful). If you have to export plot to a file the Mathematica still needs to run the frontend (really! :O) so you have to give access to your display  read below about "interactive graphical mode". In short  suppose you have an input file in.m a=Plot[Cos[2*x],{x,0,Pi}] Export["a.eps",a]Log in to pskt: ssh X psk and submitt a job script like this:
#PBS N batch_math1 Interactive text mode. Ssh to psk. Submit an interactive job (option I):
> qsub I q short l software=math:1 and you will be given a shell session on one of the nodes. Run Mathematica in the text mode > math and type Mathematica commands. To exit Mathematica type Quit and to finish the job type logout .Interactive graphical mode. Like above but use X twice:
> ssh X psk and run mathematica . TipYou can also create the job script to start an interactive session. (Each line starting with #PBS is expected to contain command line options to qsub). Example: qsub jobfile wherejobfile contains#PBS N math_job1 Working in the interactive mode on pskLog in to psk Additional notesOn some systems an error message may pop up during frontend start  do not click OK, close this window with the small cross in the upper right corner instead. If you can't see mathematical symbols properly please send request to 