Mathematica For Physicists - What is a Notebook?

1. Cells and Styling

Insert Cell.
    Multiple lines.

Alt - Enter for new cell.

Alt - Number Keys, change between types of cells.

Alt-7 for text cell.

2. Basic Evaluation

A. Shift-enter for evaluation

1+2

15*5

15 5

3^2

(3^2)

Ctrl+^ for exponents.

(I^2)

(((3+I))^3)

(I^2)

Esc + ii + Esc -> i

π

N[π]

B. Equals for defining variables

a=10;

b=6;

a b

Sum i for i = 1 to n.

n=30;

Dynamic[Sum[i,{i,1,n}]]

Dynamic[n(n+1)/2]

C. F1 for help

NIntegrate[(E^(-(x^2))),{x,-1,1}]

2 N[ Erf[1] ]

Sqrt[π] N[Erf[1]]

D. Prefix (@) and postfix (//) application

Simplify[(x^2)+2x+1]

(x^2)+2x+1//Simplify

Simplify@((x^2)+2x+1)

Simplify[Log[c]-Log[d]]

Simplify[Log[c]-Log[d],{c>0,d>0}]

3. Timing and Aborting

matrix=Table[RandomReal[],{i,1,1000},{j,1,1000}];

Eigenvalues[matrix]//AbsoluteTiming//First

mat[n_]:=Table[RandomReal[],{i,1,n},{j,1,n}];

ListPlot[Table[{n,First@AbsoluteTiming@Eigenvalues@mat[n]},{n,200,400,5}]]

First@AbsoluteTiming@function -> how long function takes to evaluate

ListPlot function does a scatter graph of points