Mathematica
Foundations
Steven Tschantz
1/18/11
A theory for
Mathematica
To understand a complex system like
Mathematica
, it helps to break it down into its basic components, formulate its basic
underlying principles and rules, abstract and simplify its behavior. It helps to have more than a collection of examples and
catalog of instances. In short, it helps to have a theory of that system, a model predicting how that system behaves.
Operating with
Mathematica
Elements of the
Mathematica
system
Mathematica
is a computer algebra system, a program that lets you do symbolic and numerical computations, but it is also a
program to facilitate recording and presenting such computations. The
Mathematica
front-end is a specialized editor that
manages
Mathematica
files, called notebooks, containing text, input expressions, calculation results, and interactive graphics
(and other dynamic elements). Actual calculations are carried out by a second program, the
Mathematica
kernel, controlled
from the
Mathematica
front-end.
Mathematica
uses its own formal language to express calculations, similar to, but more
precise and restricted than ordinary mathematical notation, eliminating ambiguity and enabling algorithmic manipulation.
Mathematica
will format output much as ordinary mathematical notation, and can interpret certain notations in input, but
input is usually linear, using the
Mathematica
language, as in programming.
Using notebooks
The first idea for using
Mathematica
notebooks is simply as a recording of inputs to the
Mathematica
kernel and outputs
returned, documentation of experiments like a scientist's lab notebook. If you select File/New/Notebook from the menu, you
get a new blank untitled notebook. Type and your typing goes in an input cell. Press shift-enter and the input is evaluated,
output placed under the input, and the insertion point moved below ready for typing another input. Inputs are labeled as
evaluated, and outputs are given corresponding labels, so the whole history of a conversation with the
Mathematica
kernel is
made apparent. This is useful since inputs to the
Mathematica
kernel often have side-effects. Assignments are remembered by
the kernel, going back and editing the input does not change what the kernel is assuming, and reevaluating may not always
change the state of the kernel in the way you expect.
Once you have a satisfactory computation, you can go back and edit your notebok, deleting unnecessary inputs and outputs,
and adding text comments. The second idea for using notebooks is to document your calculations. Your goal should be to
give all of the inputs in the order needed to calculate your results, so that you could start over, reopen the notebook and
reevauate all of the inputs to get the same outputs, a kind of proof of calculation. Inputs and outputs usually don't explain the
meaning of what's been calculated, so you should annotate your calculations with text so that someone reading your notebook
can understand your thinking and intent.