home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
gnu
/
info
/
calc.info-23
(
.txt
)
< prev
next >
Wrap
GNU Info File
|
1994-12-22
|
49KB
|
792 lines
This is Info file calc.info, produced by Makeinfo-1.55 from the input
file calc.texinfo.
This file documents Calc, the GNU Emacs calculator.
Copyright (C) 1990, 1991 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the section entitled "GNU General Public License" is included
exactly as in the original, and provided that the entire resulting
derived work is distributed under the terms of a permission notice
identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the section entitled "GNU General Public License"
may be included in a translation approved by the author instead of in
the original English.
File: calc.info, Node: Evaluates-To Operator, Prev: Let Command, Up: Store and Recall
The Evaluates-To Operator
=========================
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 TeX.) 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, A
is not simplified or modified in any way. The previous value of
argument B is thrown away; the formula A is then copied and evaluated
as if by the `=' command according to all current modes and stored
variable values, and the result is installed as the new value of B.
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 `x + y + x'
is not handled by Calc's default simplifications, but the `a s' command
will reduce it to the simpler form `y + 2 x'. You can also type `m A'
to enable an algebraic-simplification mode in which the equivalent of
`a s' is used on all of Calc's results. If you enter `x + y + x =>'
normally, the result will be `x + y + x => x + y + x'. If you change to
algebraic-simplification mode, the result will be `x + y + x => y + 2
x'. However, just pressing `a s' once will have no effect on `x + y +
x => x + y + 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 s'.
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.
*Note TeX Language Mode::, for the way `=>' appears in TeX language
output. The "eqn" mode gives similar treatment to `=>'.
File: calc.info, Node: Graphics, Next: Kill and Yank, Prev: Store and Recall, Up: Top
Graphics
********
The commands for graphing data begin with the `g' prefix key. Calc
uses GNUPLOT 2.0 or 3.0 to do graphics. These commands will only work
if GNUPLOT is available on your system. (While GNUPLOT sounds like a
relative of GNU Emacs, it is actually completely unrelated. However,
it is free software and can be obtained from the Free Software
Foundation's machine `prep.ai.mit.edu'.)
If you have GNUPLOT installed on your system but Calc is unable to
find it, you may need to set the `calc-gnuplot-name' variable in your
`.emacs' file. You may also need to set some Lisp variables to show
Calc how to run GNUPLOT on your system; these are described under `g D'
and `g O' below. If you are using the X window system, Calc will
configure GNUPLOT for you automatically. If you have GNUPLOT 3.0 and
you are not using X, Calc will configure GNUPLOT to display graphs
using simple character graphics that will work on any terminal.
* Menu:
* Basic Graphics::
* Three Dimensional Graphics::
* Managing Curves::
* Graphics Options::
* Devices::
File: calc.info, Node: Basic Graphics, Next: Three Dimensional Graphics, Prev: Graphics, Up: Graphics
Basic Graphics
==============
The easiest graphics command is `g f' (`calc-graph-fast'). This
command takes two vectors of equal length from the stack. The vector
at the top of the stack represents the "y" values of the various data
points. The vector in the second-to-top position represents the
corresponding "x" values. This command runs GNUPLOT (if it has not
alr