Reference Guide:
Getting Help, Saving Your Work, Mathematical Typesetting,
Document Preparation

1. The Web Site

The Maths Lab web site is

http://metric.ma.ic.ac.uk/chem

You will find there copies of the Mathematica notebooks for the Maths Lab, plus information about the Experiments in Undergraduate Mathematics, a collection of Mathematica-based materials that you may find useful for (re-)studying topics in calculus, vectors, matrices and complex numbers.

2. Getting Help

The reference book for Mathematica is The Mathematica Book by Stephen Wolfram (N.B. it should be the fourth edition, previous editions describe old versions of the software). Copies of this may be found in the Central Library. However, you have much more convenient access to the book, and  other information, via Mathematica's Help menu. Help information is also viewable on the web at http://documents.wolfram.com.

The Help system is divided into six sections ("Built-in  functions",  "Add-ons",  "The Mathematica book",  "Getting   Started/Demos", "Other Information" and "Master Index"). You can browse through the different levels of these sections by clicking on one of the section buttons and tracking through the contents (for example, information on the command "Plot" is located at Built-in functions -> Graphics and Sound -> 2D Plots). Or you can do a search by typing an expression into  the box next to the "Go To" button; "Master Index" is the most general search location. 

The online help pages are themselves Mathematica notebooks, and you can copy-paste any part of them, e.g. example commands, into your own notebooks.

3. Saving your Work

You should always keep a record of your work in the Maths Lab. Moreover, don't trust computers to take care of your documents with 100% reliability. After you complete each section of a Lab you should save your work to at least two locations (such as the local hard disk of the computer, your personal area of the networked hard disk, or a floppy disk). Keep your notebooks small - start a fresh notebook at least every Maths Lab session and preferably more often. 

Save your notebooks every few minutes whilst you are working; that way you will never lose very much in the event of the Mathematica program crashing (which will happen from time to time!). If you are using a floppy disk, try to avoid saving to it directly (this is very slow and can, rarely, corrupt files); instead, make a copy on the local hard disk whilst you are working, then copy the final version to the floppy when you have finished.

