General

Notebooks:
Double click on right margins to open or close cells.
Delete key or scissors box will delete a highlighted cell.
You can correct commands by editing, and reexecute them.
Evaluate expression: shift + return
To interrupt a calculation: alt + comma
Numerically Evaluate: N[expr], or expr // N. To n digits: N[expr,n].
Above formula: %, next to last: %%, n'th previous: Out[-n].
Multiply: space or *
Power: x^n
Factorial[n] or n!

Information

?Name - shows information on operation
??Name - shows all information on operation
?Na* - shows list of operations starting with Na

Assignments

Definite: x = a
Indefinite: x := a
Clear: x = ., or Clear[x].
To use n'th output: Out[n], or %n.
To use n'th input: In[n]

Constants

Pi, E = e = 2.718, Infinity, Degree = Pi/180 to convert degrees to radians.

Input and Output

Input Mathematica notebooks: Use Open on File Menu
Output Mathematica notebooks: Use Save or Save As on File Menu. Can Save as notebook, postscript file, TeX file, HTML file, RTF file, etc.
Packages: Use Import on File Menu and click open the Packages directory
and its subdirectories.

Input and Output of Kernel Files

<< name or
Get["name"] or
Needs["name"]
Writing to plain text mathematica kernel files:
expr >> name of file
expr >>> name appends expr to file
!!name displays plain text file
Save["name", f, g, ...] Saves definitions of variables in a file

Defining Function:

f[x-] := function of x

Complex Numbers:

Form: x+Iy
Functions: Re[z], Im[z], Abs[z], Arg[z], Conjugate[z]

Algebraic Manipulation

Expand[ ]
Factor[ ]
Simplify[ ]
Apply transformation rule: expr /. lhs -> rhs

Loops

Do[expr,{i,imax}] loops i=1 to imax
Do[expr,{i,imin,imax,di}] loops i=imin to imax by di

Roots

Findroot[ lhs == rhs,{x,x0}] starting numerics at x=x0

Calculus

Derivatives

D[f,x]
D[f,{x,n}] n'th derivative
D[f,x1,x2,...] multiple derivative
Total derivative
Dt[f]
Dt[f,x]

Integrals

Indefinite integral: Integrate[f,x]
Definite integral: Integrate[f,{x,xmin,xmax}]
Numerical integration: NIntegrate[f,{x,xmin,xmax}]

Solving Differential Equations

General solution - use y[x] everywhere and have constants in output:
DSolve[ y'[x] == a y[x], y[x], x]
Solution with all initial conditions at the same point:
DSolve[ y''[x] + 6 y'[x] + 9 y[x] == 0, y[0]=1, y'[0]=2, y[x], x]
Numerical solution:
NDSolve[ eqn., y, {x, xmin, xmax}]
Plotting the solution:
Plot[ Evaluate[ y[x] /. %], {x, 0, 1}]
For several connected equations and dependent yi:
NDSolve[{eqn.1, eqn.2, ...}, {y1, y2, ...}, {x, xmin, xmax}]

Series

Series[ expr, {x, x0, n}] expands about x0 to order n
Normal[%] truncates series to use as a function

Special Functions

Gamma, LogGamma
BesselJ[n,z], BesselY[n,z], BesselI[n,z], BesselK[n,z]
LegendreP, LegendreQ, SphericalHarmonicY
ExpIntegralE, ExpIntegralEi
LaguerreL, HermiteH, ChebyshevT
Hypergeometric0F1, Hypergeometric1F1, Hypergeometric2F1, HypergeometricU
EllipticE, EllipticExp, EllipticF, EllipticK, EllipticLog, EllipticPi, EllipticTheta
AiryAi, AiryBi

Limits

Limit[ expr, x-> x0]

Numerical Minimization

FindMinimum[ f(x), {x, x0}] starts at x0.

Tables (Lists)

Table[ f, {imax}] imax copies of f
Table[ f(i), {i, imax}] table of f(i) for i=1, 2, ...imax
Table[ f(i), {i, imin, imax}] table for integers i from imin to imax
Table[ f(i), {i, imin, imax, di}] increment by di

Dennis Silverman