Assigning Values to Variables, or Naming Expressions

You can assign a value to a variable with Define + New Definition. There are two options for the behavior of the defined variable. The default behavior is ``deferred evaluation,'' meaning the definition is stored exactly as you make it. The alternate behavior is ``full evaluation,'' meaning the definition that is stored takes into account earlier definitions in force that might affect it. See the section full evaluationFull evaluation for a discussion of this option.

$\blacktriangleright$ To assign the value 25 to z

1.
Type z = 25 in mathematics.

2.
Leave the insertion point in the equation.

3.
Click the New Definition button itbpF0.3009in0.3009in0.0701innewdef.wmf on the Compute toolbar or, from the Define submenu, choose New Definition.

Thereafter, until you exit the documentor undefine the variable, the system recognizes z as 25. For example, evaluating the expression `` + z'' returns ``=  28.''

Another way to describe this operation is to say that an expression such as x2 + sin x can be given a name. Enter y = x2 + sin x, leave the insertion point anywhere in the expression, and then from the Define submenuchoose New Definition. Now, whenever you operate on an expression containing y, every occurrence of y is replaced by the expression x2 + sin x. For example, Evaluate applied to y2 + x3 produces

y2 + x3 = (x2 + sin x)2 + x3

Note that these variables or names are single characters. Click on Custom NamesDM5-1.tex#Custom Names for information on multicharacter names.

The value assigned can be any mathematical expression. For example, you could define a variable to be

You will find this feature useful for a variety of purposes.

Note    The symbol p defined previously represents the expression x3 - 5x + 1. It is not a function, so, for example, p(2) is not the polynomial evaluated at 2, but rather is p(2) = 2p =  2x3 - 10x + 2.



Subsections