A **variable** is somewhere between a storage register on a conventional
calculator, and a variable in a programming language. (In fact, a Calc
variable is really just an Emacs Lisp variable that contains a Calc number
or formula.) A variable's name is normally composed of letters and digits.
Calc also allows apostrophes and `#`

signs in variable names.
The Calc variable `foo`

corresponds to the Emacs Lisp variable
`var-foo`

. Commands like `s s` (`calc-store`

) that operate
on variables can be made to use any arbitrary Lisp variable simply by
backspacing over the ``var-'` prefix in the minibuffer.

In a command that takes a variable name, you can either type the full
name of a variable, or type a single digit to use one of the special
convenience variables `var-q0`

through `var-q9`

. For example,
`3 s s 2` stores the number 3 in variable `var-q2`

, and
`3 s s foo RET` stores that number in variable

`var-foo`

.
To push a variable itself (as opposed to the variable's value) on the
stack, enter its name as an algebraic expression using the apostrophe
(`'`) key. Variable names in algebraic formulas implicitly have
``var-'` prefixed to their names. The ``#'` character in variable
names used in algebraic formulas corresponds to a dash ``-'` in the
Lisp variable name. If the name contains any dashes, the prefix ``var-'`
is *not* automatically added. Thus the two formulas ``foo + 1'`
and ``var#foo + 1'` both refer to the same variable.

The `=` (`calc-evaluate`

) key "evaluates" a formula by
replacing all variables in the formula which have been given values by a
`calc-store`

or `calc-let`

command by their stored values.
Other variables are left alone. Thus a variable that has not been
stored acts like an abstract variable in algebra; a variable that has
been stored acts more like a register in a traditional calculator.
With a positive numeric prefix argument, `=` evaluates the top
`n` stack entries; with a negative argument, `=` evaluates
the `n`th stack entry.

A few variables are called **special constants**. Their names are
``e'`, ``pi'`, ``i'`, ``phi'`, and ``gamma'`.
(See section Scientific Functions.) When they are evaluated with `=`,
their values are calculated if necessary according to the current precision
or complex polar mode. If you wish to use these symbols for other purposes,
simply undefine or redefine them using `calc-store`

.

The variables ``inf'`, ``uinf'`, and ``nan'` stand for
infinite or indeterminate values. It's best not to use them as
regular variables, since Calc uses special algebraic rules when
it manipulates them. Calc displays a warning message if you store
a value into any of these special variables.

See section Storing and Recalling, for a discussion of commands dealing with variables.

Go to the first, previous, next, last section, table of contents.