The Expression Workspace
Date: 2020-10-07 18:10:00

Up | Next | Prev | PrevTail | Tail

### 8.2 The Expression Workspace

Several mechanisms are available for saving and retrieving previously evaluated expressions. The simplest of these refers to the last algebraic expression simpliﬁed. When an assignment of an algebraic expression is made, or an expression is evaluated at the top level, (i.e., not inside a compound statement or procedure) the results of the evaluation are automatically saved in a variable WS that we shall refer to as the workspace. (More precisely, the expression is assigned to the variable WS that is then available for further manipulation.)

Example:

If we evaluate the expression (x+y)^2 at the top level and next wish to diﬀerentiate it with respect to Y, we can simply say

df(ws,y);

to get the desired answer.

If the user wishes to assign the workspace to a variable or expression for later use, the SAVEASstatement can be used. It has the syntax

SAVEAS ⟨expression⟩

For example, after the diﬀerentiation in the last example, the workspace holds the expression 2*x+2*y. If we wish to assign this to the variable Z we can now say

saveas z;

If the user wishes to save the expression in a form that allows him to use some of its variables as arbitrary parameters, the FOR ALL command can be used.

Example:

for all x saveas h(x);

with the above expression would mean that h(z) evaluates to 2*Y+2*Z.

A further method for referencing more than the last expression is described in chapter 13 on interactive use of REDUCE.

Up | Next | Prev | PrevTail | Front