Examples of assigning variables BADLY in Maple
Never use a typical variable name (like x, y, z, i, j, k) on the left side of an assignment, and never put a number (3, -1, Pi, etc.) on the right side of an assignment.
For example, these are all BAD:
> x := t + 3*sin(t);
> fibonac := 1;
> x := 3;
But why would anyone ever do something like that?
How it typically happens
The instructions say something like, "Define f to be the function Sin(x*Pi) - 5, then compute f(3)."
A correct but VERY BAD way to get the answer:
> f := x -> sin(x*Pi) - 5;
> x := 3;
> f(x);
The problem is that after you run "x := 3;", Maple will now always* think that an "x" is the constant "3". For example, you won't be able to plot a graph over the interval [0,10] on the x-axis, like this:
> plot(f(x), x=0..10);
because Maple thinks you mean this:
> plot(sin(3*Pi)-5, 3=0..10);
which is nonsense without the variable "x".
Why it happens: A brief introduction to the Maple kernel
You can think of Maple's kernel as being the internal part that keeps track of function names, variable names, their current values, and such. The key facts we should observe here are:
- No matter how many worksheets you have open, they all use the same kernel, and
- The kernel will remember all names and values until you exit Maple, unless you specifically "unassign" something.
The second property is what causes the problem in the "How it typically happens" example above.
* Well, not always, but until you either (1) quit Maple, (2) run "unassign('x');", or (3) run a "restart;" command, which clears all variable names (and all other labels, too). But it's simpler to avoid creating the problem in the first place.

