# Mathematica

Mathematica is, according to Wolfram Research, "the world's most powerful mathematical software system." There are many in the building who use it regularly for their research.

## Contents

## Overview

You can run Mathematica by loading the appropriate module if not already loaded with `module load mathematica` then executing `mathematica` from the command line.

## Licensing

We currently have 10 floating licenses for Mathematica in the building; this means that you can run it on any machine, but only 10 copies may be run at the same time. If you're having trouble with running or using Mathematica, check to see if others are using up all the licenses by running the command `monitorlm`.

If you wish to use the department licenses while you're in the building (**NOTE:** You must be using a wired network connection within Peyton Hall to see the license server!) you'll need to tell Mathematica how to reach the server. According to Wolfram's website:

- Start Mathematica
- The Wolfram Product Activation dialog appears on your screen. Click Other ways to activate.
- From the activation method dialog, select Connect to a Network License Server.
- Enter the name or IP address of the server on which MathLM is running and click Activate.

The license server is 'tully.astro.princeton.edu'.

**NOTE:** As mentioned above this will only work if you're using a wired network connection within Peyton Hall. If you leave the network, Mathematica will realize it cannot reach the license server after a short time (it seems to check every 15 minutes) and will force you to quit the program, giving the option to save any open notebooks.

Note for postdocs/staff who wants to install Mathematica on their personal non-Peyton connected pc/laptop: you need to purchase the license from the OIT store www.princeton.edu/oitstore, which is $80/year, which is half of the market price. Then Mathematica people will send you a link to download. Students should be able to get this for free through Princeton.

## Font issues

If you're not running Mathematica locally on a department desktop machine (using your laptop, or a machine at home through a SSH connection) you may have some issues with fonts displaying properly. Here's a couple links that may help you out:

- Linux: http://helpdesk.princeton.edu/kb/display.plx?id=8446
- Windows: http://www.physics.ubc.ca/computer/mathematica/faq.phtml#home
- Mac OS: (see below)

### OS X fonts

The steps to configuring the Mathematica fonts on a Mac OS X machine are:

- Download the Mathematica 5 fonts from http://support.wolfram.com/mathematica/systems/linux/general/files/MathFonts_52_Linux.tar.gz
- This contains three directories... Fonts/AFM, Fonts/BDF and Fonts/Type1. Only BDF and Type1 are really needed.

- Put the fonts where the Apple X11 server will find them, in
`/usr/X11R6/lib/X11/fonts`- You should create a subdirectory in there; the name
`mathematica`would make sense.

- You should create a subdirectory in there; the name
- Untar the file in the directory you just created: cd /usr/X11R6/lib/X11/fonts/mathematica; tar zxvf /path/to/MathFonts_52_Linux.tar.gz
- Regenerate the fonts.dir file (otherwise Mathematica will crash) with '
`mkfontdir BDF Type1`' - To see what fonts X already knows about, run '
`xset q`' and look for the directories specified by "Font Path." - Add the font database to X
- Type '
`xset fp+ /usr/X11R6/lib/X11/fonts/mathematica/BDF,/usr/X11R6/lib/X11/fonts/mathematica/Type1 ; xset fp rehash`' to do this to the current session. You can then use '`xset q`' to see that X knows about the Mathematica fonts. - AFM isn't necessary for this to work.

- Type '
- Edit /etc/X11/xinit/xinitrc to make the change permanent
- To make the new fonts show up all the time, you'll have to tell X11 about them when it starts. Edit the xinitrc file and add the two 'xset fp' commands from above to the file,
*before*the window manager line.

- To make the new fonts show up all the time, you'll have to tell X11 about them when it starts. Edit the xinitrc file and add the two 'xset fp' commands from above to the file,

**NOTE:**

- The commands mkfontdir and xset are in /usr/X11R6/bin, which is not usually in the default PATH. In order to run them you have to specify the full path to the binary. Also, most of the above will require root or super user access, so either '
`su - root`' first (if you've enabled the root account) or use '`sudo`' to gain the appropriate privileges.

## Crashes

### Bad Atom Errors/SIGSEGV Errors

These errors might stem from not using X11ForwardTrusted if you're running it across an SSH session. Have a look here for more information.