Mathematica hints
Mathematica is for all students available on your accounts. As a Chalmers student you can also
download Mathematica to your own computer on a Chalmers site licence. GU students can receive a copy of Mathematica on their own computer through a special arrangement for this course - ask for details.
In this course, we do not require much more than using standard
Mathematica commands, where you can insert your own arguments and
execute.
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.