Mathematica hints
An online version of Mathematica is available here.
The online version is sufficient for this course. If you have the desktop version of Mathematica installed on your machine as well, you may use that version if you prefer.
(Chalmers students can
download Mathematica to your own computer on a Chalmers site licence. Please contact IT support for more information.)
In this course, we do not require much more than using standard
Mathematica commands.
However, it is an extensive system and it is a bad idea to
guess how to do things with Mathematica, you may get into unnecessary
trouble. For example, just testing commands without knowing anything
about how the system works is probably not the fastest way to get
forward.
The
documentation in the
Mathematica help system is comprehensive
This includes both the the help system available within the program itself, and the Mathemtica web site. There is more than you expect, and if you look carefully you can usually find an example of a command very similar to what you need. You should try to get acquainted with the basics before
you do any real work.
While you read, try the commands in Mathematica
along the way.
The kernel and entering definitions
When you write a command in a Mathematica window (Mathematica notebook)
and press Enter, the command is sent to the Mathematica kernel. If it
is some sort of definition or assignment, this is remembered by the
kernel and will subsequently be used whenever that symbol or function
is encountered.
A definition is not active just because it is in the notebook, it has
to be actively executed to get into the kernel. Note that while you can
have several Mathematica windows open at the same time, they normally
send commands to the same kernel, so definitions entered in one window
are automatically valid also in another.
Symbol definitions can be checked by evaluating them or with the
command. You can erase a definition for a symbol x by writing
Remove[x]. A function definition f can be checked by evaluating ?f and
is erased by Remove[f] . You can remove all definitions you introduced
in the kernel with Remove["Global`*"] or by restarting it.
Common causes of trouble
- You may have used the wrong syntax. Check by pasting a similar
command directly from the help system into your notebook and check
first if it works. Then carefully make changes to to the command to
change it into what you really want to do.
- Sometimes, it seems that strange invisible characters can cause
Mathematica to give an error message that is difficult to understand.
Use the same procedure as above to resolve.
- Another cause for unexpected errors is that symbols may not mean
what you think. This can happen if a definition of a symbol has been
defined or redefined by mistake. In particular you should be aware of
the difference between = (assignment) and == (equality test). If you
have an equation as an argument to a function, you must use == and not
= ! If you use = first by mistake, it may happen that you inadvertently
make an assignment redefining some symbol, and you will get strange
results thereafter. You must then check your symbols and remove any
unwanted definitions.