Previous: The Let Command, Up: Storing and Recalling [Contents][Index]

The special algebraic symbol ‘`=>`’ is known as the *evaluates-to
operator*. (It will show up as an `evalto`

function call in
other language modes like Pascal and LaTeX.) This is a binary
operator, that is, it has a lefthand and a righthand argument,
although it can be entered with the righthand argument omitted.

A formula like ‘` a => b`’ is evaluated by Calc as
follows: First,

For example, suppose you enter the algebraic formula ‘`2 + 3 => 17`’.
The number 17 is ignored, and the lefthand argument is left in its
unevaluated form; the result is the formula ‘`2 + 3 => 5`’.

You can enter an ‘`=>`’ formula either directly using algebraic
entry (in which case the righthand side may be omitted since it is
going to be replaced right away anyhow), or by using the `s =`
(`calc-evalto`

) command, which takes `a` from the stack
and replaces it with ‘` a => b`’.

Calc keeps track of all ‘`=>`’ operators on the stack, and
recomputes them whenever anything changes that might affect their
values, i.e., a mode setting or variable value. This occurs only
if the ‘`=>`’ operator is at the top level of the formula, or
if it is part of a top-level vector. In other words, pushing
‘`2 + (a => 17)`’ will change the 17 to the actual value of
‘`a`’ when you enter the formula, but the result will not be
dynamically updated when ‘`a`’ is changed later because the
‘`=>`’ operator is buried inside a sum. However, a vector
of ‘`=>`’ operators will be recomputed, since it is convenient
to push a vector like ‘`[a =>, b =>, c =>]`’ on the stack to
make a concise display of all the variables in your problem.
(Another way to do this would be to use ‘`[a, b, c] =>`’,
which provides a slightly different format of display. You
can use whichever you find easiest to read.)

The `m C` (`calc-auto-recompute`

) command allows you to
turn this automatic recomputation on or off. If you turn
recomputation off, you must explicitly recompute an ‘`=>`’
operator on the stack in one of the usual ways, such as by
pressing `=`. Turning recomputation off temporarily can save
a lot of time if you will be changing several modes or variables
before you look at the ‘`=>`’ entries again.

Most commands are not especially useful with ‘`=>`’ operators
as arguments. For example, given ‘`x + 2 => 17`’, it won’t
work to type `1 +` to get ‘`x + 3 => 18`’. If you want
to operate on the lefthand side of the ‘`=>`’ operator on
the top of the stack, type `j 1` (that’s the digit “one”)
to select the lefthand side, execute your commands, then type
`j u` to unselect.

All current modes apply when an ‘`=>`’ operator is computed,
including the current simplification mode. Recall that the
formula ‘`arcsin(sin(x))`’ will not be handled by Calc’s algebraic
simplifications, but Calc’s unsafe simplifications will reduce it to
‘`x`’. If you enter ‘`arcsin(sin(x)) =>`’ normally, the result
will be ‘`arcsin(sin(x)) => arcsin(sin(x))`’. If you change to
Extended Simplification mode, the result will be
‘`arcsin(sin(x)) => x`’. However, just pressing `a e`
once will have no effect on ‘`arcsin(sin(x)) => arcsin(sin(x))`’,
because the righthand side depends only on the lefthand side
and the current mode settings, and the lefthand side is not
affected by commands like `a e`.

The “let” command (`s l`) has an interesting interaction
with the ‘`=>`’ operator. The `s l` command evaluates the
second-to-top stack entry with the top stack entry supplying
a temporary value for a given variable. As you might expect,
if that stack entry is an ‘`=>`’ operator its righthand
side will temporarily show this value for the variable. In
fact, all ‘`=>`’s on the stack will be updated if they refer
to that variable. But this change is temporary in the sense
that the next command that causes Calc to look at those stack
entries will make them revert to the old variable value.

2: a => a 2: a => 17 2: a => a 1: a + 1 => a + 1 1: a + 1 => 18 1: a + 1 => a + 1 . . . 17 s l a RET p 8 RET

Here the `p 8` command changes the current precision,
thus causing the ‘`=>`’ forms to be recomputed after the
influence of the “let” is gone. The `d SPC` command
(`calc-refresh`

) is a handy way to force the ‘`=>`’
operators on the stack to be recomputed without any other
side effects.

Embedded mode also uses ‘`=>`’ operators. In Embedded mode,
the lefthand side of an ‘`=>`’ operator can refer to variables
assigned elsewhere in the file by ‘`:=`’ operators. The
assignment operator ‘`a := 17`’ does not actually do anything
by itself. But Embedded mode recognizes it and marks it as a sort
of file-local definition of the variable. You can enter ‘`:=`’
operators in Algebraic mode, or by using the `s :`
(`calc-assign`

) [`assign`

] command which takes a variable
and value from the stack and replaces them with an assignment.

See TeX and LaTeX Language Modes, for the way ‘`=>`’ appears in
TeX language output. The *eqn* mode gives similar
treatment to ‘`=>`’.

Previous: The Let Command, Up: Storing and Recalling [Contents][Index]