The following is a summary of commands for Mathematica.
Remember, Mathematica is case sensitive.
To obtain an answer (output), press "Shift + Enter". For example,
to find the integral of
[1+5x2]dx, from x=0 to x=10, type the following as input:
Integrate[(1+5*x^2) , {x, 0, 10}] . Then press "Shift + Enter".
The answer is 5030/3.
Differentiation: D[function, variable]. E. G.: D[5x^3+2x^4, x] Then press "Shift + Enter".
Plotting: Plot[ function, {x, xmin, xmax}]
To enlarge a plot to fit on a single page, click
on the graph. Then grab a corner marker and drag
with the mouse to expand the plot area.
After clicking on the graph you may also copy it to the
clipboard and then paste it into another notebook
file. Then expand to fit the page. This gives a
more professional looking graph for submitting
in a report or paper.
Also, to specify ordinate range use:
Plot[ function, {x, xmin, xmax}, PlotRange -> {ymin,ymax}]
MM1. The following is an example from Statistical
Thermodynamics: Plot the following function, which
is the Maxwell-Boltzman velocity distriubtion
function for oxygen moleclues in a gas at T=300K.:
Plot[(y = 3.6*10^-8)*(v^2)*Exp[(-v^2)/157800], {v,0,1000}].
Then press "Shift + Enter."
The number 157800 may also be written as (1.578*10^5), the parentheses being necessary.
In the above expression, y is the fraction of
the total number of molecules that have speed v.
Hence, the integral of y over all velocities
should be 1.00.
MM2. Integrate the above expression for y over
the range v=0 to v= 3000.
You should get 0.9999.
MM3. Plot the function y=e-2xCos[20x] from x=0 to 90 degrees.
Warning: In mathematica functions must
have the first letter as upper case, that is, Cos, not cos.
Also the argument of a function must be in
squre brackets not parentheses. See below:
>= <= grater than or equal to
<= less than or equal to
&& and
|| or
3. Working with Ploynomials
Simplify[expression]
This command tries to produce an expression that is shortest
to write out. Often, the result may be the same.
4. Working with Equations
Solve[{ equation1, equation2 }, {variables to folve for}] Solves a set of equations simultaneously.
FindRoot [ x==Cos [x], {x, 0.75} Ans: {x -> 0.739085}