@setchapternewpage odd
@comment %**end of header (This is for running Texinfo on a region.)
+@include emacsver.texi
+
@c The following macros are used for conditional output for single lines.
@c @texline foo
@c `foo' will appear only in TeX output
@newcount@calcpageno
@newtoks@calcoldeverypar @calcoldeverypar=@everypar
@everypar={@calceverypar@the@calcoldeverypar}
-@ifx@turnoffactive@undefinedzzz@def@turnoffactive{}@fi
@ifx@ninett@undefinedzzz@font@ninett=cmtt9@fi
@catcode`@\=0 \catcode`\@=11
\r@ggedbottomtrue
This file documents Calc, the GNU Emacs calculator.
@end ifinfo
@ifnotinfo
-This file documents Calc, the GNU Emacs calculator, included with GNU Emacs 23.3.
+This file documents Calc, the GNU Emacs calculator, included with
+GNU Emacs @value{EMACSVER}.
@end ifnotinfo
Copyright @copyright{} 1990, 1991, 2001, 2002, 2003, 2004,
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ 2 + { 3 \times 4 \times 5 \over 6 \times 7^8 } - 9 $$
\afterdisplay
@end group
@end ifnottex
@tex
-\turnoffactive
\beforedisplayh
$$ \openup1\jot \tabskip=0pt plus1fil
\halign to\displaywidth{\tabskip=0pt
@end group
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ \pmatrix{ 1 & 2 & 3 \cr 4 & 5 & 6 \cr 7 & 6 & 0 }
\times
@end group
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ \eqalign{ x &+ a y = 6 \cr
x &+ b y = 10}
@samp{trn(A)*A*X = trn(A)*B}.
@end ifnottex
@tex
-\turnoffactive
$A^T A \, X = A^T B$, where $A^T$ is the transpose \samp{trn(A)}.
@end tex
Now
@end group
@end ifnottex
@tex
-\turnoffactive
\beforedisplayh
$$ \openup1\jot \tabskip=0pt plus1fil
\halign to\displaywidth{\tabskip=0pt
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ m = {N \sum x y - \sum x \sum y \over
N \sum x^2 - \left( \sum x \right)^2} $$
@samp{sum(x y)}.)
@end ifnottex
@tex
-\turnoffactive
These are $\sum x$, $\sum x^2$, $\sum y$, and $\sum x y$,
respectively. (We could have used \kbd{*} to compute $\sum x^2$ and
$\sum x y$.)
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ b = {\sum y - m \sum x \over N} $$
\afterdisplay
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ \displaylines{
\qquad {h \over 3} (f(a) + 4 f(a+h) + 2 f(a+2h) + 4 f(a+3h) + \cdots
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ h (f(a) + f(a+h) + f(a+2h) + f(a+3h) + \cdots
+ f(a+(n-2)h) + f(a+(n-1)h)) $$
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ \cos x = 1 - {x^2 \over 2!} + {x^4 \over 4!} - {x^6 \over 6!} + \cdots $$
\afterdisplay
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ \cos x = 1 - {x^2 \over 2!} + O(x^3) $$
\afterdisplay
@end ifnottex
@tex
\beforedisplay
-$$ x_{\rm new} = x - {f(x) \over f'(x)} $$
+$$ x_{\rm new} = x - {f(x) \over f^{\prime}(x)} $$
\afterdisplay
@end tex
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ \eqalign{ s(n,n) &= 1 \qquad \hbox{for } n \ge 0, \cr
s(n,0) &= 0 \qquad \hbox{for } n > 0, \cr
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ \eqalign{ x &+ a y = 6 \cr
x &+ b y = 10}
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplayh
$$ \openup1\jot \tabskip=0pt plus1fil
\halign to\displaywidth{\tabskip=0pt
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ m \times x + b \times 1 = y $$
\afterdisplay
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ 3 (3 a + b - 511 m) + c - 511 n $$
\afterdisplay
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ 9 a + 3 b + c - 511\times3 m - 511 n $$
\afterdisplay
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
-$$ 9 a + 3 b + c - 511 n' $$
+$$ 9 a + 3 b + c - 511 n^{\prime} $$
\afterdisplay
@end tex
their default values, then settings from the file you named are loaded
if this file exists, and this file becomes the one that Calc will
use in the future for commands like @kbd{m m}. The default settings
-file name is @file{~/.calc.el}. You can see the current file name by
+file name is @file{~/.emacs.d/calc.el}. You can see the current file name by
giving a blank response to the @kbd{m F} prompt. See also the
discussion of the @code{calc-settings-file} variable; @pxref{Customizing Calc}.
toggle the Inverse and/or Hyperbolic flags and then execute the
corresponding base command (@code{calc-sin} in this case).
-The Inverse and Hyperbolic flags apply only to the next Calculator
-command, after which they are automatically cleared. (They are also
-cleared if the next keystroke is not a Calc command.) Digits you
-type after @kbd{I} or @kbd{H} (or @kbd{K}) are treated as prefix
-arguments for the next command, not as numeric entries. The same
-is true of @kbd{C-u}, but not of the minus sign (@kbd{K -} means to
-subtract and keep arguments).
-
-The third Calc prefix flag, @kbd{K} (keep-arguments), is discussed
+@kindex O
+@pindex calc-option
+The @kbd{O} key (@code{calc-option}) sets another flag, the
+@dfn{Option Flag}, which also can alter the subsequent Calc command in
+various ways.
+
+The Inverse, Hyperbolic and Option flags apply only to the next
+Calculator command, after which they are automatically cleared. (They
+are also cleared if the next keystroke is not a Calc command.) Digits
+you type after @kbd{I}, @kbd{H} or @kbd{O} (or @kbd{K}) are treated as
+prefix arguments for the next command, not as numeric entries. The
+same is true of @kbd{C-u}, but not of the minus sign (@kbd{K -} means
+to subtract and keep arguments).
+
+Another Calc prefix flag, @kbd{K} (keep-arguments), is discussed
elsewhere. @xref{Keep Arguments}.
@node Calculation Modes, Simplification Modes, Inverse and Hyperbolic, Mode Settings
entirety.)
@cindex Two's complements
-With the binary, octal and hexadecimal display modes, Calc can
-display @expr{w}-bit integers using two's complement notation. This
-option is selected with the key sequences @kbd{C-u d 2}, @kbd{C-u d 8}
-and @kbd{C-u d 6}, respectively, and a negative word size might be
-appropriate (@pxref{Binary Functions}). In two's complement
-notation, the integers in the (nearly) symmetric interval from
+Calc can display @expr{w}-bit integers using two's complement
+notation, although this is most useful with the binary, octal and
+hexadecimal display modes. This option is selected by using the
+@kbd{O} option prefix before setting the display radix, and a negative word
+size might be appropriate (@pxref{Binary Functions}). In two's
+complement notation, the integers in the (nearly) symmetric interval
+from
@texline @math{-2^{w-1}}
@infoline @expr{-2^(w-1)}
to
@texline @math{\sin(2 + x)}.
@infoline @expr{sin(2 + x)}.
+The @TeX{} specific unit names (@pxref{Predefined Units}) will not use
+the @samp{tex} prefix; the unit name for a @TeX{} point will be
+@samp{pt} instead of @samp{texpt}, for example.
+
Function and variable names not treated specially by @TeX{} and La@TeX{}
are simply written out as-is, which will cause them to come out in
italic letters in the printed document. If you invoke @kbd{d T} or
@end group
@end example
@tex
-\turnoffactive
$$ [3 + 4i, {3 \over 4}, 3 \pm 4, [ 3 \ldots \infty)] $$
@end tex
@sp 1
@end group
@end example
@tex
-\turnoffactive
$$ [\sin{a}, \sin{2 a}, \sin(2 + a), \sin\left( {a \over b} \right)] $$
@end tex
@sp 2
@end group
@end example
@tex
-\turnoffactive
$$ 2 + 3 \to 5 $$
$$ 5 $$
@end tex
@end group
@end example
@tex
-\turnoffactive
$$ [{2 + 3 \to 5}, {{a \over 2} \to {b + c \over 2}}] $$
{\let\to\Rightarrow
$$ [{2 + 3 \to 5}, {{a \over 2} \to {b + c \over 2}}] $$}
@end group
@end example
@tex
-\turnoffactive
$$ \matrix{ {a \over b} & 0 \cr 0 & 2^{(x + 1)} } $$
$$ \pmatrix{ {a \over b} & 0 \cr 0 & 2^{(x + 1)} } $$
@end tex
Selections show deep structure (@kbd{j b}; @pxref{Making Selections}).
@item Save
-Record modes in @file{~/.calc.el} (@kbd{m R}; @pxref{General Mode Commands}).
+Record modes in @file{~/.emacs.d/calc.el} (@kbd{m R}; @pxref{General Mode Commands}).
@item Local
Record modes in Embedded buffer (@kbd{m R}).
@end example
@end ifnottex
@tex
-\turnoffactive
$$ \code{fv}(r, n, p) = p { (1 + r)^n - 1 \over r } $$
$$ \code{fvb}(r, n, p) = p { ((1 + r)^n - 1) (1 + r) \over r } $$
$$ \code{fvl}(r, n, p) = p (1 + r)^n $$
and @kbd{H I f G} [@code{gammaG}] commands.
@end ifnottex
@tex
-\turnoffactive
The functions corresponding to the integrals that define $P(a,x)$
and $Q(a,x)$ but without the normalizing $1/\Gamma(a)$
factor are called $\gamma(a,x)$ and $\Gamma(a,x)$, respectively.
that the counts in the result vector don't add up to the length of the
input vector.)
+If no prefix is given, then you will be prompted for a vector which
+will be used to determine the bins. (If a positive integer is given at
+this prompt, it will be still treated as if it were given as a
+prefix.) Each bin will consist of the interval of numbers closest to
+the corresponding number of this new vector; if the vector
+@expr{[a, b, c, ...]} is entered at the prompt, the bins will be
+@expr{(-inf, (a+b)/2]}, @expr{((a+b)/2, (b+c)/2]}, etc. The result of
+this command will be a vector counting how many elements of the
+original vector are in each bin.
+
+The result will then be a vector with the same length as this new vector;
+each element of the new vector will be replaced by the number of
+elements of the original vector which are closest to it.
+
@kindex H v H
@kindex H V H
With the Hyperbolic flag, @kbd{H V H} pulls two vectors from the stack.
@texline @math{1 /\sigma^2}.
@infoline @expr{1 / s^2}.
@tex
-\turnoffactive
$$ \mu = { \displaystyle \sum { x_i \over \sigma_i^2 } \over
\displaystyle \sum { 1 \over \sigma_i^2 } } $$
@end tex
of the input errors. (I.e., the variance is the reciprocal of the
sum of the reciprocals of the variances.)
@tex
-\turnoffactive
$$ \sigma_\mu^2 = {1 \over \displaystyle \sum {1 \over \sigma_i^2}} $$
@end tex
If the inputs are plain
then assuming each value's error is equal to this standard
deviation.)
@tex
-\turnoffactive
$$ \sigma_\mu^2 = {\sigma^2 \over N} $$
@end tex
defined as the reciprocal of the arithmetic mean of the reciprocals
of the values.
@tex
-\turnoffactive
$$ { N \over \displaystyle \sum {1 \over x_i} } $$
@end tex
equal to the @code{exp} of the arithmetic mean of the logarithms
of the data values.
@tex
-\turnoffactive
$$ \exp \left ( \sum { \ln x_i } \right ) =
\left ( \prod { x_i } \right)^{1 / N} $$
@end tex
replacing the two numbers with their arithmetic mean and geometric
mean, then repeating until the two values converge.
@tex
-\turnoffactive
$$ a_{i+1} = { a_i + b_i \over 2 } , \qquad b_{i+1} = \sqrt{a_i b_i} $$
@end tex
the differences between the values and the mean of the @expr{N} values,
divided by @expr{N-1}.
@tex
-\turnoffactive
$$ \sigma^2 = {1 \over N - 1} \sum (x_i - \mu)^2 $$
@end tex
data values, so that the mean computed from the input is itself
only an estimate of the true mean.
@tex
-\turnoffactive
$$ \sigma^2 = {1 \over N} \sum (x_i - \mu)^2 $$
@end tex
is taken as the square root of the sum of the squares of the two
input errors.
@tex
-\turnoffactive
$$ \sigma_{x\!y}^2 = {1 \over N-1} \sum (x_i - \mu_x) (y_i - \mu_y) $$
$$ \sigma_{x\!y}^2 =
{\displaystyle {1 \over N-1}
product of their standard deviations. (There is no difference
between sample or population statistics here.)
@tex
-\turnoffactive
$$ r_{x\!y} = { \sigma_{x\!y}^2 \over \sigma_x^2 \sigma_y^2 } $$
@end tex
@noindent
Every character not part of the sub-formula @samp{b} has been changed
-to a dot. The @samp{*} next to the line number is to remind you that
+to a dot. (If the customizable variable
+@code{calc-highlight-selections-with-faces} is non-nil, then the characters
+not part of the sub-formula are de-emphasized by using a less
+noticeable face instead of using dots. @pxref{Displaying Selections}.)
+The @samp{*} next to the line number is to remind you that
the formula has a portion of it selected. (In this case, it's very
obvious, but it might not always be. If Embedded mode is enabled,
the word @samp{Sel} also appears in the mode line because the stack
@noindent
@kindex j d
@pindex calc-show-selections
+@vindex calc-highlight-selections-with-faces
+@vindex calc-selected-face
+@vindex calc-nonselected-face
The @kbd{j d} (@code{calc-show-selections}) command controls how
selected sub-formulas are displayed. One of the alternatives is
illustrated in the above examples; if we press @kbd{j d} we switch
. . . . 2 x + 1
@end group
@end smallexample
+If the customizable variable
+@code{calc-highlight-selections-with-faces} is non-nil, then the
+non-selected portion of the formula will be de-emphasized by using a
+less noticeable face (@code{calc-nonselected-face}) instead of dots
+and the selected sub-formula will be highlighted by using a more
+noticeable face (@code{calc-selected-face}) instead of @samp{#}
+signs. (@pxref{Customizing Calc}.)
@node Operating on Selections, Rearranging with Selections, Displaying Selections, Selecting Subformulas
@subsection Operating on Selections
@end example
@end ifnottex
@tex
-\turnoffactive
-\turnoffactive
\beforedisplay
$$ \pmatrix{ 1 & 2 & 3 & 4 & 5 \cr
5 & 7 & 9 & 11 & 13 }
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ \chi^2 = \sum_{i=1}^N (y_i - (a + b x_i))^2 $$
\afterdisplay
@end example
@end ifnottex
@tex
-\turnoffactive
\beforedisplay
$$ \chi^2 = \sum_{i=1}^N \left(y_i - (a + b x_i) \over \sigma_i\right)^2 $$
\afterdisplay
the stack. Thus, @kbd{' k^2 @key{RET} ' k @key{RET} 1 @key{RET} 5 @key{RET} a + @key{RET}}
produces the result 55.
@tex
-\turnoffactive
$$ \sum_{k=1}^5 k^2 = 55 $$
@end tex
@code{texcc} (a Cicero) and @code{texsp} (a scaled @TeX{} point,
all dimensions representable in @TeX{} are multiples of this value).
+When Calc is using the @TeX{} or La@TeX{} language mode (@pxref{TeX
+and LaTeX Language Modes}), the @TeX{} specific unit names will not
+use the @samp{tex} prefix; the unit name for a @TeX{} point will be
+@samp{pt} instead of @samp{texpt}, for example. To avoid conflicts,
+the unit names for pint and parsec will simply be @samp{pint} and
+@samp{parsec} instead of @samp{pt} and @samp{pc}.
+
+
The unit @code{e} stands for the elementary (electron) unit of charge;
because algebra command could mistake this for the special constant
@expr{e}, Calc provides the alternate unit name @code{ech} which is
@cindex Calc init file, user-defined units
The @kbd{u p} (@code{calc-permanent-units}) command stores the user-defined
units in your Calc init file (the file given by the variable
-@code{calc-settings-file}, typically @file{~/.calc.el}), so that the
+@code{calc-settings-file}, typically @file{~/.emacs.d/calc.el}), so that the
units will still be available in subsequent Emacs sessions. If there
was already a set of user-defined units in your Calc init file, it
is replaced by the new set. (@xref{General Mode Commands}, for a way to
@cindex Calc init file, variables
The @kbd{s p} (@code{calc-permanent-variable}) command saves a
variable's value permanently in your Calc init file (the file given by
-the variable @code{calc-settings-file}, typically @file{~/.calc.el}), so
+the variable @code{calc-settings-file}, typically @file{~/.emacs.d/calc.el}), so
that its value will still be available in future Emacs sessions. You
can re-execute @w{@kbd{s p}} later on to update the saved value, but the
only way to remove a saved variable is to edit your calc init file
which are also available outside of Embedded mode.
(@pxref{General Mode Commands}.) They are @code{Save}, in which mode
settings are recorded permanently in your Calc init file (the file given
-by the variable @code{calc-settings-file}, typically @file{~/.calc.el})
+by the variable @code{calc-settings-file}, typically @file{~/.emacs.d/calc.el})
rather than by annotating the current document, and no-recording
mode (where there is no symbol like @code{Save} or @code{Local} in
the mode line), in which mode-changing commands do not leave any
binding permanent so that it will remain in effect even in future Emacs
sessions. (It does this by adding a suitable bit of Lisp code into
your Calc init file; that is, the file given by the variable
-@code{calc-settings-file}, typically @file{~/.calc.el}.) For example,
+@code{calc-settings-file}, typically @file{~/.emacs.d/calc.el}.) For example,
@kbd{Z P s} would register our @code{sincos} command permanently. If
you later wish to unregister this command you must edit your Calc init
file by hand. (@xref{General Mode Commands}, for a way to tell Calc to
A good place to put your @code{defmath} commands is your Calc init file
(the file given by @code{calc-settings-file}, typically
-@file{~/.calc.el}), which will not be loaded until Calc starts.
+@file{~/.emacs.d/calc.el}), which will not be loaded until Calc starts.
If a file named @file{.emacs} exists in your home directory, Emacs reads
and executes the Lisp forms in this file as it starts up. While it may
seem reasonable to put your favorite @code{defmath} commands there,
Calc is controlled by many variables, most of which can be reset
from within Calc. Some variables are less involved with actual
-calculation, and can be set outside of Calc using Emacs's
+calculation and can be set outside of Calc using Emacs's
customization facilities. These variables are listed below.
Typing @kbd{M-x customize-variable RET @var{variable-name} RET}
will bring up a buffer in which the variable's value can be redefined.
@code{nil}, then Calc will automatically load your settings file (if it
exists) the first time Calc is invoked.
-The default value for this variable is @code{"~/.calc.el"}.
+The default value for this variable is @code{"~/.emacs.d/calc.el"}
+unless the file @file{~/.calc.el} exists, in which case the default
+value will be @code{"~/.calc.el"}.
@end defvar
@defvar calc-gnuplot-name
and @code{calc-embedded-open-close-plain-alist}.
@end defvar
+@defvar calc-highlight-selections-with-faces
+@defvarx calc-selected-face
+@defvarx calc-nonselected-face
+See @ref{Displaying Selections}.@*
+The variable @code{calc-highlight-selections-with-faces}
+determines how selected sub-formulas are distinguished.
+If @code{calc-highlight-selections-with-faces} is nil, then
+a selected sub-formula is distinguished either by changing every
+character not part of the sub-formula with a dot or by changing every
+character in the sub-formula with a @samp{#} sign.
+If @code{calc-highlight-selections-with-faces} is t,
+then a selected sub-formula is distinguished either by displaying the
+non-selected portion of the formula with @code{calc-nonselected-face}
+or by displaying the selected sub-formula with
+@code{calc-nonselected-face}.
+@end defvar
+
@defvar calc-multiplication-has-precedence
The variable @code{calc-multiplication-has-precedence} determines
whether multiplication has precedence over division in algebraic
@r{ @: M @: @: @:calc-more-recursion-depth@:}
@r{ @: I M @: @: @:calc-less-recursion-depth@:}
@r{ a@: N @: @: 5 @:evalvn@:(a)}
+@r{ @: O @:command @: 32 @:@:Option}
@r{ @: P @: @: @:@:pi}
@r{ @: I P @: @: @:@:gamma}
@r{ @: H P @: @: @:@:e}
@bye
-
-@ignore
- arch-tag: 77a71809-fa4d-40be-b2cc-da3e8fb137c0
-@end ignore