Mathematica
Tutor
Part 5: What
Mathematica remembers
- Create a new cell
and type
x=15
Then press the RETURN key. This gives you a new line within
the cell and does not evaluate the current line. Now type
7.3/2.5
Then press SHIFT-RETURN to evaluate both lines.
- Go back into the
cell, delete the line
x=15
and press SHIFT-RETURN. In a new cell, enter
x
Notice that Mathematica still remembers that x
has been assigned the value 15 -- even though that line
no longer appears in the worksheet.
We have come to the
second important fact about Mathematica. (The difference
between RETURN and SHIFT-RETURN was the first.) Mathematica
remembers what has been entered in the order it was entered.
- It doesn't matter
what is currently in the worksheet, nor the order things appear in
that worksheet. You may have assigned a value, erased the
assigning command line, and forgotten about it. But Mathematica
remembers. If you use x later, assuming it is an
unassigned variable, strange things will happen.
- If variables are
assigned new values, formulas using those variables acquire new
values as well.
Finally a third
important fact about Mathematica: If you save a Mathematica
file without removing the output, then reload it later, it will
look the same as when you saved it. But Mathematica will not
remember any of the displayed commands. All of those commands must
be reentered before you are again in the same state as when you saved
and closed the file.