January 26, 1996 and February 2, 1996
DSP Design Group Meeting
In[1]:= x^2 + 2 x + K x
2
Out[1]= 2 x + K x + x
In[2]:= TreeForm[ x^2 + 2 x + K x ]
Out[2]//TreeForm= Plus[| , | , | ]
Times[2, x] Times[K, x] Power[x, 2]
In[3]:= Map[ Function[x, x^2], {1, 2, 3} ]
Out[3]= {1, 4, 9}
In[4]:= {1, 2, 3}^2
Out[4]= {1, 4, 9}
In[5]:= Log[2 x y] //. { Log[a_ b_] :> Log[a] + Log[b] }
Out[5]= Log[2] + Log[x] + Log[y]
In[6]:= fstream = OpenWrite["x.dat"] Out[6]= OutputStream[x.dat, 3] In[7]:= Put[x, fstream] In[8]:= Close[fstream] Out[8]= x.dat In[9]:= !!x.dat x
In[11]:= sum = 0; For [ i = 0, i < 100, i++, sum += i ]; sum Out[11]= 4950
In[15]:= Needs[ "Calculus`Master`" ]
In[16]:= FourierTrigSeries[x, {x, 0, T}, 3]
2 Pi x 4 Pi x 6 Pi x
T Sin[------] T Sin[------] T Sin[------]
T T T T
Out[16]= - - ------------- - ------------- - -------------
2 Pi 2 Pi 3 Pi
The Needs command tells Mathematica what packages you might use.
Then, we you use a command from one of the packages, Mathematica
will automatically load in the package. Mathematica packages are
the same as Lisp packages. They have their own contexts
(name spaces) for variables.
By loading in the Master file for a package, Mathematica gets a list of all of the new routines and what file they are in. To find the value of the path:
In[17]:= $Path
Out[17]= {., ~, /usr/tools/tools2/mathematica/Install/Preload,
> /usr/tools/tools2/mathematica/StartUp,
> /usr/tools/tools2/mathematica/Packages,
> /usr/tools/tools2/mathematica/Applications,
> /usr/tools/lib/mathematica/Packages}
These > markers indicate the output takes multiple lines and
appear at the beginning of each line.
The > markers can be changed by setting a global variable.
mathematica /usr/tools/lib/mathematica/Notebooks/StrumAndKirk/introduction.mawhich will run the X windows front end and open the "introduction.ma" notebook. Notebooks are explained next.
math2html converts notebooks to "outline-form"
Web documents