A computer symbolic algebra system.

## Basics

I’m all about open-source tools, as a rule. Mathematica is not that. But the fact remains that the best table of integrals that exists is Mathematica, that emergent computation of the cellular automaton that implements Stephen Wolfram’s mind. I should probably work out what else it does, while I have a their seductively cheap student-license edition chugging away.

### Pros

- Magickal calculus engine. It gives you all the integrals you can eat, but at great cost to your soul.
- Built-in latex editor

### Cons

- It’s a weird language, with horrible default scoping (Cross-document namespace pollution? Really?)
- Even as probably the most popular computer algebra system, just not
*that*popular. Ergo, weak community.

## Tips

The substitution operator is
`/.`

which is terrible to search for.
The help easiest to find under the alias `ReplaceAll`

.

`{x, x^2, y, z} /. x -> 1`

Comments syntax:

`(* stuff *)`

Typing symbols is easy; just use the combination of `Esc`

and autocomplete.

Scope is weird per default: most tutorials have you executing everything in promiscuous global scope.
Also when a symbol is resolved nd how a function is evaluated are both unusual.
Since I am not a heavy Mathematica user, half my time is spent debugging problems with stale definitions and weird scope behaviour.
To get various approximations to local scope, keywords to look for are `Hold`

, `Block`

and delayed assignment.
Multiple clashing function definitions will hang around silently conflicting with one another;
use `ClearAll`

to remove all the definitions of a term to avoid this.
As David Reiss points out, if you define

```
g[x_]:=x^2
g[2]:="cheese"
```

then when you execute `g[2]`

you get `"cheese"`

and not `4`

.

## Links

Here are some links that I have found useful.

- James J. Kelly’s Essential Mathematica for Students of Science