home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-02 | 55.5 KB | 1,177 lines |
- Newsgroups: comp.sources.misc
- From: daveg@synaptics.com (David Gillespie)
- Subject: v24i098: gnucalc - GNU Emacs Calculator, v2.00, Part50/56
- Message-ID: <1991Nov3.001038.19733@sparky.imd.sterling.com>
- X-Md4-Signature: e60c59206a809d145d3903e295fc8077
- Date: Sun, 3 Nov 1991 00:10:38 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: daveg@synaptics.com (David Gillespie)
- Posting-number: Volume 24, Issue 98
- Archive-name: gnucalc/part50
- Environment: Emacs
- Supersedes: gmcalc: Volume 13, Issue 27-45
-
- #!/bin/sh
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file calc.texinfo continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 50; then
- echo Please unpack part "$Scheck" next!
- exit 1
- else
- exit 0
- fi
- ) < _shar_seq_.tmp || exit 1
- if test ! -f _shar_wnt_.tmp; then
- echo 'x - still skipping calc.texinfo'
- else
- echo 'x - continuing file calc.texinfo'
- sed 's/^X//' << 'SHAR_EOF' >> 'calc.texinfo' &&
- going to be replaced right away anyhow), or by using the @kbd{s =}
- (@code{calc-evalto}) command, which takes @var{a} from the stack
- and replaces it with @samp{@var{a} => @var{b}}.
- X
- Calc keeps track of all @samp{=>} 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 @samp{=>} operator is at the top level of the formula, or
- if it is part of a top-level vector. In other words, pushing
- @samp{2 + (a => 17)} will change the 17 to the actual value of
- @samp{a} when you enter the formula, but the result will not be
- dynamically updated when @samp{a} is changed later because the
- @samp{=>} operator is buried inside a sum. However, a vector
- of @samp{=>} operators will be recomputed, since it is convenient
- to push a vector like @samp{[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 @samp{[a, b, c] =>},
- which provides a slightly different format of display. You
- can use whichever you find easiest to read.)
- X
- @kindex m C
- @pindex calc-auto-recompute
- The @kbd{m C} (@code{calc-auto-recompute}) command allows you to
- turn this automatic recomputation on or off. If you turn
- recomputation off, you must explicitly recompute an @samp{=>}
- operator on the stack in one of the usual ways, such as by
- pressing @kbd{=}. Turning recomputation off temporarily can save
- a lot of time if you will be changing several modes or variables
- before you look at the @samp{=>} entries again.
- X
- Most commands are not especially useful with @samp{=>} operators
- as arguments. For example, given @samp{x + 2 => 17}, it won't
- work to type @kbd{1 +} to get @samp{x + 3 => 18}. If you want
- to operate on the lefthand side of the @samp{=>} operator on
- the top of the stack, type @kbd{j 1} (that's the digit ``one'')
- to select the lefthand side, execute your commands, then type
- @kbd{j u} to unselect.
- X
- All current modes apply when an @samp{=>} operator is computed,
- including the current simplification mode. Recall that the
- formula @samp{x + y + x} is not handled by Calc's default
- simplifications, but the @kbd{a s} command will reduce it to
- the simpler form @samp{y + 2 x}. You can also type @kbd{m A}
- to enable an algebraic-simplification mode in which the
- equivalent of @kbd{a s} is used on all of Calc's results.
- If you enter @samp{x + y + x =>} normally, the result will
- be @samp{x + y + x => x + y + x}. If you change to
- algebraic-simplification mode, the result will be
- @samp{x + y + x => y + 2 x}. However, just pressing @kbd{a s}
- once will have no effect on @samp{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 @kbd{a s}.
- X
- The ``let'' command (@kbd{s l}) has an interesting interaction
- with the @samp{=>} operator. The @kbd{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 @samp{=>} operator its righthand
- side will temporarily show this value for the variable. In
- fact, all @samp{=>}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.
- X
- @group
- @smallexample
- 2: a => a 2: a => 17 2: a => a
- 1: a + 1 => a + 1 1: a + 1 => 18 1: a + 1 => a + 1
- X . . .
- X
- X 17 s l a RET p 8 RET
- @end smallexample
- @end group
- X
- Here the @kbd{p 8} command changes the current precision,
- thus causing the @samp{=>} forms to be recomputed after the
- influence of the ``let'' is gone. The @kbd{d SPC} command
- (@code{calc-refresh}) is a handy way to force the @samp{=>}
- operators on the stack to be recomputed without any other
- side effects.
- X
- @kindex s :
- @pindex calc-assign
- @tindex assign
- @tindex :=
- Embedded Mode also uses @samp{=>} operators. In embedded mode,
- the lefthand side of an @samp{=>} operator can refer to variables
- assigned elsewhere in the file by @samp{:=} operators. The
- assignment operator @samp{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 @samp{:=}
- operators in algebraic mode, or by using the @kbd{s :}
- (@code{calc-assign}) [@code{assign}] command which takes a variable
- and value from the stack and replaces them with an assignment.
- X
- @xref{TeX Language Mode}, for the way @samp{=>} appears in
- @TeX{} language output. The @dfn{eqn} mode gives similar
- treatment to @samp{=>}.
- X
- @node Graphics, Kill and Yank, Store and Recall, Top
- @chapter Graphics
- X
- @noindent
- The commands for graphing data begin with the @kbd{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 @samp{prep.ai.mit.edu}.)
- X
- @vindex calc-gnuplot-name
- If you have GNUPLOT installed on your system but Calc is unable to
- find it, you may need to set the @code{calc-gnuplot-name} variable
- in your @file{.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 @kbd{g D} and @kbd{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.
- X
- @menu
- * Basic Graphics::
- * Three Dimensional Graphics::
- * Managing Curves::
- * Graphics Options::
- * Devices::
- @end menu
- X
- @node Basic Graphics, Three Dimensional Graphics, Graphics, Graphics
- @section Basic Graphics
- X
- @noindent
- @kindex g f
- @pindex calc-graph-fast
- The easiest graphics command is @kbd{g f} (@code{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 already been started by previous graphing
- commands) and displays the set of data points. The points will
- be connected by lines, and there will also be some kind of symbol
- to indicate the points themselves.
- X
- The ``x'' entry may instead be an interval form, in which case suitable
- ``x'' values are interpolated between the minimum and maximum values of
- the interval (whether the interval is open or closed is ignored).
- X
- The ``x'' entry may also be a number, in which case Calc uses the
- sequence of ``x'' values @cite{x}, @cite{x+1}, @cite{x+2}, etc.
- (Generally the number 0 or 1 would be used for @cite{x} in this case.)
- X
- The ``y'' entry may be any formula instead of a vector. Calc effectively
- uses @kbd{N} (@code{calc-eval-num}) to evaluate variables in the formula;
- the result of this must be a formula in a single (unassigned) variable.
- The formula is plotted with this variable taking on the various ``x''
- values. Graphs of formulas by default use lines without symbols at the
- computed data points. Note that if neither ``x'' nor ``y'' is a vector,
- Calc guesses at a reasonable number of data points to use. See the
- @kbd{g N} command below. (The ``x'' values must be either a vector
- or an interval if ``y'' is a formula.)
- X
- @tindex xy
- If ``y'' is (or evaluates to) a formula of the form
- @samp{xy(@var{x}, @var{y})} then the result is a
- parametric plot. The two arguments of the fictitious @code{xy} function
- are used as the ``x'' and ``y'' coordinates of the curve, respectively.
- In this case the ``x'' vector or interval you specified is not directly
- visible in the graph. For example, if ``x'' is the interval @samp{[0..360]}
- and ``y'' is the formula @samp{xy(sin(t), cos(t))}, the resulting graph
- will be a circle.@refill
- X
- Also, ``x'' and ``y'' may each be variable names, in which case Calc
- looks for suitable vectors, intervals, or formulas stored in those
- variables.
- X
- The ``x'' and ``y'' values for the data points (as pulled from the vectors,
- calculated from the formulas, or interpolated from the intervals) should
- be real numbers (integers, fractions, or floats). If either the ``x''
- value or the ``y'' value of a given data point is not a real number, that
- data point will be omitted from the graph. The points on either side
- of the invalid point will @emph{not} be connected by a line.
- X
- See the documentation for @kbd{g a} below for a description of the way
- numeric prefix arguments affect @kbd{g f}.
- X
- @cindex @code{PlotRejects} variable
- @vindex PlotRejects
- If you store an empty vector in the variable @code{PlotRejects}
- (i.e., @kbd{[ ] s t PlotRejects}), Calc will append information to
- this vector for every data point which was rejected because its
- ``x'' or ``y'' values were not real numbers. The result will be
- a matrix where each row holds the curve number, data point number,
- ``x'' value, and ``y'' value for a rejected data point.
- @xref{Evaluates-To Operator}, for a handy way to keep tabs on the
- current value of @code{PlotRejects}. @xref{Operations on Variables},
- for the @kbd{s R} command which is another easy way to examine
- @code{PlotRejects}.
- X
- @kindex g c
- @pindex calc-graph-clear
- To clear the graphics display, type @kbd{g c} (@code{calc-graph-clear}).
- If the GNUPLOT output device is an X window, the window will go away.
- Effects on other kinds of output devices will vary. You don't need
- to use @kbd{g c} if you don't want to---if you give another @kbd{g f}
- or @kbd{g p} command later on, it will reuse the existing graphics
- window if there is one.
- X
- @node Three Dimensional Graphics, Managing Curves, Basic Graphics, Graphics
- @section Three Dimensional Graphics
- X
- @kindex g F
- @pindex calc-graph-fast-3d
- The @kbd{g F} (@code{calc-graph-fast-3d}) command makes a three-dimensional
- graph. It works only if you have GNUPLOT 3.0 or later; with GNUPLOT 2.0,
- you will see a GNUPLOT error message if you try this command.
- X
- The @kbd{g F} command takes three values from the stack, called ``x'',
- ``y'', and ``z'', respectively. As was the case for 2D graphs, there
- are several options for these values.
- X
- In the first case, ``x'' and ``y'' are each vectors (not necessarily of
- the same length); either or both may instead be interval forms. The
- ``z'' value must be a matrix with the same number of rows as elements
- in ``x'', and the same number of columns as elements in ``y''. The
- result is a surface plot where @c{$z_{ij}$}
- @cite{z_ij} is the height of the point
- at coordinate @cite{(x_i, y_j)} on the surface. The 3D graph will
- be displayed from a certain default viewpoint; you can change this
- viewpoint by adding a @samp{set view} to the @samp{*Gnuplot Commands*}
- buffer as described later. See the GNUPLOT documentation for a
- description of the @samp{set view} command.
- X
- Each point in the matrix will be displayed as a dot in the graph,
- and these points will be connected by a grid of lines (@dfn{isolines}).
- X
- In the second case, ``x'', ``y'', and ``z'' are all vectors of equal
- length. The resulting graph displays a 3D line instead of a surface,
- where the coordinates of points along the line are successive triplets
- of values from the input vectors.
- X
- In the third case, ``x'' and ``y'' are vectors or interval forms, and
- ``z'' is any formula involving two variables (not counting variables
- with assigned values). These variables are sorted into alphabetical
- order; the first takes on values from ``x'' and the second takes on
- values from ``y'' to form a matrix of results that are graphed as a
- 3D surface.
- X
- If the ``z'' formula evaluates to a call to the fictitious function
- @samp{xyz(@var{x}, @var{y}, @var{z})}, then the result is a
- ``parametric surface.'' In this case, the axes of the graph are
- taken from the @var{x} and @var{y} values in these calls, and the
- ``x'' and ``y'' values from the input vectors or intervals are used
- only to generate inputs to the formula. For example, plotting
- @samp{[0..360], [0..180], xyz(sin(x)*sin(y), cos(x)*sin(y), cos(y))}
- will draw a sphere. (Since the default resolution for 3D plots is
- 5 steps in each of ``x'' and ``y'', this will draw a very crude
- sphere. You could use the @kbd{g N} command, described below, to
- increase this resolution, or specify the ``x'' and ``y'' values as
- vectors with more than 5 components.)
- X
- It is also possible to have a function in a regular @kbd{g f} plot
- evaluate to an @code{xyz} call. Since @kbd{g f} plots a line, not
- a surface, the result will be 3D parametric line. For example,
- @samp{[[0..720], xyz(sin(x), cos(x), x)]} will plot two turns of a
- helix (a three-dimensional spiral).
- X
- As for @kbd{g f}, each of ``x'', ``y'', and ``z'' may instead be
- variables containing the relevant data.
- X
- @node Managing Curves, Graphics Options, Three Dimensional Graphics, Graphics
- @section Managing Curves
- X
- @noindent
- The @kbd{g f} command is really shorthand for the following commands:
- @kbd{C-u g d g a g p}. Likewise, @kbd{g F} is shorthand for
- @kbd{C-u g d g A g p}. You can gain more control over your graph
- by using these commands directly.
- X
- @kindex g a
- @pindex calc-graph-add
- The @kbd{g a} (@code{calc-graph-add}) command adds the ``curve''
- represented by the two values on the top of the stack to the current
- graph. You can have any number of curves in the same graph. When
- you give the @kbd{g p} command, all the curves will be drawn superimposed
- on the same axes.
- X
- The @kbd{g a} command (and many others that affect the current graph)
- will cause a special buffer, @samp{*Gnuplot Commands*}, to be displayed
- in another window. This buffer is a template of the commands that will
- be sent to GNUPLOT when it is time to draw the graph. The first
- @kbd{g a} command adds a @code{plot} command to this buffer. Succeeding
- @kbd{g a} commands add extra curves onto that @code{plot} command.
- Other graph-related commands put other GNUPLOT commands into this
- buffer. In normal usage you never need to work with this buffer
- directly, but you can if you wish. The only constraint is that there
- must be only one @code{plot} command, and it must be the last command
- in the buffer. If you want to save and later restore a complete graph
- configuration, you can use regular Emacs commands to save and restore
- the contents of the @samp{*Gnuplot Commands*} buffer.
- X
- @vindex PlotData1
- @vindex PlotData2
- If the values on the stack are not variable names, @kbd{g a} will invent
- variable names for them (of the form @samp{PlotData@var{n}}) and store
- the values in those variables. The ``x'' and ``y'' variables are what
- go into the @code{plot} command in the template. If you add a curve
- that uses a certain variable and then later change that variable, you
- can replot the graph without having to delete and re-add the curve.
- That's because the variable name, not the vector, interval or formula
- itself, is what was added by @kbd{g a}.
- X
- A numeric prefix argument on @kbd{g a} or @kbd{g f} changes the way
- stack entries are interpreted as curves. With a positive prefix
- argument @cite{n}, the top @cite{n} stack entries are ``y'' values
- for @cite{n} different curves which share a common ``x'' value in
- the @cite{n+1}st stack entry. (Thus @kbd{g a} with no prefix
- argument is equivalent to @kbd{C-u 1 g a}.)
- X
- A prefix of zero or plain @kbd{C-u} means to take two stack entries,
- ``x'' and ``y'' as usual, but to interpret ``y'' as a vector of
- ``y'' values for several curves that share a common ``x''.
- X
- A negative prefix argument tells Calc to read @cite{n} vectors from
- the stack; each vector @cite{[x, y]} describes an independent curve.
- This is the only form of @kbd{g a} that creates several curves at once
- that don't have common ``x'' values. (Of course, the range of ``x''
- values covered by all the curves ought to be roughly the same if
- they are to look nice on the same graph.)
- X
- For example, to plot @c{$\sin n x$}
- @cite{sin(n x)} for integers @cite{n}
- from 1 to 5, you could use @kbd{v x} to create a vector of integers
- (@cite{n}), then @kbd{V M '} or @kbd{V M $} to map @samp{sin(n x)}
- across this vector. The resulting vector of formulas is suitable
- for use as the ``y'' argument to a @kbd{C-u g a} or @kbd{C-u g f}
- command.
- X
- @kindex g A
- @pindex calc-graph-add-3d
- The @kbd{g A} (@code{calc-graph-add-3d}) command adds a 3D curve
- to the graph. It is not legal to intermix 2D and 3D curves in a
- single graph. This command takes three arguments, ``x'', ``y'',
- and ``z'', from the stack. With a positive prefix @cite{n}, it
- takes @cite{n+2} arguments (common ``x'' and ``y'', plus @cite{n}
- separate ``z''s). With a zero prefix, it takes three stack entries
- but the ``z'' entry is a vector of curve values. With a negative
- prefix @cite{-n}, it takes @cite{n} vectors of the form @cite{[x, y, z]}.
- The @kbd{g A} command works by adding a @code{splot} (surface-plot)
- command to the @samp{*Gnuplot Commands*} buffer.
- X
- (Although @kbd{g a} adds a 2D @code{plot} command to the
- @samp{*Gnuplot Commands*} buffer, Calc changes this to @code{splot}
- before sending it to GNUPLOT if it notices that the data points are
- evaluating to @code{xyz} calls. It will not work to mix 2D and 3D
- @kbd{g a} curves in a single graph, although Calc does not currently
- check for this.)
- X
- @kindex g d
- @pindex calc-graph-delete
- The @kbd{g d} (@code{calc-graph-delete}) command deletes the most
- recently added curve from the graph. It has no effect if there are
- no curves in the graph. With a numeric prefix argument of any kind,
- it deletes all of the curves from the graph.
- X
- @kindex g H
- @pindex calc-graph-hide
- The @kbd{g H} (@code{calc-graph-hide}) command ``hides'' or ``unhides''
- the most recently added curve. A hidden curve will not appear in
- the actual plot, but information about it such its name and line and
- point styles will be retained.
- X
- @kindex g j
- @pindex calc-graph-juggle
- The @kbd{g j} (@code{calc-graph-juggle}) command moves the curve
- at the end of the list (the ``most recently added curve'') to the
- front of the list. The next-most-recent curve is thus exposed for
- @kbd{g d} or similar commands to use. With @kbd{g j} you can work
- with any curve in the graph even though curve-related commands only
- affect the last curve in the list.
- X
- @kindex g p
- @pindex calc-graph-plot
- The @kbd{g p} (@code{calc-graph-plot}) command uses GNUPLOT to draw
- the graph described in the @samp{*Gnuplot Commands*} buffer. Any
- GNUPLOT parameters which are not defined by commands in this buffer
- are reset to their default values. The variables named in the @code{plot}
- command are written to a temporary data file and the variable names
- are then replaced by the file name in the template. The resulting
- plotting commands are fed to the GNUPLOT program. See the documentation
- for the GNUPLOT program for more specific information. All temporary
- files are removed when Emacs or GNUPLOT exits.
- X
- If you give a formula for ``y'', Calc will remember all the values that
- it calculates for the formula so that later plots can reuse these values.
- Calc throws out these saved values when you change any circumstances
- that may affect the data, such as switching from Degrees to Radians
- mode, or changing the value of a parameter in the formula. You can
- force Calc to recompute the data from scratch by giving a negative
- numeric prefix argument to @kbd{g p}.
- X
- Calc uses a fairly rough step size when graphing formulas over intervals.
- This is to ensure quick response. You can ``refine'' a plot by giving
- a positive numeric prefix argument to @kbd{g p}. Calc goes through
- the data points it has computed and saved from previous plots of the
- function, and computes and inserts a new data point midway between
- each of the existing points. You can refine a plot any number of times,
- but beware that amount of calculation involved doubles each time.
- X
- Calc does not remember computed values for 3D graphs. This means the
- numerix prefix argument, if any, to @kbd{g p} is effectively ignored if
- the current graph is three-dimensional.
- X
- @kindex g P
- @pindex calc-graph-print
- The @kbd{g P} (@code{calc-graph-print}) command is like @kbd{g p},
- except that it sends the output to a printer instead of to the
- screen. More precisely, @kbd{g p} looks for @samp{set terminal}
- or @samp{set output} commands in the @samp{*Gnuplot Commands*} buffer;
- lacking these it uses the default settings. However, @kbd{g P}
- ignores @samp{set terminal} and @samp{set output} commands and
- uses a different set of default values. All of these values are
- controlled by the @kbd{g D} and @kbd{g O} commands discussed below.
- Provided everything is set up properly, @kbd{g p} will plot to
- the screen unless you have specified otherwise and @kbd{g P} will
- always plot to the printer.
- X
- @node Graphics Options, Devices, Managing Curves, Graphics
- @section Graphics Options
- X
- @noindent
- @kindex g g
- @pindex calc-graph-grid
- The @kbd{g g} (@code{calc-graph-grid}) command turns the ``grid''
- on and off. It is off by default; tick marks appear only at the
- edges of the graph. With the grid turned on, dotted lines appear
- across the graph at each tick mark. Note that this command only
- changes the setting in @samp{*Gnuplot Commands*}; to see the effects
- of the change you must give another @kbd{g p} command.
- X
- @kindex g b
- @pindex calc-graph-border
- The @kbd{g b} (@code{calc-graph-border}) command turns the border
- (the box that surrounds the graph) on and off. It is on by default.
- This command will only work with GNUPLOT 3.0 and later versions.
- X
- @kindex g k
- @pindex calc-graph-key
- The @kbd{g k} (@code{calc-graph-key}) command turns the ``key''
- on and off. The key is a chart in the corner of the graph that
- shows the correspondence between curves and line styles. It is
- off by default, and is only really useful if you have several
- curves on the same graph.
- X
- @kindex g N
- @pindex calc-graph-num-points
- The @kbd{g N} (@code{calc-graph-num-points}) command allows you
- to select the number of data points in the graph. This only affects
- curves where neither ``x'' nor ``y'' is specified as a vector.
- Enter a blank line to revert to the default value (initially 15).
- With a positive prefix argument this command changes or, if you enter
- a blank line, displays the default number of points used for all
- graphs created by @kbd{g a} that don't specify the resolution explicitly.
- With a negative prefix argument, this command changes or displays
- the default value (initially 5) used for 3D graphs created by @kbd{g A}.
- Note that a 3D setting of 5 means that a total of @cite{5^2 = 25} points
- will be computed for the surface.
- X
- Data points in the graph of a function are normally computed to a
- precision of five digits, regardless of the current precision at the
- time. This is usually more than adequate, but there are cases where
- it will not be. For example, plotting @cite{1 + x} for @cite{x} in the
- interval @samp{[0 ..@: 1e-6]} will round all the data points down
- to 1.0! Putting the command @samp{set precision @var{n}} in the
- @samp{*Gnuplot Commands*} buffer will cause the data to be computed
- at precision @var{n} instead of 5. Since this is such a rare case,
- there is no keystroke-based command to set the precision.
- X
- @kindex g h
- @pindex calc-graph-header
- The @kbd{g h} (@code{calc-graph-header}) command sets the title
- for the graph. This will show up centered above the graph.
- The default title is blank (no title).
- X
- @kindex g n
- @pindex calc-graph-name
- The @kbd{g n} (@code{calc-graph-name}) command sets the title of an
- individual curve. Like the other curve-manipulating commands, it
- affects the most recently added curve, i.e., the last curve on the
- list in the @samp{*Gnuplot Commands*} buffer. To set the title of
- the other curves you must first juggle them to the end of the list
- with @kbd{g j}, or edit the @samp{*Gnuplot Commands*} buffer by hand.
- Curve titles appear in the key; if the key is turned off they are
- not used.
- X
- @kindex g t
- @kindex g T
- @pindex calc-graph-title-x
- @pindex calc-graph-title-y
- The @kbd{g t} (@code{calc-graph-title-x}) and @kbd{g T}
- (@code{calc-graph-title-y}) commands set the titles on the ``x''
- and ``y'' axes, respectively. These titles appear next to the
- tick marks on the left and bottom edges of the graph, respectively.
- Calc does not have commands to control the tick marks themselves,
- but you can edit them into the @samp{*Gnuplot Commands*} buffer if
- you wish. See the GNUPLOT documentation for details.
- X
- @kindex g r
- @kindex g R
- @pindex calc-graph-range-x
- @pindex calc-graph-range-y
- The @kbd{g r} (@code{calc-graph-range-x}) and @kbd{g R}
- (@code{calc-graph-range-y}) commands set the range of values on the
- ``x'' and ``y'' axes, respectively. You are prompted to enter a
- suitable range. This should be either a pair of numbers of the
- form, @samp{@var{min}:@var{max}}, or a blank line to revert to the
- default behavior of setting the range based on the range of values
- in the data, or @samp{$} to take the range from the top of the stack.
- Ranges on the stack can be represented as either interval forms or
- vectors: @samp{[@var{min} ..@: @var{max}]} or @samp{[@var{min}, @var{max}]}.
- X
- @kindex g l
- @kindex g L
- @pindex calc-graph-log-x
- @pindex calc-graph-log-y
- The @kbd{g l} (@code{calc-graph-log-x}) and @kbd{g L} (@code{calc-graph-log-y})
- commands allow you to set either or both of the axes of the graph to
- be logarithmic instead of linear.
- X
- @kindex g C-l
- @kindex g C-r
- @kindex g C-t
- @pindex calc-graph-log-z
- @pindex calc-graph-range-z
- @pindex calc-graph-title-z
- For 3D plots, @kbd{g C-t}, @kbd{g C-r}, and @kbd{g C-l} (those are
- letters with the Control key held down) are the corresponding commands
- for the Z axis.
- X
- @kindex g z
- @kindex g Z
- @pindex calc-graph-zero-x
- @pindex calc-graph-zero-y
- The @kbd{g z} (@code{calc-graph-zero-x}) and @kbd{g Z}
- (@code{calc-graph-zero-y}) commands control whether a dotted line is
- drawn to indicate the ``x'' and/or ``y'' zero axes. (These are the same
- dotted lines that would be drawn there anyway if you used @kbd{g g} to
- turn the ``grid'' feature on.) Zero-axis lines are on by default, and
- may be turned off only in GNUPLOT 3.0 and later versions. They are
- not available for 3D plots.
- X
- @kindex g s
- @pindex calc-graph-line-style
- The @kbd{g s} (@code{calc-graph-line-style}) command turns the connecting
- lines on or off for the most recently added curve, and optionally selects
- the style of lines to be used for that curve. Plain @kbd{g s} simply
- toggles the lines on and off. With a numeric prefix argument, @kbd{g s}
- turns lines on and sets a particular line style. Line style numbers
- start at one and their meanings vary depending on the output device.
- GNUPLOT guarantees that there will be at least six different line styles
- available for any device.
- X
- @kindex g S
- @pindex calc-graph-point-style
- The @kbd{g S} (@code{calc-graph-point-style}) command similarly turns
- the symbols at the data points on or off, or sets the point style.
- If you turn both lines and points off, the data points will show as
- tiny dots.
- X
- @cindex @code{LineStyles} variable
- @cindex @code{PointStyles} variable
- @vindex LineStyles
- @vindex PointStyles
- Another way to specify curve styles is with the @code{LineStyles} and
- @code{PointStyles} variables. These variables initially have no stored
- values, but if you store a vector of integers in one of these variables,
- the @kbd{g a} and @kbd{g f} commands will use those style numbers
- instead of the defaults for new curves that are added to the graph.
- An entry should be a positive integer for a specific style, or 0 to
- let the style be chosen automatically, or -1 to turn off lines or points
- altogether. If there are more curves than elements in the vector, the
- last few curves will continue to have the default styles. Of course,
- you can later use @kbd{g s} and @kbd{g S} to change any of these styles.
- X
- For example, @kbd{'[2 -1 3] RET s t LineStyles} causes the first curve
- to have lines in style number 2, the second curve to have no connecting
- lines, and the third curve to have lines in style 3. Point styles will
- still be assigned automatically, but you could store another vector in
- @code{PointStyles} to define them, too.
- X
- @node Devices, , Graphics Options, Graphics
- @section Graphical Devices
- X
- @noindent
- @kindex g D
- @pindex calc-graph-device
- The @kbd{g D} (@code{calc-graph-device}) command sets the device name
- (or ``terminal name'' in GNUPLOT lingo) to be used by @kbd{g p} commands
- on this graph. It does not affect the permanent default device name.
- If you enter a blank name, the device name reverts to the default.
- Enter @samp{?} to see a list of supported devices.
- X
- With a positive numeric prefix argument, @kbd{g D} instead sets
- the default device name, used by all plots in the future which do
- not override it with a plain @kbd{g D} command. If you enter a
- blank line this command shows you the current default. The special
- name @code{default} signifies that Calc should choose @code{x11} if
- the X window system is in use (as indicated by the presence of a
- @code{DISPLAY} environment variable), or otherwise @code{dumb} under
- GNUPLOT 3.0 and later, or @code{postscript} under GNUPLOT 2.0.
- This is the initial default value.
- X
- The @code{dumb} device is an interface to ``dumb terminals,'' i.e.,
- terminals with no special graphics facilities. It writes a crude
- picture of the graph composed of characters like @code{-} and @code{|}
- to a buffer called @samp{*Gnuplot Trail*}, which Calc then displays.
- The graph is made the same size as the Emacs screen, which on most
- dumb terminals will be 80x24 characters. The graph is displayed in
- an Emacs ``recursive edit''; type @kbd{q} or @kbd{M-# M-#} to exit
- the recursive edit and return to Calc. Note that the @code{dumb}
- device is present only in GNUPLOT 3.0 and later versions.
- X
- The word @code{dumb} may be followed by two numbers separated by
- spaces. These are the desired width and height of the graph in
- characters. Also, the device name @code{big} is like @code{dumb}
- but creates a graph four times the width and height of the Emacs
- screen. You will then have to scroll around to view the entire
- graph. In the @samp{*Gnuplot Trail*} buffer, @key{SPC}, @key{DEL},
- @kbd{<}, and @kbd{>} are defined to scroll by one screenful in each
- of the four directions.
- X
- With a negative numeric prefix argument, @kbd{g P} sets or displays
- the device name used by @kbd{g P} (@code{calc-graph-print}). This
- is initially @code{postscript}. If you don't have a PostScript
- printer, you may decide once again to use @code{dumb} to create a
- plot on any text-only printer.
- X
- @kindex g O
- @pindex calc-graph-output
- The @kbd{g O} (@code{calc-graph-output}) command sets the name of
- the output file used by GNUPLOT. For some devices, notably @code{x11},
- there is no output file and this information is not used. Many other
- ``devices'' are really file formats like @code{postscript}; in these
- cases the output in the desired format goes into the file you name
- with @kbd{g O}. Type @kbd{g O stdout RET} to set GNUPLOT to write
- to its standard output stream, i.e., to @samp{*Gnuplot Trail*}.
- This is the default setting.
- X
- Another special output name is @code{tty}, which means that GNUPLOT
- is going to write graphics commands directly to its standard output,
- which you wish Emacs to pass through to your terminal. Tektronix
- graphics terminals, among other devices, operate this way. Calc does
- this by telling GNUPLOT to write to a temporary file, then running a
- sub-shell executing the command @samp{cat tempfile >/dev/tty}. On
- typical Unix systems, this will copy the temporary file directly to
- the terminal, bypassing Emacs entirely. You will have to type @kbd{C-l}
- to Emacs afterwards to refresh the screen.
- X
- Once again, @kbd{g O} with a positive or negative prefix argument
- sets the default or printer output file names, respectively. In each
- case you can specify @code{auto}, which causes Calc to invent a temporary
- file name for each @kbd{g p} (or @kbd{g P}) command. This temporary file
- will be deleted once it has been displayed or printed. If the output file
- name is not @code{auto}, the file is not automatically deleted.
- X
- The default and printer devices and output files can be saved
- permanently by the @kbd{m m} (@code{calc-save-modes}) command. The
- default number of data points (see @kbd{g N}) and the X geometry
- (see @kbd{g X}) are also saved. Other graph information is @emph{not}
- saved; you can save a graph's configuration simply by saving the contents
- of the @samp{*Gnuplot Commands*} buffer.
- X
- @vindex calc-gnuplot-plot-command
- @vindex calc-gnuplot-default-device
- @vindex calc-gnuplot-default-output
- @vindex calc-gnuplot-print-command
- @vindex calc-gnuplot-print-device
- @vindex calc-gnuplot-print-output
- If you are installing Calc you may wish to configure the default and
- printer devices and output files for the whole system. The relevant
- Lisp variables are @code{calc-gnuplot-default-device} and @code{-output},
- and @code{calc-gnuplot-print-device} and @code{-output}. The output
- file names must be either strings as described above, or Lisp
- expressions which are evaluated on the fly to get the output file name.
- X
- Other important Lisp variables are @code{calc-gnuplot-plot-command} and
- @code{calc-gnuplot-print-command}, which give the system commands to
- display or print the output of GNUPLOT, respectively. These may be
- @code{nil} if no command is necessary, or strings which can include
- @samp{%s} to signify the name of the file to be displayed or printed.
- Or, these variables may contain Lisp expressions which are evaluated
- to display or print the output.
- X
- @kindex g x
- @pindex calc-graph-display
- The @kbd{g x} (@code{calc-graph-display}) command lets you specify
- on which X window system display your graphs should be drawn. Enter
- a blank line to see the current display name. This command has no
- effect unless the current device is @samp{x11}.
- X
- @kindex g X
- @pindex calc-graph-geometry
- The @kbd{g X} (@code{calc-graph-geometry}) command is a similar
- command for specifying the position and size of the X window.
- The normal value is @samp{default}, which generally means your
- window manager will let you place the window interactively.
- Entering @samp{800x500+0+0} would create an 800-by-500 pixel
- window in the upper-left corner of the screen.
- X
- The buffer called @samp{*Gnuplot Trail*} holds a transcript of the
- session with GNUPLOT. This shows the commands Calc has ``typed'' to
- GNUPLOT and the responses it has received. Calc tries to notice when an
- error message has appeared here and display the buffer for you when
- this happens. You can check this buffer yourself if you suspect
- something has gone wrong.
- X
- @kindex g C
- @pindex calc-graph-command
- The @kbd{g C} (@code{calc-graph-command}) command prompts you to
- enter any line of text, then simply sends that line to the current
- GNUPLOT process. The @samp{*Gnuplot Trail*} buffer looks deceptively
- like a Shell buffer but you can't type commands in it yourself.
- Instead, you must use @kbd{g C} for this purpose.
- X
- @kindex g v
- @kindex g V
- @pindex calc-graph-view-commands
- @pindex calc-graph-view-trail
- The @kbd{g v} (@code{calc-graph-view-commands}) and @kbd{g V}
- (@code{calc-graph-view-trail}) commands display the @samp{*Gnuplot Commands*}
- and @samp{*Gnuplot Trail*} buffers, respectively, in another window.
- This happens automatically when Calc thinks there is something you
- will want to see in either of these buffers. If you type @kbd{g v}
- or @kbd{g V} when the relevant buffer is already displayed, the
- buffer is hidden again.
- X
- One reason to use @kbd{g v} is to add your own commands to the
- @samp{*Gnuplot Commands*} buffer. Press @kbd{g v}, then use
- @kbd{C-x o} to switch into that window. For example, GNUPLOT has
- @samp{set label} and @samp{set arrow} commands that allow you to
- annotate your plots. Since Calc doesn't understand these commands,
- you have to add them to the @samp{*Gnuplot Commands*} buffer
- yourself, then use @kbd{g p} to replot using these new commands. Note
- that your commands must appear @emph{before} the @code{plot} command.
- To get help on any GNUPLOT feature, type, e.g., @kbd{g C help set label}.
- You may have to type @kbd{g C RET} a few times to clear the
- ``press return for more'' or ``subtopic of @dots{}'' requests.
- Note that Calc always sends commands (like @samp{set nolabel}) to
- reset all plotting parameters to the defaults before each plot, so
- to delete a label all you need to do is delete the @samp{set label}
- line you added (or comment it out with @samp{#}) and then replot
- with @kbd{g p}.
- X
- @kindex g q
- @pindex calc-graph-quit
- You can use @kbd{g q} (@code{calc-graph-quit}) to kill the GNUPLOT
- process that is running. The next graphing command you give will
- start a fresh GNUPLOT process. The word @samp{Graph} appears in
- the Calc window's mode line whenever a GNUPLOT process is currently
- running. The GNUPLOT process is automatically killed when you
- exit Emacs if you haven't killed it manually by then.
- X
- @kindex g K
- @pindex calc-graph-kill
- The @kbd{g K} (@code{calc-graph-kill}) command is like @kbd{g q}
- except that it also views the @samp{*Gnuplot Trail*} buffer so that
- you can see the process being killed. This is better if you are
- killing GNUPLOT because you think it has gotten stuck.
- X
- @node Kill and Yank, Keypad Mode, Graphics, Top
- @chapter Kill and Yank Functions
- X
- @noindent
- The commands in this chapter move information between the Calculator and
- other Emacs editing buffers.
- X
- In many cases Embedded Mode is an easier and more natural way to
- work with Calc from a regular editing buffer. @xref{Embedded Mode}.
- X
- @menu
- * Killing From Stack::
- * Yanking Into Stack::
- * Grabbing From Buffers::
- * Yanking Into Buffers::
- * X Cut and Paste::
- * Editing Stack Entries::
- @end menu
- X
- @node Killing From Stack, Yanking Into Stack, Kill and Yank, Kill and Yank
- @section Killing from the Stack
- X
- @noindent
- @kindex C-k
- @pindex calc-kill
- @kindex M-k
- @pindex calc-copy-as-kill
- @kindex C-w
- @pindex calc-kill-region
- @kindex M-w
- @pindex calc-copy-region-as-kill
- @cindex Kill ring
- @dfn{Kill} commands are Emacs commands that insert text into the
- ``kill ring,'' from which it can later be ``yanked'' by a @kbd{C-y}
- command. Three common kill commands in normal Emacs are @kbd{C-k}, which
- kills one line, @kbd{C-w}, which kills the region between mark and point,
- and @kbd{M-w}, which puts the region into the kill ring without actually
- deleting it. All of these commands work in the Calculator, too. Also,
- @kbd{M-k} has been provided to complete the set; it puts the current line
- into the kill ring without deleting anything.
- X
- The kill commands are unusual in that they pay attention to the location
- of the cursor in the Calculator buffer. If the cursor is on or below the
- bottom line, the kill commands operate on the top of the stack. Otherwise,
- they operate on whatever stack element the cursor is on. Calc's kill
- commands always operate on whole stack entries. (They act the same as their
- standard Emacs cousins except they ``round up'' the specified region to
- encompass full lines.) The text is copied into the kill ring exactly as
- it appears on the screen, including line numbers if they are enabled.
- X
- A numeric prefix argument to @kbd{C-k} or @kbd{M-k} affects the number
- of lines killed. A positive argument kills the current line and @cite{n-1}
- lines below it. A negative argument kills the @cite{-n} lines above the
- current line. Again this mirrors the behavior of the standard Emacs
- @kbd{C-k} command. Although a whole line is always deleted, @kbd{C-k}
- with no argument copies only the number itself into the kill ring, whereas
- @kbd{C-k} with a prefix argument of 1 copies the number with its trailing
- newline.
- X
- @node Yanking Into Stack, Grabbing From Buffers, Killing From Stack, Kill and Yank
- @section Yanking into the Stack
- X
- @noindent
- @kindex C-y
- @pindex calc-yank
- The @kbd{C-y} command yanks the most recently killed text back into the
- Calculator. It pushes this value onto the top of the stack regardless of
- the cursor position. In general it re-parses the killed text as a number
- or formula (or list of these separated by commas or newlines). However if
- the thing being yanked is something that was just killed from the Calculator
- itself, its full internal structure is yanked. For example, if you have
- set the floating-point display mode to show only four significant digits,
- then killing and re-yanking 3.14159 (which displays as 3.142) will yank the
- full 3.14159, even though yanking it into any other buffer would yank the
- number in its displayed form, 3.142. (Since the default display modes
- show all objects to their full precision, this feature normally makes no
- difference.)
- X
- @node Grabbing From Buffers, Yanking Into Buffers, Yanking Into Stack, Kill and Yank
- @section Grabbing from Other Buffers
- X
- @noindent
- @kindex M-# g
- @pindex calc-grab-region
- The @kbd{M-# g} (@code{calc-grab-region}) command takes the text between
- point and mark in the current buffer and attempts to parse it as a
- vector of values. Basically, it wraps the text in vector brackets
- @samp{[ ]} unless the text already is enclosed in vector brackets,
- then reads the text as if it were an algebraic entry. The contents
- of the vector may be numbers, formulas, or any other Calc objects.
- X
- A numeric prefix argument grabs the specified number of lines around
- point, ignoring the mark. A positive prefix grabs from point to the
- @cite{n}th following newline (so that @kbd{M-1 M-# g} grabs from point
- to the end of the current line); a negative prefix grabs from points
- back to the @cite{n+1}st preceding newline. In both cases, the text
- that is grabbed is exactly the same as the text that @kbd{C-k} would
- delete given that prefix argument.
- X
- A prefix of zero grabs the current line; point may be anywhere on the
- line.
- X
- A plain @kbd{C-u} prefix interprets the region between point and mark
- as a single number or formula rather than a vector. For example,
- @kbd{M-# g} on the text @samp{2 a b} produces the vector of three
- values @samp{[2, a, b]}, but @kbd{C-u M-# g} on the same region
- reads a formula which is a product of three things: @samp{2 a b}.
- X
- If a different language has been specified (@pxref{Language Modes}),
- the grabbed text will be interpreted according to that language.
- If the @kbd{M-# g} command works successfully, it does an automatic
- @kbd{M-# c} to enter the Calculator buffer.
- X
- @kindex M-# r
- @pindex calc-grab-rectangle
- The @kbd{M-# r} (@code{calc-grab-rectangle}) command takes the text between
- point and mark and attempts to parse it as a matrix. If point and mark
- are both in the leftmost column, the lines in between are parsed in their
- entirety. Otherwise, point and mark define the corners of a rectangle
- whose contents are parsed.
- X
- Each line of the grabbed area becomes a row of the matrix. The result
- will actually be a vector of vectors, which Calc will treat as a matrix
- only if every row contains the same number of values.
- X
- If a line contains a portion surrounded by square brackets (or curly
- braces), that portion is interpreted as a vector which becomes a row
- of the matrix. Any text surrounding the bracketed portion on the line
- is ignored.
- X
- Otherwise, the entire line is interpreted as a row vector as if it
- were surrounded by square brackets. Leading line numbers (in the
- format used in the Calc stack buffer) are ignored. If you wish to
- force this interpretation (even if the line contains bracketed
- portions), give a negative numeric prefix argument to the
- @kbd{M-# r} command.
- X
- If you give a numeric prefix argument of zero or plain @kbd{C-u}, each
- line is instead interpreted as a single formula which is converted into
- a one-element vector. Thus the result of @kbd{C-u M-# r} will be a
- one-column matrix. For example, suppose one line of the data is the
- expression @samp{2 a}. A plain @kbd{M-# r} will interpret this as
- @samp{[2 a]}, which in turn is read as a two-element vector that forms
- one row of the matrix. But a @kbd{C-u M-# r} will interpret this row
- as @samp{[2*a]}.
- X
- If you give a positive numeric prefix argument @var{n}, then each line
- will be split up into columns of width @var{n}; each column is parsed
- separately as a matrix element. If a line contained @samp{2 +/- 3 4 +/- 5},
- then grabbing with a prefix argument of 8 would correctly split the
- line into two error forms.
- X
- @xref{Matrix Functions}, to see how to pull the matrix apart into its
- constituent rows and columns. (If it is a @c{$1\times1$}
- @asis{1x1} matrix, just hit @kbd{v u}
- (@code{calc-unpack}) twice.)
- X
- @kindex M-# :
- @kindex M-# _
- @pindex calc-grab-sum-across
- @pindex calc-grab-sum-down
- @cindex Summing rows and columns of data
- The @kbd{M-# :} (@code{calc-grab-sum-down}) command is a handy way to
- grab a rectangle of data and sum its columns. It is equivalent to
- typing @kbd{M-# r}, followed by @kbd{V R : +} (the vector reduction
- command that sums the columns of a matrix; @pxref{Reducing}). The
- result of the command will be a vector of numbers, one for each column
- in the input data. The @kbd{M-# _} (@code{calc-grab-sum-across}) command
- similarly grabs a rectangle and sums its rows by executing @kbd{V R _ +}.
- X
- For example, suppose we have a column of numbers in a file which we
- wish to sum. Go to one corner of the column and press @kbd{C-@@} to
- set the mark; go to the other corner and type @kbd{M-# :}. Since there
- is only one column, the result will be a vector of one number, the sum.
- (You can type @kbd{v u} to unpack this vector into a plain number if
- you want to do further arithmetic with it.)
- X
- To compute the product of the column of numbers, we would have to do
- it ``by hand'' since there's no special grab-and-multiply command.
- Use @kbd{M-# r} to grab the column of numbers into the calculator in
- the form of a column matrix. The statistics command @kbd{u *} is a
- handy way to find the product of a vector or matrix of numbers.
- @xref{Statistical Operations}. Another approach would be to use
- general-purpose vector commands, like @kbd{v t} to transpose the data
- into a row matrix, @kbd{v u} to unpack this into a simple vector
- (recall, a one-row matrix is a vector of a single vector), and
- @kbd{V R *} to compute the product of the vector.
- X
- @node Yanking Into Buffers, X Cut and Paste, Grabbing From Buffers, Kill and Yank
- @section Yanking into Other Buffers
- X
- @noindent
- @kindex y
- @pindex calc-copy-to-buffer
- The plain @kbd{y} (@code{calc-copy-to-buffer}) command inserts the number
- at the top of the stack into the most recently used normal editing buffer.
- (More specifically, this is the most recently used buffer which is displayed
- in a window and whose name does not begin with @samp{*}. If there is no
- such buffer, this is the most recently used buffer except for Calculator
- and Calc Trail buffers.) The number is inserted exactly as it appears and
- without a newline. (If line-numbering is enabled, the line number is
- normally not included.) The number is @emph{not} removed from the stack.
- X
- With a prefix argument, @kbd{y} inserts several numbers, one per line.
- A positive argument inserts the specified number of values from the top
- of the stack. A negative argument inserts the @cite{n}th value from the
- top of the stack. An argument of zero inserts the entire stack. Note
- that @kbd{y} with an argument of 1 is slightly different from @kbd{y}
- with no argument; the former always copies full lines, whereas the
- latter strips off the trailing newline.
- X
- With a lone @kbd{C-u} as a prefix argument, @kbd{y} @emph{replaces} the
- region in the other buffer with the yanked text, then quits the
- Calculator, leaving you in that buffer. A typical use would be to use
- @kbd{M-# g} to read a region of data into the Calculator, operate on the
- data to produce a new matrix, then type @kbd{C-u y} to replace the
- original data with the new data. One might wish to alter the matrix
- display style (@pxref{Vector and Matrix Formats}) or change the current
- display language (@pxref{Language Modes}) before doing this. Also, note
- that this command replaces a linear region of text (as grabbed by
- @kbd{M-# g}, not a rectangle (as grabbed by @kbd{M-# r}.@refill
- X
- If the editing buffer is in overwrite (as opposed to insert) mode,
- and the @kbd{C-u} prefix was not used, then the yanked number will
- overwrite the characters following point rather than being inserted
- before those characters. The usual conventions of overwrite mode
- are observed; for example, characters will be inserted at the end of
- a line rather than overflowing onto the next line. Yanking a multi-line
- object such as a matrix in overwrite mode overwrites the next @var{n}
- lines in the buffer, lengthening or shortening each line as necessary.
- Finally, if the thing being yanked is a simple integer or floating-point
- number (like @samp{-1.2345e-3}) and the characters following point also
- make up such a number, then Calc will replace that number with the new
- number, lengthening or shortening as necessary. The concept of
- ``overwrite mode'' has thus been generalized from overwriting characters
- to overwriting one complete number with another.
- X
- @kindex M-# y
- The @kbd{M-# y} key sequence is equivalent to @kbd{y} except that
- it can be typed anywhere, not just in Calc. This provides an easy
- way to guarantee that Calc knows which editing buffer you want to use!
- X
- @node X Cut and Paste, Editing Stack Entries, Yanking Into Buffers, Kill and Yank
- @section X Cut and Paste
- X
- @noindent
- If you are using Emacs with the X window system, there is an easier
- way to move small amounts of data into and out of the calculator:
- Use the mouse-oriented cut and paste facilities of X.
- X
- The default bindings for a three-button mouse cause the left button
- to move the Emacs cursor to the given place, the right button to
- select the text between the cursor and the clicked location, and
- the middle button to yank the selection into the buffer at the
- clicked location. So, if you have a Calc window and an editing
- window on your Emacs screen, you can use left-click/right-click
- to select a number, vector, or formula from one window, then
- middle-click to paste that value into the other window. When you
- paste text into the Calc window, Calc interprets it as an algebraic
- entry. It doesn't matter where you click in the Calc window; the
- new value is always pushed onto the top of the stack.
- X
- The @code{xterm} program that is typically used for general-purpose
- shell windows in X interprets the mouse buttons in the same way.
- So you can use the mouse to move data between Calc and any other
- Unix program. One nice feature of @code{xterm} is that a double
- left-click selects one word, and a triple left-click selects a
- whole line. So you can usually transfer a single number into Calc
- just by double-clicking on it in the shell, then middle-clicking
- in the Calc window.
- X
- @node Editing Stack Entries, , X Cut and Paste, Kill and Yank
- @section Editing Stack Entries
- X
- @noindent
- @kindex `
- @pindex calc-edit
- @pindex calc-edit-finish
- @cindex Editing the stack with Emacs
- The backquote, @kbd{`} (@code{calc-edit}) command creates a temporary
- buffer (@samp{*Calc Edit*}) for editing the top-of-stack value using
- regular Emacs commands. With a numeric prefix argument, it edits the
- specified number of stack entries at once. (An argument of zero edits
- the entire stack; a negative argument edits one specific stack entry.)
- X
- When you are done editing, press @kbd{M-# M-#} to finish and return
- to Calc. The @key{RET} and @key{LFD} keys also work to finish most
- sorts of editing, though in some cases Calc leaves @key{RET} with its
- usual meaning (``insert a newline'') if it's a situation where you
- might want to insert new lines into the editing buffer. The traditional
- Emacs ``finish'' key sequence, @kbd{C-c C-c}, also works to finish
- editing and may be easier to type, depending on your keyboard.
- X
- When you finish editing, the Calculator parses the lines of text in
- the @samp{*Calc Edit*} buffer as numbers or formulas, replaces the
- original stack elements in the original buffer with these new values,
- then kills the @samp{*Calc Edit*} buffer. The original Calculator buffer
- continues to exist during editing, but for best results you should be
- careful not to change it until you have finished the edit. You can
- also cancel the edit by pressing @kbd{M-# x}.
- X
- If you give a prefix argument to @kbd{M-# M-#} (or @kbd{C-c C-c}),
- Calc will not kill the @samp{*Calc Edit*} buffer. You can switch
- back to that buffer and continue editing if you wish. However, you
- should understand that if you initiated the edit with @kbd{`}, the
- @kbd{M-# M-#} operation will be programmed to replace the top of the
- stack with the new edited value, and it will do this even if you have
- rearranged the stack in the meanwhile. This is not so much of a problem
- with other editing commands, though, such as @kbd{s e}
- (@code{calc-edit-variable}; @pxref{Operations on Variables}).
- X
- If the @code{calc-edit} command involves more than one stack entry,
- each line of the @samp{*Calc Edit*} buffer is interpreted as a
- separate formula. Otherwise, the entire buffer is interpreted as
- one formula, with line breaks ignored. (You can use @kbd{C-o} or
- @kbd{C-q C-j} to insert a newline in the buffer without pressing @key{RET}.)
- X
- The @kbd{`} key also works during numeric or algebraic entry. The
- text entered so far is moved to the @code{*Calc Edit*} buffer for
- more extensive editing than is convenient in the minibuffer.
- X
- The @kbd{s e} (@code{calc-edit-variable}) command edits the stored
- value of a variable. @xref{Operations on Variables}.
- X
- @node Keypad Mode, Embedded Mode, Kill and Yank, Introduction
- @chapter ``Keypad'' Mode
- X
- @noindent
- @kindex M-# k
- @pindex calc-keypad
- The @kbd{M-# k} (@code{calc-keypad}) command starts the Calculator
- and displays a picture of a Calculator-style keypad. If you are using
- the X window system, you can click on any of the ``keys'' in the
- keypad using the left mouse button to operate the calculator.
- The original window remains the selected window; in keypad mode
- you can type in your file while simultaneously performing
- calculations with the mouse.
- X
- @pindex full-calc-keypad
- If you have used @kbd{M-# b} first, @kbd{M-# k} instead invokes
- the @code{full-calc-keypad} command, which takes over the whole
- Emacs screen and displays the keypad, the Calc stack, and the Calc
- trail all at once. This mode would normally be used when running
- Calc standalone (@pxref{Standalone Operation}).
- X
- If you aren't using the X window system, you must switch into
- the @samp{*Calc Keypad*} window, place the cursor on the desired
- ``key,'' and type @key{SPC} or @key{RET}. If you think this
- is easier than using Calc normally, go right ahead.
- X
- Calc commands are more or less the same in keypad mode. Certain
- keypad keys differ slightly from the corresponding normal Calc
- keystrokes; all such deviations are described below.
- X
- Keypad Mode includes many more commands than will fit on the keypad
- at once. Click the right mouse button [@code{calc-keypad-menu}]
- to switch to the next menu. The bottom five rows of the keypad
- SHAR_EOF
- true || echo 'restore of calc.texinfo failed'
- fi
- echo 'End of part 50'
- echo 'File calc.texinfo is continued in part 51'
- echo 51 > _shar_seq_.tmp
- exit 0
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-