|
This document describes some common problems that new (and not so new) users of Mathematica sometimes encounter.
Common syntax problems
A command is evaluated when you hit the Enter key, not the return key; shift-return can be used in place of Enter (on a Macintosh, cmd-return also works).
If a command is followed by a semicolon, the result of that command is not displayed.
Built-in Mathematica commands begin with CAPITAL LETTERS; for instance
Iftrue, I_am_True, I_am_False]
returns "I_am_False" because the input "true" is different from the Mathematica constant "True".
Also remember that in compound-word commands, the first letter of each part is usually capitalized; e.g., ArcSin[x] is correct while "Arcsin[x]" and "arcsin[x]" are not. (Often, you can find the correct version by typing in a name, selecting it, and then use the "Find selected command" item under the Help menu. This will return relevant results even if you enter "arcsin" instead of "ArcSin".)Arguments to commands are enclosed in [square brackets], not (parentheses).
Mathematica interprets a blank space between two quantities as multiplication: "3 x" and "3*x" are treated the same. Sometimes it will also treat run-together quantities as multiplication, provided that there is no other reasonable interpretation ; for instance, "3x" is interpreted as "3*x", but "x3" is not (it is interpreted as the name of a variable. Similarly, "xy" is interpreted as the name of a variable (with a 2 letter name), and not as the product of the variable "x" and the variable "y".
Mathematica tries to remember everything
Mathematica tries to remember the current value of any expression that you have used in the current session. For instance if you input x=1 at the beginning of your session, and then later define f = x^2 + 2 x + 1, Mathematica returns 4 as the value of f (1^2 + 2*1 + 1 = 4); if you ask it to integrate f from 0 to 1 you get 4 instead of the correct value of the integral. To avoid having this cause problems for you, you can (a) use funny names for everything so that there are no repetitions, or you can use the Clear command before defining f; the command Clear[x] tells Mathematica to forget anything it knows about the quantity "x", or (c) you can periodically quit Mathematica and restart (of course you may lose other information by doing this).
This site is maintained by Mike Hurley; this page was last updated on 5/31/19, 12:58 PM .
.. |