Mathematica's syntax will feel fairly natural after a while.
Use the following notebook to get started.
Execute a few commands until you get a sense for what output
MATHEMATICA
will
produce; try editing the commands; try to make
MATHEMATICA
do something
strange--just try playing with it and you will soon get the hang
of what is going on.
|
MATHEMATICA |
| (notebook Lecture-02) |
| (html Lecture-02) |
| (xml+mathml Lecture-02) |
|
From the above, we see that one way to use
MATHEMATICA
is simply as a
calculator that allows symbols to get carried along.
A number is not returned until all of the symbols in an expression
are defined.
MATHEMATICA
will try to be exact--it does not calculate
by adding
,
it has
an algorithm for adding rational numbers and gives
.
|
MATHEMATICA |
| (notebook Lecture-02) |
| (html Lecture-02) |
| (xml+mathml Lecture-02) |
|
For beginners, most bugs probably crawl into
MATHEMATICA
from not
clearing symbols.
Either get into the habit of clearing your definitions regularly, or
use long descriptive symbol names that are unlikely to get used twice.
There are other options, such as localizing variables and giving
them contexts--but these are subjects better left until we have
mastered the basics.
MATHEMATICA
's built-in functions make it very powerful:
|
MATHEMATICA |
| (notebook Lecture-02) |
| (html Lecture-02) |
| (xml+mathml Lecture-02) |
|
Functions are really just symbols; the fact that a symbol is identified with a function comes from the square-bracket that follows it..
|
MATHEMATICA |
| (notebook Lecture-02) |
| (html Lecture-02) |
| (xml+mathml Lecture-02) |
Calculus
|
MATHEMATICA
does calculus pretty well.
It can integrate functions faster and more accurately than humans
and it takes derivatives.
I think one of the most useful aspects of
MATHEMATICA
is its ability
to do Taylor expansions of a function about a specified point.
|
MATHEMATICA |
| (notebook Lecture-02) |
| (html Lecture-02) |
| (xml+mathml Lecture-02) |
Plotting
|
MATHEMATICA
has quite a few different plotting packages and this
multiplies its power as a math exploration package.
We will explore graphics in more depth later.
|
MATHEMATICA |
| (notebook Lecture-02) |
| (html Lecture-02) |
| (xml+mathml Lecture-02) |
Lists {,} and Matrices {{,},{,}}
|
Picking out parts of a matrix is a bit tedious until you get the hang of it. Remember that, when using the double bracket notation, that an integer argument will give you a position [row first, column second]. A list in either position will give you the selection(s) associated with the list. All is a special list--it is the one that spans the entire dimension associated with that row or column.
|
MATHEMATICA |
| (notebook Lecture-02) |
| (html Lecture-02) |
| (xml+mathml Lecture-02) |
Rules (
|
We will see that many of
MATHEMATICA
functions return rules as a
result.
MATHEMATICA
's built-in help functions are very useful.
This was true even before the whole
MATHEMATICA
manual was
incorporated into the Help Browser.
In the old days, one would memorize large portions
of the
MATHEMATICA
book--which has grown continuously heavier since
its first publication in the early 1990's--and rely on the useful
"?" and "??" operators.
The use of "?" with the wildcard "&sstarf#star;" enabled a beginning user
to track down almost any
MATHEMATICA
function.
The Options function is also a very efficient way to discover alternative
ways of getting results.
I would have recommended `scanning' the entire
MATHEMATICA
manual in
a single three hour sitting (about 600 pages per hour) as an effective
way to acquire a working familiarity with the software, but I don't
because the built-in browser is so easy to use.
I encourage you to idly explore the
MATHEMATICA
Help Browser.
You will not only learn about
MATHEMATICA
, but also about mathematics.