![[Rotating icosaheadron around Vandy leaf]](../../pix/icosleaf.gif)
This web page is intended only as an introduction. Further information can be found at other websites devoted to Mathematica; a list of such sites is maintained by Wolfram.
atlas 7 % mathematica &
Within this graphical interface, you can intermingle text, Mathematica
programming commands and their output, graphics and animation in a
single document or notebook.
This interface also makes it easy to print your notebooks on one of the laser
printers.
If you are not at a graphics terminal, you may still run Mathematica (but without the ability to see graphical output) by using the terminal interface, accessed by typing
atlas 8 % math
This terminal interface may also be used from within an X window; any
graphical output will be displayed in its own window, created at the time of
output.
Exit" ends your Mathematica session.
Input:
Plot[BesselJ[1, x], {x,-20,20}]
Output:
Input:
ParametricPlot3D[{t/3, u Cos[t], u Sin[t]}, {t,0,10}, {u,-1,1}]
Output:
Input:
Simplify[D[2x Sinh[x y]^3, {x,2}]]
Output:
3 y Sinh[x y] (x y + 3 x y Cosh[2 x y] + 2 Sinh[2 x y])and its graph:
Input:
Plot3D[%, {x,-1,1}, {y,-1,1}]
Output:
Input:
g[u_]:=E^(-((x-u)^2)/(4k t))and its integral, evaluated symbolically from 0 to a:
Input:
Simplify[Integrate[g[u],{u,0,a}]]
Output:
a - x x
Sqrt[k] Sqrt[Pi] Sqrt[t] (Erf[-----------------] + Erf[-----------------])
2 Sqrt[k] Sqrt[t] 2 Sqrt[k] Sqrt[t]
Now the temperature at time t and point x
along an infinite rod with initial hot spot at the origin and heat
diffusivity k can be found by the limit:
Input:
Limit[%/(2a Sqrt[Pi k t]),a->0]Output:
1
--------------------------
2
x /(4 k t)
2 E Sqrt[k Pi t]
Setting k=1, we can plot this temperature distribution through
time as a surface:
Input:
k=1;
Plot3D[%,{t,.01,.5}, {x,-1,1},
PlotPoints->30,
PlotRange->All,
AxesLabel->{"t","x",None}]
Output:
xrow and yrow,
in counter-clockwise order.
Input:
xrow={2,1,3};
yrow={3,1,1.5};
BaryCoords[x_,y_]:=Chop[LinearSolve[{{1,1,1}, xrow, yrow}, {1,x,y}]];
BernsteinBasis[i_,j_,k_,x_,y_]:=Module[
{b = BaryCoords[x,y]},
Which[ b[[1]]<0 || b[[2]]<0 || b[[3]]<0, 0,
j+k==0, b[[1]]^i,
i+k==0, b[[2]]^j,
i+j==0, b[[3]]^k,
i==0, (j+k)!/(j! k!) b[[2]]^j b[[3]]^k,
j==0, (i+k)!/(i! k!) b[[1]]^i b[[3]]^k,
k==0, (i+j)!/(i! j!) b[[1]]^i b[[2]]^j,
True, (i+j+k)!/(i! j! k!) b[[1]]^i b[[2]]^j b[[3]]^k] ]
PlotBB[i_,j_,k_]:=Plot3D[Evaluate[BernsteinBasis[i,j,k,x,y]],
{x,Min[xrow],Max[xrow]},
{y,Min[yrow],Max[yrow]},
PlotRange->{0,BernsteinBasis[i,j,k,
({i,j,k}.xrow)/(i+j+k),
({i,j,k}.yrow)/(i+j+k)]},
PlotPoints->100, ClipFill->None,
Mesh->False]
The functions BernsteinBasis[i,j,k,x,y], for all integers
i+j+k=d, form a basis for the space of bivariate
polynomials of total degree d defined over the triangle T.
Here, we view a quintic basis function:
Input:
PlotBB[1,3,1]Output:
%" denotes the immediately preceding output.
a b" denotes multiplication of a
by b.
a==b" has value "True"
if a=b and "False" otherwise.
Simplify[...]" displays the output of its
argument in an often much simpler form.
Module[{...}, ...]" is a command that allows local
variables to be defined (within the initial curly braces) and used
within the contents of the module. Mathematica likes modules.
N[...]" forces a numerical approximation of the
argument rather than representing the result exactly.
Evaluate[...]" is often needed to wrap user-defined
functions when they are plotted.
Within Mathematica,
typing ?Foo gives a brief description of command
Foo and its syntax.
If you are running the notebook interface for Mathematica, the
online function browser can also be useful in this regard---just select
Help in the top menu.
There are also many extensions to Mathematica which must be loaded into memory in separate packages before gaining access to the additional commands they contain. The Mathematica manual contains examples of several of these useful extensions. You might also browse the thick purple and white softcover Guide to Standard Mathematica Packages for more recent extensions, organized by content.
To insert the (non-animated) mathematica graphics into this webpage, I ran
the terminal
version of Mathematica from within an X window (on a color graphics
workstation) and created GIF files from the resulting
Mathematica graphics output windows using the "grab"
feature of the nifty picture manipulation program xv.
These GIF files can then be called by the corresponding
HTML codes to display the pictures within a webpage.
To see the xv manual, start up Netscape and enter this URL
(which begins with "ftp" rather than the usual "http"):
The xv manual is also available (and better looking) in postscript; you can see it if you go to an X-Windows terminal and type
Inserting animated graphics involves another step after the
creation of the GIF files (one for each frame of
animation). The
Animate Page
offers a free automated service that collates your GIF
files into one animated GIF file which Netscape and
other browsers can view (these animated GIF files are
called by the corresponding HTML code just like any other picture file).
Version of July 17, 1997 by David Assaf. Modified slightly by webmaster.