Introduction.nb

The First Steps

Here is a first command to try:

2 + 3

To evaluate 2+3, highlight the leftmost bracket to the right of the command, and hit SHIFT and ENTER at the same time. Try it now!

For a few seconds nothing happens (while the Mathematica "kernel" loads), and then hopefully you see the correct answer below the input. The time delay will happen only once: Change the two numbers and evaluate again; this time the answer should be almost immediate.

1. Evaluate an expression by hitting SHIFT and ENTER simultaneously.

Simply hitting the ENTER key moves you to the next line. Try it! Move the cursor below this line and start typing to create new input.

Two Pitfalls for Newcomers: Capitalization and Parentheses

2. Every command in Mathematica is capitalized.

This takes some time to get used to!
The next command computes the sine of 0.4 (in radian measure), the one below does not work.

Sin[0.4]

sin[0.4]

3. Function input is delimited by square brackets.

You will use three kinds of delimiters: 
square brackets "[" and "]", 
parentheses "(" and ")",  
and brackets "{" and "}".
All three have special meaning; they are not interchangeable.

Square brackets delimit the argument of a function. Here are a few examples:

Sqrt[3]

Integrate[x^2, x]

Integrate[2 Cos[y], y]

Parentheses are used to determine the order of operations:

1/x + 2

1/(x + 2)

Here is a more convoluted example:

((x + 2)^2 + 5)/(Sqrt[x] + 1/(x + 4)^3)

Brackets are reserved to denote "lists". You will encounter lists most often as input to a command:

The command below tells Mathematica to integrate the function f(x)=x^2 from x=0 to x=3:

Integrate[x^2, {x, 0, 3}]

Here is an another example, where a list is used in a similar way, to let Mathematica know that we want to see the graph of the function from x=-1 to x=3.

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

Names for Common Functions and Constants

"E" stands for Euler's Constant,"Pi" stands for π, "I" for the imaginary unit:

E
Pi
I
I^2

By the way, if you want to see a numerical value of symbolic expressions, use the function "N".

N[E]
N[Pi]

Usually Mathematica shows you 6 significant digits; you can overwrite the default for more information:

N[Pi, 25]

Here are the exponential function and the natural log:

Exp[2]
Log[E^2]

You can also use other bases for the logarithm; here is the logarithm with base 5 of 25:

Log[5, 25]

The square root function is denoted by "Sqrt":

Sqrt[2]N[Sqrt[2]]

Last not least, a list of the trigonometric functions. All of them use radian measure!

Sin[Pi/4]
N[Sin[Pi/4]]
Cos[0]
Tan[Pi/3]
Sec[Pi/4]
ArcSin[1/2]
\(ArcTan[1]
\)

Etc.

Author: H. Knaust (helmut@math.utep.edu)
Created: August 2000
Last Edits: February 3, 2001