If you need to reduce the disk space occupied by your saved work clear all of the output you have produced before you save a notebook. Do this by going to the Kernel pull down menu and selecting Delete All Output. To reproduce your work later all you have to do is re-execute your input statements. Saving without graphical output especially saves a lot of disk space (e.g. a single 3-D graphic can easily occupy 150 Kbytes of space -- that's more than 10% of a floppy disk).

Problems with quota limits on the PC computers: your personal filespace on the PCs (usually known as "H:") has a maximum allowed capacity (quota, in computing language). In previous years, we've seen problems when Mathematica tries to save a notebook that cannot fit within your quota: instead of doing the sensible thing of refusing to save and telling you that there's a problem, Mathematica will often save an incomplete version of your notebook! Needless to say, the outcome of this mistake is usually disastrous. To guard against this problem, manage your filespace carefully: (1) save Mathematica notebooks without graphical outputs (see above); (2) use "Windows NT Explorer" to check on the contents of your filespace, and delete unwanted files regularly.

4. Mathematical Typesetting

Mathematica has a sophisticated typesetting capability. This means that many Mathematica commands can be entered in a form that looks much more like ordinary mathematical notation. For example: to integrate (x^2) between x = –1 and  x =1, you can type

Integrate[x^2,  {x,  -1,  1}]

But, if you prefer, you can enter it as

(∫_(-1)^1) (x^2) \[DifferentialD]x

and get the same result when you evaluate. You may prefer not to do this: you may like your Mathematica commands to look like computer code (which is what they are) rather than mathematical expressions (which they merely correspond to). But if you do want to use typesetting in this way, here's what you do.

First, make sure that you have on your screen a window the top of which looks like this:

({{(\[SelectionPlaceholder]^\[Placeholder]), (\[SelectionPlaceholder]/\[Placeholder])}, {(Sqrt[\[SelectionPlaceholder]]), (\[SelectionPlaceholder]^(1/\[Placeholder]))}, {∫\[SelectionPlaceholder] \[DifferentialD]\[Placeholder], (∂_\[Placeholder]) \[SelectionPlaceholder]}, {(∫_\[Placeholder]^\[Placeholder]) \[SelectionPlaceholder] \[DifferentialD]\[Placeholder], (∂_(\[Placeholder], \[Placeholder]))\[SelectionPlaceholder]}, {(∑_(\[Placeholder] = \[Placeholder])^\[Placeholder]) \[SelectionPlaceholder], (∏_(\[Placeholder] = \[Placeholder])^\[Placeholder]) \[SelectionPlaceholder]}, {(({{\[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder]}})), (Subscript[\[SelectionPlaceholder], [[\[Placeholder]]]])}})

This is called the Basic Input Palette. If you don't have it on your screen, you can open it by selecting the Palettes submenu from the File menu, then going on to select BasicInput. 

Now, click on the  \(∫\_□\%□ ■ d□\) button. Something looking like this

(∫_\[Placeholder]^\[Placeholder]) \[Placeholder] \[DifferentialD]\[Placeholder]

will appear in your notebook. Insert –1 and 1 in the boxes at the bottom and top of the integral sign, and x at the end. When you get to the box in the middle, click in it and then click the (■^□) button. Then fill in the x and the 2, and what you have should look like this:

(∫_(-1)^1) (x^2) \[DifferentialD]x

"Shift-return" as normal to evaluate the cell.

The rest of the Basic Input palette works pretty much as you'd expect. Try

(Sqrt[8])

(Sqrt[8.0])

(8^(1/3))

(∑_(r = 1)^5) r

(∑_(r = 1)^n) r

(({{1, 2}, {3, 4}})).(({{1, 3}, {2, 4}}))

Inverse[(({{1, 2}, {3, 4}}))]

and so on. You may not be familiar with the notation used by the (∂_□) ■ button, but see if you can work out what it does. Try:

(∂_x) (x^2)

(∂_x) Sin[x]

and so on.

There are other palettes that come with Mathematica; these are also to be found in the Palettes submenu, and you might like to explore them if you get time. If you're feeling ambitious, it's even possible to build your own, "customised" palettes. The Mathematica Book (printed, or in online help) is the best place to find out more about this aspect of Mathematica.

5. Dealing with Brackets

Brackets can be a major cause of frustration in working with Mathematica. Not only do you need to use lots of "nested" brackets (i.e. brackets within brackets), but there are three different kinds of brackets that do totally different jobs. Actually, nearly everyone gets the hang of the different kinds pretty soon: square brackets, [...], always go around the arguments of functions; curly brackets, {...}, are always used to make lists;  and round brackets (...) are always used for grouping in algebraic (and other) expressions.

So far as nesting brackets goes, and especially forgetting to put a closing bracket in the right place, these are things that nearly everyone has problems with some of the time. So Mathematica provides no less than four features that can help:

(1) As you type in to Mathematica, you'll notice that each bracket appears in purple until a matching closing bracket is typed. 

(2) And when the closing bracket is typed, the cursor will jump momentarily to the corresponding opening bracket. 

(3) The (blue) error messages will tell you when a missing (or wrong type of) bracket problem has occurred, and suggest where the problem is.

(4) In the Edit menu there is an item Check Balance: if you highlight any bracket and then select this item, all the text up to the matching bracket will be highlighted; but if there is no matching bracket, nothing happens.

6. Hidden shortcuts

Mathematica has three "shortcut" features that are great if you're feeling lazy. On a Macintosh, they all make use of the "command" key, which is on the bottom row of the keyboard just to the left of the space bar: the one with an apple on the left and a "four-petal" shape on the right. On a Windows PC the "Ctrl" key is the equivalent of "command".

Command-k or Ctrl-k

Fed up with the long function names you get in Mathematica? To save time, just type the first few characters of the word, then hold down "command" and press the k key. If Mathematica knows what you mean, it will complete the word for you. Try:

Der<command - k>

Bino<command - k>

ContourP<command - k>

If there's ambiguity, you'll be offered a menu of words to choose from. Try

Para<command - k>

Int<command - k>

ArcT<command - k>

It works for option names as well as function names. Try using command-k, for example, to go from

Plot[x^2,{x, -3, 3},As<command - k>

to

Plot[x^2, {x, -3, 3}, AspectRatio -> 1]

Command-Shift-K or Ctrl-Shift-K

With Mathematica commands that have several inputs ("arguments") it can be hard to remember what goes where, whether curly brackets are needed, etc. As an alternative to using the online help system, you can type the name of a command, say

ParametricPlot

then hold down command and shift and K - you'll get a "template" for ParametricPlot that you can simply edit in place:

ParametricPlot[{fx,  fy},  {t,  tmin,  tmax}]

Command-l or Ctrl-l

Command-l (that's a lower-case "L", not a one) simply creates a copy of the last input line, which is really useful if (as is often the case) the next one is going to be pretty similar. For example, consider the input-output sequence

Series[Cos[x], {x, 0, 4}]

Suppose I now want the series up to (x^6) but that I don't want to overwrite the last output. I could type again from scratch, or use the copy and paste functions from the Edit menu. But command-l simply rewrites the line

Series[Cos[x], {x, 0, 4}]

and it's an easy job to change the 4 to a 6.

7. Document preparation

You will be expected to produce well presented documents for your assignments using Mathematica, and to do this the main thing you need to know about is how to format cell styles. Ordinarily, when you type into Mathematica,

the text looks like this.

To get it to look the text in this cell (i.e. a regular Times font), simply click on the cell bracket on the right, then go to the Style submenu of the Format menu and select Text. You can also set up titles, sections and subsection headings in the same way. (You can also make style changes using the keyboard shortcuts indicated on the right-hand side of the Style submenu.)

Besides making your text look like word-processor text, the style change has another important effect of making the cell "inactive", so nothing happens when you evaluate it. Compare what happens when you evaluate the following two cells (the first is in "Input" style, the second in "Text"):

Besides making your text look like word - 
        processor text ...

Besides making your text look like word-processor text...

Using the right cell styles, you can then safely select collections of cells and "shift-return" will evaluate only those that are inputs.

Mathematical typesetting can be used for preparing text as well as writing Mathematica inputs. Using palettes, it's possible to embed fairly complicated mathematical expressions such as (∫_0^∞) 
              (x^2) dx in the middle of ordinary text. The complete collection of  typesetting palettes is accessed via Palettes in the File menu. Besides the standard algebraic constructions (square roots, fractions, subscripts and superscripts, integrals, sums, etc), there is a large collection of special symbols (including greek letters),  mathematical operators, accented letters (á, à, ö, ç, etc), and more.