Some Basic Mathematica

Applications of =

b = a + x

Further appearances of b are replaced by a + x.
x == 2y +3

Here an equation is defined for later solution.
eqn1 = x == 2y+3

Whenever "eqn1" is used in a future Mathematica expression, it represents the equation "x == 2y+3".
f[x_] := x**2

Defines a function f(x)=x2. The Underbar is important. In a later line try typing "f[y^2]" and observe the results.

Replacements

expr /. x -> y

Replace all occurances of x with y in expression expr. For the above definition of "eqn1" try typing the line "eqn2 = eqn2 /. y->z".

File i/o

<< filename

Causes Mathematica to read and process commands in file "filename". If you enter a simple file name with no subdirectory information, Mathematica will look in your home directory for the file. See mathin for an example of one such input file. It is plain text that can be edited with "vi" or your favorite text editor.
x >> filename

Output the definition of x to file "filename".
x >>> filename

Append the definition of x to filename.
Save["filename",x,y,z,...]

Save specified quantities in file "filename"
Save["filename",In]

Save["filename",Out]

Result References

Include any of the following as part of an input expression to perform further operations on a previous result.

%

Use the last result generated. For example "Factor[%]" would factor the algebraic expression printed as a result of your previous command.

%%

The one before that. For example typing "y1=%%", would place the results of your command before the last one into variable y1. Any use of "y1" in future input expressions will be replaced by those results.

%n

If you need results from even older input lines use this. This picks up the contents of the line labeled Out[n].

Lists

Mathmatica often lets you replace individual arguments in functions with lists of arguments in the form "{a,b,c,d}" and produces a result in the form of a list of answers. This is its version of using arrays in Fortran or C.

Some Useful Functions

All internal Mathematica functions (and constants) start with un Upper case letter. It's a good idea to start your own variables and functions with a lower case letter to avoid potential conflicts.

Quit[]

Quit Mathematica
D[f,x]

Partial derivative of f with respect to x. To get the nth derivative use "D[f,{x,n}]". For example try "D[x Cos[x],{x,2}]
Integrate[f,x]

Integrate f with respect to x. Use "Integrate[f,{x,a,b}] to do a definite integral from x=a to x=b. For example try "Integrate[x Sin[x], {x,0,Pi}]"
Solve[{eqn1,eqn2,...},{x1,x2,...}]

Solve the set of equations with respect to the listed variables.
Expand[expr]

Multiply out and take all powers in the expression "expr"

Factor[expr]

Factor the expression "expr"
Simplify[expr]

Find a form of "expr" with the smallest number of terms (often but not always a factorization)
Together[expr]

Gather all terms in the expression "expr" over a common denominator
Apart[expr]

Separate into terms with simple denominators
Cancel[expr]

Cancel common factors in numerators and denominators
Collect[expr,x]

Group expr together by powers of x
Subscripted[f[x1,x2, ...],n]

The first n arguments of f are treated as subscripts.
Subscripted[f[args],{i,j},{k,l}]

Arguments i to j are subscripts k to l are superscripts.