. Mathematica Basics

Paul Abbott

Pre-requisites

To improve the appearance of graphics, TraditionalForm will be used as the default format type for text that appears in graphics,

$FormatType = TraditionalForm;

and the default style for text in graphics is set as follows.

$TextStyle = {FontSize -> 10};

To learn more about Mathematica The Help Browser is the primary reference. Choosing Help. . . from the Help menu at any time gives you access to Mathematica’s on-line documentation. An overview of the capabilities of Mathematica is presented in the Tour of Mathematica section, and it is also suggested that you browse through the Practical Introduction section.

.. On-line Help

To find out what a particular command does, you can use the on-line help system. Choosing Help. . . from the Help menu at any time accesses Mathematica’s on-line documentation.

.. Command Completion

The long names can be difficult to enter, especially if you are a slow typist. Command completion increases the speed, correctness, and convenience of Notebooks.

Enter Bess, then select Complete Selection under the Input menu. The completions window,

will pop up and you can select which command you desire using the mouse, here BesselJ. This is advantageous for long commands.

See, Mathematica knows a bit about you already.

.. Templates

Templates work much like command completion. The Make Template command is also found under the Input menu.

Alternatively, you can use the Basic Calculations palette to find out more about how to use a function.

. Basic Calculations

Read the Mathematica as a Calculator section of the Tour of Mathematica and then attempt the following exercises. If it is not already open, you may find the Basic Input palette helpful. For more information on palettes see Using Palettes.

.. Getting Started

You can use Mathematica as an enhanced scientific calculator.  Let's start with a simple example.

You should have just evaluated (3^1000).

The % indicates the last expression.  Similarly %% indicates the second-last expression. Alternatively, expressions can be named using assignment (denoted using  = ).

You should get the value of π to two hundred decimal places.

.. More Functions

Mathematica knows about a big collection of mathematical functions — nearly all those you will find in any book of mathematical tables.

Mathematica can do many kinds of exact computations with integers.

FactorInteger produces a set of pairs of numbers which are …

.. Simple Expressions

Mathematica can deal with mathematical formulas in algebraic form.

.. Basic Plots

The above sections have guided you through each calculation.  Now you are expected to use palettes such as the Basic Calculations palette or on-line help to work out how to achieve each of the following tasks.

.. Calculus

You can do calculus.  Try a simple integral:

You can also get exact solutions to many definite integrals.

Many integrals do not have a simple closed form.  If you try such a definite integral it will be returned unevaluated.  You can still use N to get a numerical answer.

.. Solving Equations

.. Matrices

Entering matrices

Matrices can be entered using List brackets ({}). Alternatively, they can be entered using the Basic Input palette or from the Create Table/Matrix/Palette… entry under the Input menu.

Linear algebra

Mathematica also does linear algebra on symbolic matrices.

Pauli spin matrices

Enter the following three (Pauli spin) matrices.

σ/:(Subscript[σ, 1])=(({{0, -I}, {I, 0}}));

σ/:(Subscript[σ, 2])=(({{1, 0}, {0, -1}}));

σ/:(Subscript[σ, 3])=(({{0, 1}, {1, 0}}));

In general matrices do not commute.

In general, it is possible to express the commutator of two of the Pauli matrices as a linear combination of the (Subscript[σ, i]) matrices. For example

⟨(Subscript[σ, 1]), (Subscript[σ, 2])⟩ == 2  I (Subscript[σ, 3])

These coefficients are called the structure coefficients of the Lie algebra.

.. Curve Fitting

We could plot this table but the dynamic range is so large that it would be difficult to produce a meaningful plot. Let us take the logarithm of these values.

Now that we have a table of values we can plot it using the ListPlot command.

.. Series

Manipulation of Series

Higher orders

Complex Series