# Mathematica

Wolfram Mathematica is a modern technical computing system spanning most areas of technical computing - including neural networks, machine learning, image processing, geometry, data science, visualizations, and others. It is used in many technical, scientific, engineering, mathematical, and computing fields.

External Links:

Mathematica website

## Loading Mathematica

Currently there are two versions of Mathematica installed on HPC, 11.2.0 and 12.0.0. To see the Mathematica modules available, type the command
` module avail`

.
The default version is 12.0.0. To use that version, load the default mathematica module

module load mathematica

If you want to use the older version 11.2.0, then do

module load mathematica/11.2.0

## Running Mathematica

Mathematica can be used in command mode for a batch job and can also be used in GUI mode for an interactive job.

## Batch Mathematica

Here is an example batch job script. For more information on submitting batch job scripts, see the documentation on running jobs.

Suppose below is your input file *test.m* for Mathematica command *math*:

1+2
8-1
3*6
x=7
3x
Sin[Pi/2]
Cos[Pi/2]
N[Exp[1]]
N[Exp[2]]

To run the job in batch mode you create a batch job script named *submit.csh* containing:

#!/bin/tcsh
#BSUB -W 20
#BSUB -n 1
#BSUB -o out.%J
#BSUB -e err.%J
module load mathematica
math -noprompt < test.m

The job can be submitted as

bsub < submit.csh

Check the documentation on running jobs to see how to customize the a batch job script.

The job output in the LSF output file "out.<LSF job number>" should be like:

3
7
18
7
21
1
0
2.718281828459045
7.38905609893065

## Interactive Mathematica

If it is necessary to run Mathematica in GUI mode, the HPC-VCL should be used. To run on the HPC-VCL, log in to an

HPC-VCL node, open a terminal, cd into an appropriate job directory and type:

module load mathematica
mathematica

Last modified: March 23 2022 13:17:59.