Mathematica
Guidance last updated: 20 October 2026
Mathematica is a technical computing environment and programming language with strong symbolic and numerical abilities.
Usage
After connecting to Stanage (see Establishing a SSH connection), start an interactive session:
salloc
You can load a specific version with the following command:
module load Mathematica/13.2.1
module load Mathematica/13.2.1
Batch submission
The batch example below uses a plain-text Mathematica script. If you normally
work in a notebook (.nb), copy the Wolfram Language commands you want to
execute into a text file, typically given the extension .m. The script can
then be run with math -script. Let’s run the following simple Mathematica
script as a batch job:
(*Find out what version of Mathematica this machine is running*)
Print["Mathematica version is " <> $Version]
(*Find out the name of the machine we are running on*)
Print["The machine name is " <> $MachineName]
(*Do a calculation*)
Print["The result of the integral is "]
Print [ Integrate[Sin[x]^2, x]]
Copy and paste the above into a text file called very_simple_mathematica.m
The following example batch submission script requests one CPU and 4000 MB of memory for five minutes:
#!/bin/bash
#SBATCH --partition=sheffield
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem-per-cpu=4000
#SBATCH --time=00:05:00
#SBATCH --mail-user=a.person@sheffield.ac.uk
#SBATCH --mail-type=ALL
set -e
module load Mathematica/13.2.1
cd "$SLURM_SUBMIT_DIR"
math -script very_simple_mathematica.m
Copy and paste the above into a file called run_job.sh and submit with
sbatch run_job.sh
Once the job has successfully completed, the output will be in a file named like slurm-4835.out. The number at the end refers to the job-ID given to this job by the system and will be different for you.
The version and machine name will depend on the module and allocated node.
Example output is:
Mathematica version is 13.2.1 for Linux x86 (64-bit) (January 27, 2023)
The machine name is node301
The result of the integral is
x/2 - Sin[2*x]/4
Installation notes
Mathematica was installed using Easybuild, build details can be found in $EBROOTMATHEMATICA/easybuild with a given module loaded.