Unassigning variables

### 3.3.9 Unassigning variables

Xcas has commands that help you keep track of what variables you are using and resetting them if desired. The VARS command will list all the variables that you are using, the purge, DelVar and del commands will delete selected variables, and the rm_a_z and rm_all_vars commands will remove classes of variables. All variables can be removed by using restart.

- VARS takes no arguments.
- VARS() returns a list of the variables that you have assigned values or made assumptions on.

The purge command will clear the values and assumptions you make on variables (see Section 3.3.8). For TI compatibility there is also DelVar, and for Python compatibility there is del.

- The purge command takes var, the name of a variable.
- purge(var) clears the variable var of all values and assumptions.

- The DelVar (and del) commands take one argument: var, the name of a variable.
- Delvar var (or del var) removes the values attached to var. (Note that they do not take their argument in parentheses.

The rm_all_vars and restart commands clear the values and assumptions you have made on all variables use.

- rm_all_vars takes no arguments.
- rm_all_vars() removes all the values that you have attached to variables.

- restart takes no arguments.
- restart removes all the values that you have attached to variables. (Note that it does not use parentheses.)

The rm_a_z command clears the values and assumptions on all variables with single lowercase letter names.

- rm_a_z takes no arguments.
- rm_a_z() purges all variables whose names are one letter and lowercase.

#### Examples

Enter:

a:=1; anothervar:=2

then:

VARS()

| ⎡ ⎣ | a,anothervar | ⎤ ⎦

To clear the variable a:

purge(a)

or (for TI compatibility):

DelVar a

or (for Python compatibility):

del a

If you have variables names A,B,a,b,myvar, then after:

rm_a_z()

you will only have the variables named A,B,myvar.