Introduction to Mathematical Software

21-126, Spring 2000
Dr David Handron

Lesson 1

Mathematica Interface

Notebooks are made from cells which automatically get combined into groups

Cell groups may be opened or closed and may be copied and pasted as whole units.

Mathematica's cursor is a horozonatal line that sits between cells. When the cursor is displayed, typing at the keyboard causes a new input cell to be formed by default.

To get Mathematica to execute commands in an input cell, use the Enter key or Shift-Return

By default, there is just one copy of the Mathematica kernel running, and all windows are connected to it.

Basic Syntax and Conventions

All commands begin with an upper case letter, and function arguments are grouped within square brackets:

N[Pi]

Sin[Pi/6]

Use parenthises () to order arithmetic operations. The usual mathematical convention concerning the omission of a multiplication sign is used.

3  +  2 6(3  +  2) 6

8^1/38^(1/3)

3  x x\(3  xx
\)

Numbers involving a decimal point are approximate. Any expression containing an approximate number is also approximately, and will be computed as such.

11/7  +  4/511.0/7  +  4/5

2.0 Sin[17]

Curly braces {} are used to represent lists.

Sum[i^2,  {i, 1, 10}]

Commands ending with Q return Boolean values of true or false

PrimeQ[17]PrimeQ[18]

Functions of one argument such as f[x] can be evaluated using the alternative syntax
x // f

Sin[17]N[ Sin[17] ]Sin[17]  //  N17  //  Sin  //  N

The % sign refers to the last output, %% the second to last and %[n] the n-th output.

Sin[17]N[ % ]%%  //  N

Help System

The Help menu at the top left hand corner of the window has a point and click index of commands and their usage.

To get help on a specific command, use ? or ?? for more detailed information

?Sum

The wild card character * is allowed with ?. To find all of the query commands, use

?*Q

To find all commands containing the word prime use

?*rime*

Notice that ?*prime* would not work, since Mathematica often uses capital letters

?*prime*