TCM
UoC crest

Mathematica

The University currently enjoys a site licence for Mathematica. This licence was organised by Dr Mike Rose of DAMTP.

The licence covers unlimited use, including home use, for staff and students of certain Departments and Institutions only. For TCM, [email protected] is the obvious support contact. From TCM's point of view, if you are a staff member, postdoc, PhD student, undergraduate reading Physics, or official visitor (including those Fellows who, whilst not technically employed by the University, in practice work here), you are entitled to a copy. This entitlement ceases the moment you leave. In particular, if you become employed elsewhere, it is the responsibility of your new employer to negotiate licences with Wolfram.

Since version 8.0 registration has been particularly straight-forward, and DAMTP provides a very helpful page on how to install Mathematica, including web downloads and licence key renewal. I see no reason to repeat here the information in that page, save to say that we also provide install images and a copy of the licence agreement in /rscratch/Mathematica, and that our collection is not necessarily identical to DAMTP's. The licence key you receive from following this process will be valid for no more than 12 months, so you do have to repeat annually.

(In case the above page in Maths has moved again, the page for requesting activation keys has this URL.)

Mathematica in TCM

We generally have a large number of old versions installed, in addition to the current version. This is a defence against the introduction of bugs in new versions. To run an older version, one merely has to set the environment variable TCM_MATHEMATICA_VER to the appropriate version.

pc0:~$ echo '$Version' | math
In[1]:= 
Out[1]= 10.0 for Linux x86 (64-bit) (December 4, 2014)

pc0:~$ export TCM_MATHEMATICA_VER=8.0.1
m1:~$ echo '$Version' | math
In[1]:= 
Out[1]= 8.0 for Linux x86 (64-bit) (February 23, 2011)

The list of available versions will be approximately those given by

pc0:~$ ls /usr/local/shared/Mathematica
10.0.0  10.0.2  10.2.0  10.3.1  10.4.1  11.0.1  8.0.1  9.0.1
10.0.1  10.1.0  10.3.0  10.4.0  11.0.0  8.0.0   9.0.0  version

Remote kernels

Mathematica supports remote kernels, that is, having the GUI run on one machine, presumably the one in front of you, and the kernel on another, presuambly something bigger. This has a reputation for being slightly difficult to set up, and somewhat unstable, but on good days it works well. One tip is to replace the use of Wolfram's own, Java-based, ssh command with a standard ssh command. The only reason for using Wolfram's version is if one's OS does not itself support what has been a core internet protocol since about 2000. (Windows first gained ssh as an optional, beta, component of Windows 10 in 2015.) The settings are found under Evaluation | Kernel Configuration Options, and refering to a screenshot of the remote kernel options may help. One is replacing

  "`java`" -jar "`wolframssh`"

with simply ssh.

Mathematica in Scripts

Mathematica may be used from the command line in various ways, including by typing "math -script foo.txt" if foo.txt is a text file containing Mathematica commands. If one wishes to run a notebook in this fashion, then the command is "MathematicaScript -script foo.m".

Do not be tempted to use this for trivial calculations that one could do with very significantly smaller and faster utilities.

pc0:~$ echo '(2+3)*4' | bc
20
pc0:~$ echo $(((2+3)*4))
20

(The last being for bash users only, thus scripts using it should start #!/bin/bash, not #!/bin/sh. Bash's arithmetic is integer-only. Though bc defaults to integer, it is fixed point with a configurable number of decimal places. echo 'scale=20; 1/7'|bc gives .14285714285714285714.)