Up to Main Lab Page | Next Lesson - Functions | Previous Lesson - Basics |
Maple uses the assignment operator := to assign values to variables.
> a:=2*3;
> a;
Note that Maple only updates a line when you press enter, try changing the assignment of a above and pressing enter on both lines in turn.
Once an expression has been defined it acts as an alias for its definition, and
can be used to define further expressions.
NOTE: Using expressions in this way can become confusing, particularly in an
interactive session.
Try the following lines:
> a:=b+c;
> a;
> b:=17;c:=4;
> a;
> c=12;
> a;
> c:=a;
> a;
Maple also allows us to assign variables values which have unassigned variables within them, such an assignment is called an
expression.
> a := x^2+3*x+4;
We can then assign a value to the variable
> x := 2;
> a;
Anything within single quotes (e.g. 'a') is interpreted by Maple as a literal string.
We can unassign an expression by telling Maple to put the variable back to a
letter
> a := 'a';
> a;
Maple also has a command 'restart' to restart a session. This command clears
all function and expression definitions.
Clear all the assigned values:
> restart;
Up to Main Lab Page | Next Lesson - Functions | Top of this Lesson | Previous Lesson - Basics |