You can assign a value to a variable with the := operator. For example, to give the variable a the value of 4, you can enter
Alternatively, you can use the => operator; when you use this operator, the value comes before the variable;
The function sto or Store can also be used; again, the value comes before the variable
After any one of these commands, any time you use the variable a in an expression, it will be replaced by 4.
You can use sequences or lists to make multiple assignments at the same time. For example,
will assign a the value 1, b the value 2 and c the value 3. Note that this can be used to switch the values of two variables; with a and b as above, the command
will set a equal to b’s original value, namely 2, and will set b equal to a’s original value, namely 1.
Another way to assign values to variables, useful in Maple mode, is with the assign. If you enter
then a will have the value 3. You can assign multiple values at once; if you enter
then a will have the value 1 and b will have the value 2. This command can be useful in Maple mode, where solutions of equations are returned as equations. For example, if you enter (in Maple mode)
you will get
If you then enter
the variable x will have value -1 and y will have the value 2. This same effect can be achieved in standard Xcas mode, where
In this case, the command
will assign x the value -1 and y the value 2.