@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.1.
+This file documents Calc, the GNU Emacs calculator, included with
+GNU Emacs @value{EMACSVER}.
@end ifnotinfo
-Copyright @copyright{} 1990, 1991, 2001, 2002, 2003, 2004,
-2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright @copyright{} 1990-1991, 2001-2011 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being just ``GNU GENERAL PUBLIC LICENSE'', with the
Front-Cover texts being ``A GNU Manual,'' and with the Back-Cover
@end quotation
@end copying
-@dircategory Emacs
+@dircategory Emacs misc features
@direntry
-* Calc: (calc). Advanced desk calculator and mathematical tool.
+* Calc: (calc). Advanced desk calculator and mathematical tool.
@end direntry
@titlepage
@page
@vskip 0pt plus 1filll
-Copyright @copyright{} 1990, 1991, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
@insertcopying
@end titlepage
longer Info tutorial.)
@end ifinfo
+@insertcopying
+
@menu
* Getting Started:: General description and overview.
@ifinfo
@noindent
This document serves as a complete description of the GNU Emacs
-Calculator. It works both as an introduction for novices, and as
+Calculator. It works both as an introduction for novices and as
a reference for experienced users. While it helps to have some
experience with GNU Emacs in order to get the most out of Calc,
this manual ought to be readable even if you don't know or use Emacs
regularly.
-The manual is divided into three major parts:@: the ``Getting
-Started'' chapter you are reading now, the Calc tutorial (chapter 2),
-and the Calc reference manual (the remaining chapters and appendices).
+This manual is divided into three major parts:@: the ``Getting
+Started'' chapter you are reading now, the Calc tutorial, and the Calc
+reference manual.
@c [when-split]
@c This manual has been printed in two volumes, the @dfn{Tutorial} and the
@c @dfn{Reference}. Both volumes include a copy of the ``Getting Started''
Index to find the parts of the manual that discuss the things you
need to know.
-@cindex Marginal notes
+@c @cindex Marginal notes
Every Calc keyboard command is listed in the Calc Summary, and also
in the Key Index. Algebraic functions, @kbd{M-x} commands, and
variables also have their own indices.
-@texline Each
-@infoline In the printed manual, each
-paragraph that is referenced in the Key or Function Index is marked
-in the margin with its index entry.
+@c @texline Each
+@c @infoline In the printed manual, each
+@c paragraph that is referenced in the Key or Function Index is marked
+@c in the margin with its index entry.
@c [fix-ref Help Commands]
-You can access this manual on-line at any time within Calc by
-pressing the @kbd{h i} key sequence. Outside of the Calc window,
-you can press @kbd{C-x * i} to read the manual on-line. Also, you
-can jump directly to the Tutorial by pressing @kbd{h t} or @kbd{C-x * t},
-or to the Summary by pressing @kbd{h s} or @kbd{C-x * s}. Within Calc,
-you can also go to the part of the manual describing any Calc key,
-function, or variable using @w{@kbd{h k}}, @kbd{h f}, or @kbd{h v},
-respectively. @xref{Help Commands}.
+You can access this manual on-line at any time within Calc by pressing
+the @kbd{h i} key sequence. Outside of the Calc window, you can press
+@kbd{C-x * i} to read the manual on-line. From within Calc the command
+@kbd{h t} will jump directly to the Tutorial; from outside of Calc the
+command @kbd{C-x * t} will jump to the Tutorial and start Calc if
+necessary. Pressing @kbd{h s} or @kbd{C-x * s} will take you directly
+to the Calc Summary. Within Calc, you can also go to the part of the
+manual describing any Calc key, function, or variable using
+@w{@kbd{h k}}, @kbd{h f}, or @kbd{h v}, respectively. @xref{Help Commands}.
@ifnottex
The Calc manual can be printed, but because the manual is so large, you
or equations involving variables. Type @kbd{@w{' [x + y} = a, x y = 1] @key{RET}}
to enter a pair of equations involving three variables.
(Note the leading apostrophe in this example; also, note that the space
-between @samp{x y} is required.) Type @w{@kbd{a S x,y @key{RET}}} to solve
+in @samp{x y} is required.) Type @w{@kbd{a S x,y @key{RET}}} to solve
these equations for the variables @expr{x} and @expr{y}.
@noindent
@noindent
Type @kbd{7.5}, then @kbd{s l a @key{RET}} to let @expr{a = 7.5} in these formulas.
-(That's a letter @kbd{l}, not a numeral @kbd{1}.)
+(That's the letter @kbd{l}, not the numeral @kbd{1}.)
@ifnotinfo
@strong{Help functions.} You can read about any command in the on-line
Finally, @kbd{C-x * o} (@code{calc-other-window}) is like @kbd{C-x * c}
except that the Calc window is not selected. The buffer you were
-editing before remains selected instead. @kbd{C-x * o} is a handy
-way to switch out of Calc momentarily to edit your file; type
-@kbd{C-x * c} to switch back into Calc when you are done.
+editing before remains selected instead. If you are in a Calc window,
+then @kbd{C-x * o} will switch you out of it, being careful not to
+switch you to the Calc Trail window. So @kbd{C-x * o} is a handy
+way to switch out of Calc momentarily to edit your file; you can then
+type @kbd{C-x * c} to switch back into Calc when you are done.
@node Quick Mode Overview, Keypad Mode Overview, The Standard Interface, Using Calc
@subsection Quick Mode (Overview)
and you wish to have Calc compute and format the derivative for
you and store this derivative in the buffer automatically. To
do this with Embedded mode, first copy the formula down to where
-you want the result to be:
+you want the result to be, leaving a blank line before and after the
+formula:
@smallexample
@group
@end smallexample
Now, move the cursor onto this new formula and press @kbd{C-x * e}.
-Calc will read the formula (using the surrounding blank lines to
-tell how much text to read), then push this formula (invisibly)
-onto the Calc stack. The cursor will stay on the formula in the
-editing buffer, but the buffer's mode line will change to look
-like the Calc mode line (with mode indicators like @samp{12 Deg}
-and so on). Even though you are still in your editing buffer,
-the keyboard now acts like the Calc keyboard, and any new result
-you get is copied from the stack back into the buffer. To take
-the derivative, you would type @kbd{a d x @key{RET}}.
+Calc will read the formula (using the surrounding blank lines to tell
+how much text to read), then push this formula (invisibly) onto the Calc
+stack. The cursor will stay on the formula in the editing buffer, but
+the line with the formula will now appear as it would on the Calc stack
+(in this case, it will be left-aligned) and the buffer's mode line will
+change to look like the Calc mode line (with mode indicators like
+@samp{12 Deg} and so on). Even though you are still in your editing
+buffer, the keyboard now acts like the Calc keyboard, and any new result
+you get is copied from the stack back into the buffer. To take the
+derivative, you would type @kbd{a d x @key{RET}}.
@smallexample
@group
@end group
@end smallexample
+(Note that by default, Calc gives division lower precedence than multiplication,
+so that @samp{1 / ln(x) x} is equivalent to @samp{1 / (ln(x) x)}.)
+
To make this look nicer, you might want to press @kbd{d =} to center
the formula, and even @kbd{d B} to use Big display mode.
and keyboard will revert to the way they were before.
The related command @kbd{C-x * w} operates on a single word, which
-generally means a single number, inside text. It uses any
-non-numeric characters rather than blank lines to delimit the
-formula it reads. Here's an example of its use:
+generally means a single number, inside text. It searches for an
+expression which ``looks'' like a number containing the point.
+Here's an example of its use:
@smallexample
A slope of one-third corresponds to an angle of 1 degrees.
You can press @kbd{?} at any time for a brief summary of Info commands.
-Press @kbd{1} now to enter the first section of the Tutorial.
+Press the number @kbd{1} now to enter the first section of the Tutorial.
@menu
* Tutorial::
the Embedded mode interface.
The easiest way to read this tutorial on-line is to have two windows on
-your Emacs screen, one with Calc and one with the Info system. (If you
-have a printed copy of the manual you can use that instead.) Press
-@kbd{C-x * c} to turn Calc on or to switch into the Calc window, and
-press @kbd{C-x * i} to start the Info system or to switch into its window.
+your Emacs screen, one with Calc and one with the Info system. Press
+@kbd{C-x * t} to set this up; the on-line tutorial will be opened in the
+current window and Calc will be started in another window. From the
+Info window, the command @kbd{C-x * c} can be used to switch to the Calc
+window and @kbd{C-x * o} can be used to switch back to the Info window.
+(If you have a printed copy of the manual you can use that instead; in
+that case you only need to press @kbd{C-x * c} to start Calc.)
This tutorial is designed to be done in sequence. But the rest of this
manual does not assume you have gone through the tutorial. The tutorial
non-RPN calculators work. In Algebraic mode, you enter formulas
in traditional @expr{2+3} notation.
-@strong{Warning:} Note that @samp{/} has lower precedence than
-@samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}. See
-below for details.
+@strong{Notice:} Calc gives @samp{/} lower precedence than @samp{*}, so
+that @samp{a/b*c} is interpreted as @samp{a/(b*c)}; this is not
+standard across all computer languages. See below for details.
You don't really need any special ``mode'' to enter algebraic formulas.
You can enter a formula at any time by pressing the apostrophe (@kbd{'})
@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)) $$
@smallexample
@group
-1: 1 / cos(x) - sin(x) tan(x)
+1: 2 / cos(x)^2 - 2 tan(x)^2
.
- ' 1/cos(x) - sin(x) tan(x) @key{RET} s 1
+ ' 2/cos(x)^2 - 2tan(x)^2 @key{RET} s 1
@end group
@end smallexample
@noindent
If we were simplifying this by hand, we'd probably replace the
@samp{tan} with a @samp{sin/cos} first, then combine over a common
-denominator. There is no Calc command to do the former; the @kbd{a n}
-algebra command will do the latter but we'll do both with rewrite
+denominator. The @kbd{I a s} command will do the former and the @kbd{a n}
+algebra command will do the latter, but we'll do both with rewrite
rules just for practice.
Rewrite rules are written with the @samp{:=} symbol.
@smallexample
@group
-1: 1 / cos(x) - sin(x)^2 / cos(x)
+1: 2 / cos(x)^2 - 2 sin(x)^2 / cos(x)^2
.
a r tan(a) := sin(a)/cos(a) @key{RET}
@smallexample
@group
-1: (1 - sin(x)^2) / cos(x)
+1: (2 - 2 sin(x)^2) / cos(x)^2
.
a r a/x + b/x := (a+b)/x @key{RET}
Second, meta-variable names are independent from variables in the
target formula. Notice that the meta-variable @samp{x} here matches
-the subformula @samp{cos(x)}; Calc never confuses the two meanings of
+the subformula @samp{cos(x)^2}; Calc never confuses the two meanings of
@samp{x}.
And third, rewrite patterns know a little bit about the algebraic
properties of formulas. The pattern called for a sum of two quotients;
Calc was able to match a difference of two quotients by matching
-@samp{a = 1}, @samp{b = -sin(x)^2}, and @samp{x = cos(x)}.
+@samp{a = 2}, @samp{b = -2 sin(x)^2}, and @samp{x = cos(x)^2}.
@c [fix-ref Algebraic Properties of Rewrite Rules]
We could just as easily have written @samp{a/x - b/x := (a-b)/x} for
One more rewrite will complete the job. We want to use the identity
@samp{sin(x)^2 + cos(x)^2 = 1}, but of course we must first rearrange
the identity in a way that matches our formula. The obvious rule
-would be @samp{@w{1 - sin(x)^2} := cos(x)^2}, but a little thought shows
+would be @samp{@w{2 - 2 sin(x)^2} := 2 cos(x)^2}, but a little thought shows
that the rule @samp{sin(x)^2 := 1 - cos(x)^2} will also work. The
latter rule has a more general pattern so it will work in many other
situations, too.
@smallexample
@group
-1: (1 + cos(x)^2 - 1) / cos(x) 1: cos(x)
- . .
+1: (2 + 2 cos(x)^2 - 2) / cos(x)^2 1: 2
+ . .
a r sin(x)^2 := 1 - cos(x)^2 @key{RET} a s
@end group
' a/x + b/x := (a+b)/x @key{RET} s t merge @key{RET}
' sin(x)^2 := 1 - cos(x)^2 @key{RET} s t sinsqr @key{RET}
-1: 1 / cos(x) - sin(x) tan(x) 1: cos(x)
+1: 2 / cos(x)^2 - 2 tan(x)^2 1: 2
. .
r 1 a r tsc @key{RET} a r merge @key{RET} a r sinsqr @key{RET} a s
@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
@samp{exp(inf) = inf}. It's tempting to say that the exponential
of infinity must be ``bigger'' than ``regular'' infinity, but as
-far as Calc is concerned all infinities are as just as big.
+far as Calc is concerned all infinities are the same size.
In other words, as @expr{x} goes to infinity, @expr{e^x} also goes
to infinity, but the fact the @expr{e^x} grows much faster than
@expr{x} is not relevant here.
@noindent
@cindex Help commands
@kindex ?
+@kindex a ?
+@kindex b ?
+@kindex c ?
+@kindex d ?
+@kindex f ?
+@kindex g ?
+@kindex j ?
+@kindex k ?
+@kindex m ?
+@kindex r ?
+@kindex s ?
+@kindex t ?
+@kindex u ?
+@kindex v ?
+@kindex V ?
+@kindex z ?
+@kindex Z ?
@pindex calc-help
The @kbd{?} key (@code{calc-help}) displays a series of brief help messages.
Some keys (such as @kbd{b} and @kbd{d}) are prefix keys, like Emacs'
queried whether or not to restore the variable to its original value.
The @kbd{U} key may be pressed any number of times to undo successively
farther back in time; with a numeric prefix argument it undoes a
-specified number of operations. The undo history is cleared only by the
-@kbd{q} (@code{calc-quit}) command. (Recall that @kbd{C-x * c} is
-synonymous with @code{calc-quit} while inside the Calculator; this
-also clears the undo history.)
+specified number of operations. When the Calculator is quit, as with
+the @kbd{q} (@code{calc-quit}) command, the undo history will be
+truncated to the length of the customizable variable
+@code{calc-undo-length} (@pxref{Customizing Calc}), which by default
+is @expr{100}. (Recall that @kbd{C-x * c} is synonymous with
+@code{calc-quit} while inside the Calculator; this also truncates the
+undo history.)
Currently the mode-setting commands (like @code{calc-precision}) are not
undoable. You can undo past a point where you changed a mode, but you
@cindex Julian day counting
Another day counting system in common use is, confusingly, also called
-``Julian.'' The Julian day number is the numbers of days since
-12:00 noon (GMT) on Jan 1, 4713 BC, which in Calc's scheme (in GMT)
+``Julian.'' The Julian day number is the numbers of days since
+12:00 noon (GMT) on Jan 1, 4713 BC, which in Calc's scheme (in GMT)
is @mathit{-1721423.5} (recall that Calc starts at midnight instead
of noon). Thus to convert a Calc date code obtained by unpacking a
date form into a Julian day number, simply add 1721423.5 after
compensating for the time zone difference. The built-in @kbd{t J}
command performs this conversion for you.
-The Julian day number is based on the Julian cycle, which was invented
+The Julian day number is based on the Julian cycle, which was invented
in 1583 by Joseph Justus Scaliger. Scaliger named it the Julian cycle
-since it is involves the Julian calendar, but some have suggested that
+since it involves the Julian calendar, but some have suggested that
Scaliger named it in honor of his father, Julius Caesar Scaliger. The
-Julian cycle is based it on three other cycles: the indiction cycle,
-the Metonic cycle, and the solar cycle. The indiction cycle is a 15
-year cycle originally used by the Romans for tax purposes but later
-used to date medieval documents. The Metonic cycle is a 19 year
-cycle; 19 years is close to being a common multiple of a solar year
-and a lunar month, and so every 19 years the phases of the moon will
-occur on the same days of the year. The solar cycle is a 28 year
-cycle; the Julian calendar repeats itself every 28 years. The
-smallest time period which contains multiples of all three cycles is
-the least common multiple of 15 years, 19 years and 28 years, which
-(since they're pairwise relatively prime) is
+Julian cycle is based on three other cycles: the indiction cycle, the
+Metonic cycle, and the solar cycle. The indiction cycle is a 15 year
+cycle originally used by the Romans for tax purposes but later used to
+date medieval documents. The Metonic cycle is a 19 year cycle; 19
+years is close to being a common multiple of a solar year and a lunar
+month, and so every 19 years the phases of the moon will occur on the
+same days of the year. The solar cycle is a 28 year cycle; the Julian
+calendar repeats itself every 28 years. The smallest time period
+which contains multiples of all three cycles is the least common
+multiple of 15 years, 19 years and 28 years, which (since they're
+pairwise relatively prime) is
@texline @math{15\times 19\times 28 = 7980} years.
@infoline 15*19*28 = 7980 years.
This is the length of a Julian cycle. Working backwards, the previous
With a negative argument @mathit{-@var{n}}, @key{TAB} rotates the stack
to move the object in level @var{n} to the deepest place in the
stack, and the object in level @mathit{@var{n}+1} to the top. @kbd{M-@key{TAB}}
-rotates the deepest stack element to be in level @mathit{n}, also
+rotates the deepest stack element to be in level @var{n}, also
putting the top stack element in level @mathit{@var{n}+1}.
@xref{Selecting Subformulas}, for a way to apply these commands to
any portion of a vector or formula on the stack.
+@kindex C-xC-t
+@pindex calc-transpose-lines
+@cindex Moving stack entries
+The command @kbd{C-x C-t} (@code{calc-transpose-lines}) will transpose
+the stack object determined by the point with the stack object at the
+next higher level. For example, with @samp{10 20 30 40 50} on the
+stack and the point on the line containing @samp{30}, @kbd{C-x C-t}
+creates @samp{10 20 40 30 50}. More generally, @kbd{C-x C-t} acts on
+the stack objects determined by the current point (and mark) similar
+to how the text-mode command @code{transpose-lines} acts on
+lines. With argument @var{n}, @kbd{C-x C-t} will move the stack object
+at the level above the current point and move it past N other objects;
+for example, with @samp{10 20 30 40 50} on the stack and the point on
+the line containing @samp{30}, @kbd{C-u 2 C-x C-t} creates
+@samp{10 40 20 30 50}. With an argument of 0, @kbd{C-x C-t} will switch
+the stack objects at the levels determined by the point and the mark.
+
@node Editing Stack Entries, Trail Commands, Stack Manipulation, Stack and Trail
@section Editing Stack Entries
@cindex Saving mode settings
@cindex Permanent mode settings
@cindex Calc init file, mode settings
-You can save all of the current mode settings in your Calc init file
+You can save all of the current mode settings in your Calc init file
(the file given by the variable @code{calc-settings-file}, typically
-@file{~/.calc.el}) with the @kbd{m m} (@code{calc-save-modes}) command.
-This will cause Emacs to reestablish these modes each time it starts up.
-The modes saved in the file include everything controlled by the @kbd{m}
-and @kbd{d} prefix keys, the current precision and binary word size,
-whether or not the trail is displayed, the current height of the Calc
-window, and more. The current interface (used when you type @kbd{C-x * *})
-is also saved. If there were already saved mode settings in the
-file, they are replaced. Otherwise, the new mode information is
-appended to the end of the file.
+@file{~/.emacs.d/calc.el}) with the @kbd{m m} (@code{calc-save-modes})
+command. This will cause Emacs to reestablish these modes each time
+it starts up. The modes saved in the file include everything
+controlled by the @kbd{m} and @kbd{d} prefix keys, the current
+precision and binary word size, whether or not the trail is displayed,
+the current height of the Calc window, and more. The current
+interface (used when you type @kbd{C-x * *}) is also saved. If there
+were already saved mode settings in the file, they are replaced.
+Otherwise, the new mode information is appended to the end of the
+file.
@kindex m R
@pindex calc-mode-record-mode
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
in the current radix. (Larger integers will still be displayed in their
entirety.)
+@cindex Two's complements
+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{2^{w-1}-1}
+@infoline @expr{2^(w-1)-1}
+are represented by the integers from @expr{0} to @expr{2^w-1}:
+the integers from @expr{0} to
+@texline @math{2^{w-1}-1}
+@infoline @expr{2^(w-1)-1}
+are represented by themselves and the integers from
+@texline @math{-2^{w-1}}
+@infoline @expr{-2^(w-1)}
+to @expr{-1} are represented by the integers from
+@texline @math{2^{w-1}}
+@infoline @expr{2^(w-1)}
+to @expr{2^w-1} (the integer @expr{k} is represented by @expr{k+2^w}).
+Calc will display a two's complement integer by the radix (either
+@expr{2}, @expr{8} or @expr{16}), two @kbd{#} symbols, and then its
+representation (including any leading zeros necessary to include all
+@expr{w} bits). In a two's complement display mode, numbers that
+are not displayed in two's complement notation (i.e., that aren't
+integers from
+@texline @math{-2^{w-1}}
+@infoline @expr{-2^(w-1)}
+to
+@c (
+@texline @math{2^{w-1}-1})
+@infoline @expr{2^(w-1)-1})
+will be represented using Calc's usual notation (in the appropriate
+radix).
+
@node Grouping Digits, Float Formats, Radix Modes, Display Modes
@subsection Grouping Digits
@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
a built-in Calc function. The following table shows the accents
in Calc, @TeX{}, La@TeX{} and @dfn{eqn} (described in the next section):
+@ignore
@iftex
@begingroup
@let@calcindexershow=@calcindexernoshow @c Suppress marginal notes
@let@calcindexersh=@calcindexernoshow
@end iftex
-@ignore
@starindex
@end ignore
@tindex acute
@starindex
@end ignore
@tindex VEC
+@ignore
@iftex
@endgroup
@end iftex
+@end ignore
@example
Calc TeX LaTeX eqn
---- --- ----- ---
@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}).
@mindex v p
@end ignore
@kindex v p (complex)
+@kindex V p (complex)
@pindex calc-pack
The @kbd{v p} (@code{calc-pack}) command can pack the top two numbers on
the stack into a composite object such as a complex number. With
@mindex v u
@end ignore
@kindex v u (complex)
+@kindex V u (complex)
@pindex calc-unpack
The @kbd{v u} (@code{calc-unpack}) command takes the complex number
(or other composite object) on the top of the stack and unpacks it
@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 $$
particular, negative arguments are converted to positive integers modulo
@expr{2^w} by all binary functions.
-If the word size is negative, binary operations produce 2's complement
+If the word size is negative, binary operations produce twos-complement
integers from
@texline @math{-2^{-w-1}}
@infoline @expr{-(2^(-w-1))}
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.
vectors.
@kindex v p
+@kindex V p
@pindex calc-pack
The @kbd{v p} (@code{calc-pack}) [@code{pack}] command collects several
elements from the stack into a matrix, complex number, HMS form, error
by the mode.
@kindex v u
+@kindex V u
@pindex calc-unpack
The @kbd{v u} (@code{calc-unpack}) command takes the vector, complex
number, HMS form, or other composite object on the top of the stack and
to @kbd{@key{TAB} |}, but possibly more convenient and also a bit faster.
@kindex v d
+@kindex V d
@pindex calc-diag
@tindex diag
The @kbd{v d} (@code{calc-diag}) [@code{diag}] function builds a diagonal
alternative would be to use @kbd{v b} and @kbd{v a}; see below.)
@kindex v i
+@kindex V i
@pindex calc-ident
@tindex idn
The @kbd{v i} (@code{calc-ident}) [@code{idn}] function builds an identity
dimensions.
@kindex v x
+@kindex V x
@pindex calc-index
@tindex index
The @kbd{v x} (@code{calc-index}) [@code{index}] function builds a vector
is one for positive @var{n} or two for negative @var{n}.
@kindex v b
+@kindex V b
@pindex calc-build-vector
@tindex cvec
The @kbd{v b} (@code{calc-build-vector}) [@code{cvec}] function builds a
to build a matrix of copies of that row.)
@kindex v h
+@kindex V h
@kindex I v h
+@kindex I V h
@pindex calc-head
@pindex calc-tail
@tindex head
cases, the argument must be a non-empty vector.
@kindex v k
+@kindex V k
@pindex calc-cons
@tindex cons
The @kbd{v k} (@code{calc-cons}) [@code{cons}] function takes a value @var{h}
whereas @code{cons} will insert @var{h} at the front of the vector @var{t}.
@kindex H v h
+@kindex H V h
@tindex rhead
@ignore
@mindex @idots
@end ignore
@kindex H I v h
+@kindex H I V h
@ignore
@mindex @null
@end ignore
@kindex H v k
+@kindex H V k
@ignore
@mindex @null
@end ignore
@noindent
@kindex v r
+@kindex V r
@pindex calc-mrow
@tindex mrow
The @kbd{v r} (@code{calc-mrow}) [@code{mrow}] command extracts one row of
function is called @code{getdiag}.
@kindex v c
+@kindex V c
@pindex calc-mcol
@tindex mcol
@tindex mrcol
of matrix @expr{m}.
@kindex v s
+@kindex V s
@pindex calc-subvector
@tindex subvec
The @kbd{v s} (@code{calc-subvector}) [@code{subvec}] command extracts
has this effect when used as the ending index.
@kindex I v s
+@kindex I V s
@tindex rsubvec
With the Inverse flag, @kbd{I v s} [@code{rsubvec}] removes a subvector
from a vector. The arguments are interpreted the same as for the
@noindent
@kindex v l
+@kindex V l
@pindex calc-vlength
@tindex vlen
The @kbd{v l} (@code{calc-vlength}) [@code{vlen}] command computes the
command.
@kindex H v l
+@kindex H V l
@tindex mdims
With the Hyperbolic flag, @kbd{H v l} [@code{mdims}] computes a vector
of the dimensions of a vector, matrix, or higher-order object. For
matrix.
@kindex v f
+@kindex V f
@pindex calc-vector-find
@tindex find
The @kbd{v f} (@code{calc-vector-find}) [@code{find}] command searches
allows you to select any starting index for the search.
@kindex v a
+@kindex V a
@pindex calc-arrange-vector
@tindex arrange
@cindex Arranging a matrix
@samp{[1, 2, @w{3, 4}]}.
@cindex Sorting data
+@kindex v S
@kindex V S
+@kindex I v S
@kindex I V S
@pindex calc-sort
@tindex sort
@cindex Inverse of permutation
@cindex Index tables
@cindex Rank tables
+@kindex v G
@kindex V G
+@kindex I v G
@kindex I V G
@pindex calc-grade
@tindex grade
phone numbers will remain sorted by name even after the second sort.
@cindex Histograms
+@kindex v H
@kindex V H
@pindex calc-histogram
@ignore
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.
The second-to-top vector is the list of numbers as before. The top
vector. Without the hyperbolic flag, every element has a weight of one.
@kindex v t
+@kindex V t
@pindex calc-transpose
@tindex trn
The @kbd{v t} (@code{calc-transpose}) [@code{trn}] command computes
a one-column matrix.
@kindex v v
+@kindex V v
@pindex calc-reverse-vector
@tindex rev
The @kbd{v v} (@code{calc-reverse-vector}) [@code{rev}] command reverses
a matrix.)
@kindex v m
+@kindex V m
@pindex calc-mask-vector
@tindex vmask
The @kbd{v m} (@code{calc-mask-vector}) [@code{vmask}] command uses
@xref{Logical Operations}.
@kindex v e
+@kindex V e
@pindex calc-expand-vector
@tindex vexp
The @kbd{v e} (@code{calc-expand-vector}) [@code{vexp}] command
produces @samp{[a, 0, b, 0, 7]}.
@kindex H v e
+@kindex H V e
With the Hyperbolic flag, @kbd{H v e} takes a filler value from the
top of the stack; the mask and target vectors come from the third and
second elements of the stack. This filler is used where the mask is
@code{re}, @code{im}, @code{polar}, @code{rect}, @code{clean},
@code{float}, @code{frac}. @xref{Function Index}.
+@kindex v J
@kindex V J
@pindex calc-conj-transpose
@tindex ctrn
from that point to the origin.
@kindex v n
+@kindex V n
@pindex calc-rnorm
@tindex rnorm
The @kbd{v n} (@code{calc-rnorm}) [@code{rnorm}] command computes the
a matrix, this is the maximum of the row-absolute-value-sums, i.e., of
the sums of the absolute values of the elements along the various rows.
+@kindex v N
@kindex V N
@pindex calc-cnorm
@tindex cnorm
not provided. However, the 2-norm (or Frobenius norm) is provided for
vectors by the @kbd{A} (@code{calc-abs}) command.
+@kindex v C
@kindex V C
@pindex calc-cross
@tindex cross
@samp{/} operator also does a matrix inversion when dividing one
by a matrix.
+@kindex v D
@kindex V D
@pindex calc-mdet
@tindex det
The @kbd{V D} (@code{calc-mdet}) [@code{det}] command computes the
determinant of a square matrix.
+@kindex v L
@kindex V L
@pindex calc-mlud
@tindex lud
algorithm, the second is lower-triangular with ones on the diagonal,
and the third is upper-triangular.
+@kindex v T
@kindex V T
@pindex calc-mtrace
@tindex tr
trace of a square matrix. This is defined as the sum of the diagonal
elements of the matrix.
+@kindex v K
@kindex V K
@pindex calc-kron
@tindex kron
a certain value is a member of a given set. To test if the set @expr{A}
is a subset of the set @expr{B}, use @samp{vdiff(A, B) = []}.
+@kindex v +
@kindex V +
@pindex calc-remove-duplicates
@tindex rdup
other set-based commands apply @kbd{V +} to their inputs before using
them.
+@kindex v V
@kindex V V
@pindex calc-set-union
@tindex vunion
accomplish the same thing by concatenating the sets with @kbd{|},
then using @kbd{V +}.)
+@kindex v ^
@kindex V ^
@pindex calc-set-intersect
@tindex vint
@texline intersection@tie{}(@math{A \cap B}).
@infoline intersection.
+@kindex v -
@kindex V -
@pindex calc-set-difference
@tindex vdiff
your problem is small enough to list in a Calc vector (or simple
enough to express in a few intervals).
+@kindex v X
@kindex V X
@pindex calc-set-xor
@tindex vxor
if it is in one, but @emph{not} both, of the sets. Objects that
occur in both sets ``cancel out.''
+@kindex v ~
@kindex V ~
@pindex calc-set-complement
@tindex vcompl
For example, @samp{vcompl([2, (3 .. 4]])} evaluates to
@samp{[[-inf .. 2), (2 .. 3], (4 .. inf]]}.
+@kindex v F
@kindex V F
@pindex calc-set-floor
@tindex vfloor
the complement with respect to the set of integers you could type
@kbd{V ~ V F} to get @samp{[[-inf .. 1], [3 .. 5], [9 .. inf]]}.
+@kindex v E
@kindex V E
@pindex calc-set-enumerate
@tindex venum
the intervals. This only works for finite sets (i.e., sets which
do not involve @samp{-inf} or @samp{inf}).
+@kindex v :
@kindex V :
@pindex calc-set-span
@tindex vspan
limit will be the largest element. For an empty set, @samp{vspan([])}
returns the empty interval @w{@samp{[0 .. 0)}}.
+@kindex v #
@kindex V #
@pindex calc-set-cardinality
@tindex vcard
@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
The commands in this section allow for more general operations on the
elements of vectors.
+@kindex v A
@kindex V A
@pindex calc-apply
@tindex apply
@subsection Mapping
@noindent
+@kindex v M
@kindex V M
@pindex calc-map
@tindex map
@subsection Reducing
@noindent
+@kindex v R
@kindex V R
@pindex calc-reduce
@tindex reduce
and so on. In general, reducing @code{f} over the vector @samp{[a, b, c, d]}
produces @samp{f(f(f(a, b), c), d)}.
+@kindex I v R
@kindex I V R
@tindex rreduce
The @kbd{I V R} [@code{rreduce}] command is similar to @kbd{V R} except
or @samp{a - b + c - d}. This ``alternating sum'' occurs frequently
in power series expansions.
+@kindex v U
@kindex V U
@tindex accum
The @kbd{V U} (@code{calc-accumulate}) [@code{accum}] command does an
the vector @samp{[a, b, c, d]} produces the vector
@samp{[a, a + b, a + b + c, a + b + c + d]}.
+@kindex I v U
@kindex I V U
@tindex raccum
The @kbd{I V U} [@code{raccum}] command does a right-to-left accumulation.
@subsection Nesting and Fixed Points
@noindent
+@kindex H v R
@kindex H V R
@tindex nest
The @kbd{H V R} [@code{nest}] command applies a function to a given
negative if Calc knows an inverse for the function @samp{f}; for
example, @samp{nest(sin, a, -2)} returns @samp{arcsin(arcsin(a))}.
+@kindex H v U
@kindex H V U
@tindex anest
The @kbd{H V U} [@code{anest}] command is an accumulating version of
@samp{F} is the inverse of @samp{f}, then the result is of the
form @samp{[a, F(a), F(F(a)), F(F(F(a)))]}.
+@kindex H I v R
@kindex H I V R
@tindex fixp
@cindex Fixed points
applied until it reaches a ``fixed point,'' i.e., until the result
no longer changes.
+@kindex H I v U
@kindex H I V U
@tindex afixp
The @kbd{H I V U} [@code{afixp}] command is an accumulating @code{fixp}.
@node Generalized Products, , Nesting and Fixed Points, Reducing and Mapping
@subsection Generalized Products
+@kindex v O
@kindex V O
@pindex calc-outer-product
@tindex outer
the result matrix is obtained by applying the operator to element @var{r}
of the lefthand vector and element @var{c} of the righthand vector.
+@kindex v I
@kindex V I
@pindex calc-inner-product
@tindex inner
influenced by the @kbd{d O} (@code{calc-flat-language}) mode;
@pxref{Normal Language Modes}.
+@kindex v <
@kindex V <
@pindex calc-matrix-left-justify
+@kindex v =
@kindex V =
@pindex calc-matrix-center-justify
+@kindex v >
@kindex V >
@pindex calc-matrix-right-justify
The commands @kbd{v <} (@code{calc-matrix-left-justify}), @kbd{v >}
(@code{calc-matrix-center-justify}) control whether matrix elements
are justified to the left, right, or center of their columns.
+@kindex v [
@kindex V [
@pindex calc-vector-brackets
+@kindex v @{
@kindex V @{
@pindex calc-vector-braces
+@kindex v (
@kindex V (
@pindex calc-vector-parens
The @kbd{v [} (@code{calc-vector-brackets}) command turns the square
and parentheses may never be used for this purpose.
@kindex V ]
+@kindex v ]
+@kindex V )
+@kindex v )
+@kindex V @}
+@kindex v @}
@pindex calc-matrix-brackets
The @kbd{v ]} (@code{calc-matrix-brackets}) command controls the
-``big'' style display of matrices. It prompts for a string of code
-letters; currently implemented letters are @code{R}, which enables
-brackets on each row of the matrix; @code{O}, which enables outer
-brackets in opposite corners of the matrix; and @code{C}, which
-enables commas or semicolons at the ends of all rows but the last.
-The default format is @samp{RO}. (Before Calc 2.00, the format
-was fixed at @samp{ROC}.) Here are some example matrices:
+``big'' style display of matrices, for matrices which have more than
+one row. It prompts for a string of code letters; currently
+implemented letters are @code{R}, which enables brackets on each row
+of the matrix; @code{O}, which enables outer brackets in opposite
+corners of the matrix; and @code{C}, which enables commas or
+semicolons at the ends of all rows but the last. The default format
+is @samp{RO}. (Before Calc 2.00, the format was fixed at @samp{ROC}.)
+Here are some example matrices:
@example
@group
@samp{OC} are all recognized as matrices during reading, while
the others are useful for display only.
+@kindex v ,
@kindex V ,
@pindex calc-vector-commas
The @kbd{v ,} (@code{calc-vector-commas}) command turns commas on and
ambiguity) by adding the letter @code{P} to the control string you
give to @kbd{v ]} (as described above).
+@kindex v .
@kindex V .
@pindex calc-full-vectors
The @kbd{v .} (@code{calc-full-vectors}) command turns abbreviated
large vectors, this mode will improve the speed of all operations
that involve the trail.
+@kindex v /
@kindex V /
@pindex calc-break-vectors
The @kbd{v /} (@code{calc-break-vectors}) command turns multi-line
@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
selected quotient or equation by that formula. It simplifies each
side with @kbd{a s} (@code{calc-simplify}) before re-forming the
quotient or equation. You can suppress this simplification by
-providing any numeric prefix argument. There is also a @kbd{j /}
+providing a prefix argument: @kbd{C-u j *}. There is also a @kbd{j /}
(@code{calc-sel-div-both-sides}) which is similar to @kbd{j *} but
dividing instead of multiplying by the factor you enter.
-As a special feature, if the numerator of the quotient is 1, then
-the denominator is expanded at the top level using the distributive
-law (i.e., using the @kbd{C-u -1 a x} command). Suppose the
-formula on the stack is @samp{1 / (sqrt(a) + 1)}, and you wish
-to eliminate the square root in the denominator by multiplying both
-sides by @samp{sqrt(a) - 1}. Calc's default simplifications would
-change the result @samp{(sqrt(a) - 1) / (sqrt(a) - 1) (sqrt(a) + 1)}
-right back to the original form by cancellation; Calc expands the
-denominator to @samp{sqrt(a) (sqrt(a) - 1) + sqrt(a) - 1} to prevent
-this. (You would now want to use an @kbd{a x} command to expand
-the rest of the way, whereupon the denominator would cancel out to
-the desired form, @samp{a - 1}.) When the numerator is not 1, this
-initial expansion is not necessary because Calc's default
-simplifications will not notice the potential cancellation.
+If the selection is a quotient with numerator 1, then Calc's default
+simplifications would normally cancel the new factors. To prevent
+this, when the @kbd{j *} command is used on a selection whose numerator is
+1 or -1, the denominator is expanded at the top level using the
+distributive law (as if using the @kbd{C-u 1 a x} command). Suppose the
+formula on the stack is @samp{1 / (a + 1)} and you wish to multiplying the
+top and bottom by @samp{a - 1}. Calc's default simplifications would
+normally change the result @samp{(a - 1) /(a + 1) (a - 1)} back
+to the original form by cancellation; when @kbd{j *} is used, Calc
+expands the denominator to @samp{a (a - 1) + a - 1} to prevent this.
+
+If you wish the @kbd{j *} command to completely expand the denominator
+of a quotient you can call it with a zero prefix: @kbd{C-u 0 j *}. For
+example, if the formula on the stack is @samp{1 / (sqrt(a) + 1)}, you may
+wish to eliminate the square root in the denominator by multiplying
+the top and bottom by @samp{sqrt(a) - 1}. If you did this simply by using
+a simple @kbd{j *} command, you would get
+@samp{(sqrt(a)-1)/ (sqrt(a) (sqrt(a) - 1) + sqrt(a) - 1)}. Instead,
+you would probably want to use @kbd{C-u 0 j *}, which would expand the
+bottom and give you the desired result @samp{(sqrt(a)-1)/(a-1)}. More
+generally, if @kbd{j *} is called with an argument of a positive
+integer @var{n}, then the denominator of the expression will be
+expanded @var{n} times (as if with the @kbd{C-u @var{n} a x} command).
If the selection is an inequality, @kbd{j *} and @kbd{j /} will
accept any factor, but will warn unless they can prove the factor
@noindent
@kindex a s
+@kindex I a s
+@kindex H a s
@pindex calc-simplify
@tindex simplify
The @kbd{a s} (@code{calc-simplify}) [@code{simplify}] command applies
simplification occurs automatically. Normally only the ``default
simplifications'' occur.
+There are some simplifications that, while sometimes useful, are never
+done automatically. For example, the @kbd{I} prefix can be given to
+@kbd{a s}; the @kbd{I a s} command will change any trigonometric
+function to the appropriate combination of @samp{sin}s and @samp{cos}s
+before simplifying. This can be useful in simplifying even mildly
+complicated trigonometric expressions. For example, while @kbd{a s}
+can reduce @samp{sin(x) csc(x)} to @samp{1}, it will not simplify
+@samp{sin(x)^2 csc(x)}. The command @kbd{I a s} can be used to
+simplify this latter expression; it will transform @samp{sin(x)^2
+csc(x)} into @samp{sin(x)}. However, @kbd{I a s} will also perform
+some ``simplifications'' which may not be desired; for example, it
+will transform @samp{tan(x)^2} into @samp{sin(x)^2 / cos(x)^2}. The
+Hyperbolic prefix @kbd{H} can be used similarly; the @kbd{H a s} will
+replace any hyperbolic functions in the formula with the appropriate
+combinations of @samp{sinh}s and @samp{cosh}s before simplifying.
+
+
@menu
* Default Simplifications::
* Algebraic Simplifications::
@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
* The Units Table::
* Predefined Units::
* User-Defined Units::
+* Logarithmic Units::
+* Musical Notes::
@end menu
@node Basic Operations on Units, The Units Table, Units, Units
@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
@c Describe angular units, luminosity vs. steradians problem.
-@node User-Defined Units, , Predefined Units, Units
+@node User-Defined Units, Logarithmic Units, Predefined Units, Units
@section User-Defined Units
@noindent
16.5 feet. The unit conversion and simplification commands will now
treat @code{rod} just like any other unit of length. You will also be
prompted for an optional English description of the unit, which will
-appear in the Units Table.
+appear in the Units Table. If you wish the definition of this unit to
+be displayed in a special way in the Units Table buffer (such as with an
+asterisk to indicate an approximate value), then you can call this
+command with an argument, @kbd{C-u u d}; you will then also be prompted
+for a string that will be used to display the definition.
@kindex u u
@pindex calc-undefine-unit
@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
tell Calc to use a different file for the Calc init file.)
+@node Logarithmic Units, Musical Notes, User-Defined Units, Units
+@section Logarithmic Units
+
+The units @code{dB} (decibels) and @code{Np} (nepers) are logarithmic
+units which are manipulated differently than standard units. Calc
+provides commands to work with these logarithmic units.
+
+Decibels and nepers are used to measure power quantities as well as
+field quantities (quantities whose squares are proportional to power);
+these two types of quantities are handled slightly different from each
+other. By default the Calc commands work as if power quantities are
+being used; with the @kbd{H} prefix the Calc commands work as if field
+quantities are being used.
+
+The decibel level of a power
+@infoline @math{P1},
+@texline @math{P_1},
+relative to a reference power
+@infoline @math{P0},
+@texline @math{P_0},
+is defined to be
+@infoline @math{10 log10(P1/P0) dB}.
+@texline @math{10 \log_{10}(P_{1}/P_{0}) {\rm dB}}.
+(The factor of 10 is because a decibel, as its name implies, is
+one-tenth of a bel. The bel, named after Alexander Graham Bell, was
+considered to be too large of a unit and was effectively replaced by
+the decibel.) If @math{F} is a field quantity with power
+@math{P=k F^2}, then a reference quantity of
+@infoline @math{F0}
+@texline @math{F_0}
+would correspond to a power of
+@infoline @math{P0=k F0^2}.
+@texline @math{P_{0}=kF_{0}^2}.
+If
+@infoline @math{P1=k F1^2},
+@texline @math{P_{1}=kF_{1}^2},
+then
+
+@ifnottex
+@example
+10 log10(P1/P0) = 10 log10(F1^2/F0^2) = 20 log10(F1/F0).
+@end example
+@end ifnottex
+@tex
+$$ 10 \log_{10}(P_1/P_0) = 10 \log_{10}(F_1^2/F_0^2) = 20
+\log_{10}(F_1/F_0)$$
+@end tex
+
+@noindent
+In order to get the same decibel level regardless of whether a field
+quantity or the corresponding power quantity is used, the decibel
+level of a field quantity
+@infoline @math{F1},
+@texline @math{F_1},
+relative to a reference
+@infoline @math{F0},
+@texline @math{F_0},
+is defined as
+@infoline @math{20 log10(F1/F0) dB}.
+@texline @math{20 \log_{10}(F_{1}/F_{0}) {\rm dB}}.
+For example, the decibel value of a sound pressure level of
+@infoline @math{60 uPa}
+@texline @math{60 \mu{\rm Pa}}
+relative to
+@infoline @math{20 uPa}
+@texline @math{20 \mu{\rm Pa}}
+(the threshhold of human hearing) is
+@infoline @math{20 log10(60 uPa/ 20 uPa) dB = 20 log10(3) dB},
+@texline @math{20 \log_{10}(60 \mu{\rm Pa}/20 \mu{\rm Pa}) {\rm dB} = 20 \log_{10}(3) {\rm dB}},
+which is about
+@infoline @math{9.54 dB}.
+@texline @math{9.54 {\rm dB}}.
+Note that in taking the ratio, the original units cancel and so these
+logarithmic units are dimensionless.
+
+Nepers (named after John Napier, who is credited with inventing the
+logarithm) are similar to bels except they use natural logarithms instead
+of common logarithms. The neper level of a power
+@infoline @math{P1},
+@texline @math{P_1},
+relative to a reference power
+@infoline @math{P0},
+@texline @math{P_0},
+is
+@infoline @math{(1/2) ln(P1/P0) Np}.
+@texline @math{(1/2) \ln(P_1/P_0) {\rm Np}}.
+The neper level of a field
+@infoline @math{F1},
+@texline @math{F_1},
+relative to a reference field
+@infoline @math{F0},
+@texline @math{F_0},
+is
+@infoline @math{ln(F1/F0) Np}.
+@texline @math{\ln(F_1/F_0) {\rm Np}}.
+
+@vindex calc-lu-power-reference
+@vindex calc-lu-field-reference
+For power quantities, Calc uses
+@infoline @math{1 mW}
+@texline @math{1 {\rm mW}}
+as the default reference quantity; this default can be changed by changing
+the value of the customizable variable
+@code{calc-lu-power-reference} (@pxref{Customizing Calc}).
+For field quantities, Calc uses
+@infoline @math{20 uPa}
+@texline @math{20 \mu{\rm Pa}}
+as the default reference quantity; this is the value used in acoustics
+which is where decibels are commonly encountered. This default can be
+changed by changing the value of the customizable variable
+@code{calc-lu-field-reference} (@pxref{Customizing Calc}). A
+non-default reference quantity will be read from the stack if the
+capital @kbd{O} prefix is used.
+
+@kindex l q
+@pindex calc-lu-quant
+@tindex lupquant
+@tindex lufquant
+The @kbd{l q} (@code{calc-lu-quant}) [@code{lupquant}]
+command computes the power quantity corresponding to a given number of
+logarithmic units. With the capital @kbd{O} prefix, @kbd{O l q}, the
+reference level will be read from the top of the stack. (In an
+algebraic formula, @code{lupquant} can be given an optional second
+argument which will be used for the reference level.) For example,
+@code{20 dB @key{RET} l q} will return @code{100 mW};
+@code{20 dB @key{RET} 4 W @key{RET} O l q} will return @code{400 W}.
+The @kbd{H l q} [@code{lufquant}] command behaves like @kbd{l q} but
+computes field quantities instead of power quantities.
+
+@kindex l d
+@pindex calc-db
+@tindex dbpower
+@tindex dbfield
+@kindex l n
+@pindex calc-np
+@tindex nppower
+@tindex npfield
+The @kbd{l d} (@code{calc-db}) [@code{dbpower}] command will compute
+the decibel level of a power quantity using the default reference
+level; @kbd{H l d} [@code{dbfield}] will compute the decibel level of
+a field quantity. The commands @kbd{l n} (@code{calc-np})
+[@code{nppower}] and @kbd{H l n} [@code{npfield}] will similarly
+compute neper levels. With the capital @kbd{O} prefix these commands
+will read a reference level from the stack; in an algebraic formula
+the reference level can be given as an optional second argument.
+
+@kindex l +
+@pindex calc-lu-plus
+@tindex lupadd
+@tindex lufadd
+@kindex l -
+@pindex calc-lu-minus
+@tindex lupsub
+@tindex lufsub
+@kindex l *
+@pindex calc-lu-times
+@tindex lupmul
+@tindex lufmul
+@kindex l /
+@pindex calc-lu-divide
+@tindex lupdiv
+@tindex lufdiv
+The sum of two power or field quantities doesn't correspond to the sum
+of the corresponding decibel or neper levels. If the powers
+corresponding to decibel levels
+@infoline @math{D1}
+@texline @math{D_1}
+and
+@infoline @math{D2}
+@texline @math{D_2}
+are added, the corresponding decibel level ``sum'' will be
+
+@ifnottex
+@example
+ 10 log10(10^(D1/10) + 10^(D2/10)) dB.
+@end example
+@end ifnottex
+@tex
+$$ 10 \log_{10}(10^{D_1/10} + 10^{D_2/10}) {\rm dB}.$$
+@end tex
+
+@noindent
+When field quantities are combined, it often means the corresponding
+powers are added and so the above formula might be used. In
+acoustics, for example, the sound pressure level is a field quantity
+and so the decibels are often defined using the field formula, but the
+sound pressure levels are combined as the sound power levels, and so
+the above formula should be used. If two field quantities themselves
+are added, the new decibel level will be
+
+@ifnottex
+@example
+ 20 log10(10^(D1/20) + 10^(D2/20)) dB.
+@end example
+@end ifnottex
+@tex
+$$ 20 \log_{10}(10^{D_1/20} + 10^{D_2/20}) {\rm dB}.$$
+@end tex
+
+@noindent
+If the power corresponding to @math{D} dB is multiplied by a number @math{N},
+then the corresponding decibel level will be
+
+@ifnottex
+@example
+ D + 10 log10(N) dB,
+@end example
+@end ifnottex
+@tex
+$$ D + 10 \log_{10}(N) {\rm dB},$$
+@end tex
+
+@noindent
+if a field quantity is multiplied by @math{N} the corresponding decibel level
+will be
+
+@ifnottex
+@example
+ D + 20 log10(N) dB.
+@end example
+@end ifnottex
+@tex
+$$ D + 20 \log_{10}(N) {\rm dB}.$$
+@end tex
+
+@noindent
+There are similar formulas for combining nepers. The @kbd{l +}
+(@code{calc-lu-plus}) [@code{lupadd}] command will ``add'' two
+logarithmic unit power levels this way; with the @kbd{H} prefix,
+@kbd{H l +} [@code{lufadd}] will add logarithmic unit field levels.
+Similarly, logarithmic units can be ``subtracted'' with @kbd{l -}
+(@code{calc-lu-minus}) [@code{lupsub}] or @kbd{H l -} [@code{lufsub}].
+The @kbd{l *} (@code{calc-lu-times}) [@code{lupmul}] and @kbd{H l *}
+[@code{lufmul}] commands will ``multiply'' a logarithmic unit by a
+number; the @kbd{l /} (@code{calc-lu-divide}) [@code{lupdiv}] and
+@kbd{H l /} [@code{lufdiv}] commands will ``divide'' a logarithmic
+unit by a number. Note that the reference quantities don't play a role
+in this arithmetic.
+
+@node Musical Notes, , Logarithmic Units, Units
+@section Musical Notes
+
+Calc can convert between musical notes and their associated
+frequencies. Notes can be given using either scientific pitch
+notation or midi numbers. Since these note systems are basically
+logarithmic scales, Calc uses the @kbd{l} prefix for functions
+operating on notes.
+
+Scientific pitch notation refers to a note by giving a letter
+A through G, possibly followed by a flat or sharp) with a subscript
+indicating an octave number. Each octave starts with C and ends with
+B and
+@c increasing each note by a semitone will result
+@c in the sequence @expr{C}, @expr{C} sharp, @expr{D}, @expr{E} flat, @expr{E},
+@c @expr{F}, @expr{F} sharp, @expr{G}, @expr{A} flat, @expr{A}, @expr{B}
+@c flat and @expr{B}.
+the octave numbered 0 was chosen to correspond to the lowest
+audible frequency. Using this system, middle C (about 261.625 Hz)
+corresponds to the note @expr{C} in octave 4 and is denoted
+@expr{C_4}. Any frequency can be described by giving a note plus an
+offset in cents (where a cent is a ratio of frequencies so that a
+semitone consists of 100 cents).
+
+The midi note number system assigns numbers to notes so that
+@expr{C_(-1)} corresponds to the midi note number 0 and @expr{G_9}
+corresponds to the midi note number 127. A midi controller can have
+up to 128 keys and each midi note number from 0 to 127 corresponds to
+a possible key.
+
+@kindex l s
+@pindex calc-spn
+@tindex spn
+The @kbd{l s} (@code{calc-spn}) [@code{spn}] command converts either
+a frequency or a midi number to scientific pitch notation. For
+example, @code{500 Hz} gets converted to
+@code{B_4 + 21.3094853649 cents} and @code{84} to @code{C_6}.
+
+
+@kindex l m
+@pindex calc-midi
+@tindex midi
+The @kbd{l m} (@code{calc-midi}) [@code{midi}] command converts either
+a frequency or a note given in scientific pitch notation to the
+corresponding midi number. For example, @code{C_6} gets converted to 84
+and @code{440 Hz} to 69.
+
+@kindex l f
+@pindex calc-freq
+@tindex freq
+The @kbd{l f} (@code{calc-freq}) [@code{freq}] command converts either
+either a midi number or a note given in scientific pitch notation to
+the corresponding frequency. For example, @code{Asharp_2 + 30 cents}
+gets converted to @code{118.578040134 Hz} and @code{55} to
+@code{195.99771799 Hz}.
+
+Since the frequencies of notes are not usually given exactly (and are
+typically irrational), the customizable variable
+@code{calc-note-threshold} determines how close (in cents) a frequency
+needs to be to a note to be recognized as that note
+(@pxref{Customizing Calc}). This variable has a default value of
+@code{1}. For example, middle @var{C} is approximately
+@expr{261.625565302 Hz}; this frequency is often shortened to
+@expr{261.625 Hz}. Without @code{calc-note-threshold} (or a value of
+@expr{0}), Calc would convert @code{261.625 Hz} to scientific pitch
+notation @code{B_3 + 99.9962592773 cents}; with the default value of
+@code{1}, Calc converts @code{261.625 Hz} to @code{C_4}.
+
+
+
@node Store and Recall, Graphics, Units, Top
@chapter Storing and Recalling
@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
@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 Calc init file or @file{.emacs}. 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 or later and you are not using X,
-Calc will configure GNUPLOT to display graphs using simple character
-graphics that will work on any terminal.
+find it, you may need to set the @code{calc-gnuplot-name} variable in
+your Calc init file or @file{.emacs}. 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 or MS-Windows, Calc will configure GNUPLOT for you
+automatically. If you have GNUPLOT 3.0 or later and you are using a
+Unix or GNU system without X, Calc will configure GNUPLOT to display
+graphs using simple character graphics that will work on any
+Posix-compatible terminal.
@menu
* Basic Graphics::
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.
+@code{DISPLAY} environment variable), @code{windows} on MS-Windows, or
+otherwise @code{dumb} under GNUPLOT 3.0 and later, or
+@code{postscript} under GNUPLOT 2.0. This is the initial default
+value.
The @code{dumb} device is an interface to ``dumb terminals,'' i.e.,
terminals with no special graphics facilities. It writes a crude
@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 @key{RET}} to set GNUPLOT to write
-to its standard output stream, i.e., to @samp{*Gnuplot Trail*}.
-This is the default setting.
+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} and
+@code{windows}, 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
+@key{RET}} to set GNUPLOT to write to its standard output stream,
+i.e., to @samp{*Gnuplot Trail*}. This is the default setting.
Another special output name is @code{tty}, which means that GNUPLOT
is going to write graphics commands directly to its standard output,
The normal value is @code{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.
+window in the upper-left corner of the screen. This command has no
+effect if the current device is @code{windows}.
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.
+something has gone wrong@footnote{
+On MS-Windows, due to the peculiarities of how the Windows version of
+GNUPLOT (called @command{wgnuplot}) works, the GNUPLOT responses are
+not communicated back to Calc. Instead, you need to look them up in
+the GNUPLOT command window that is displayed as in normal interactive
+usage of GNUPLOT.
+}.
@kindex g C
@pindex calc-graph-command
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.
+buffer is hidden again. (Note that on MS-Windows, the @samp{*Gnuplot
+Trail*} buffer will usually show nothing of interest, because
+GNUPLOT's responses are not communicated back to Calc.)
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
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
of describing a blank line that is more appropriate for this
case).
-@vindex calc-embedded-open-word
-@vindex calc-embedded-close-word
-The @code{calc-embedded-open-word} and @code{calc-embedded-close-word}
-variables are similar expressions used when you type @kbd{C-x * w}
-instead of @kbd{C-x * e} to enable Embedded mode.
+@vindex calc-embedded-word-regexp
+The @code{calc-embedded-word-regexp} variable holds a regular expression
+used to define an expression to look for (a ``word'') when you type
+@kbd{C-x * w} to enable Embedded mode.
@vindex calc-embedded-open-plain
The @code{calc-embedded-open-plain} variable is a string which
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,
@smallexample
(let ((calc-command-flags nil))
(unwind-protect
- (save-excursion
+ (save-current-buffer
(calc-select-buffer)
@emph{body of function}
@emph{renumber stack}
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
@code{nil}.
@end defvar
-@defvar calc-embedded-open-word
-@defvarx calc-embedded-close-word
-@defvarx calc-embedded-open-close-word-alist
+@defvar calc-embedded-word-regexp
+@defvarx calc-embedded-word-regexp-alist
See @ref{Customizing Embedded Mode}.@*
-The variables @code{calc-embedded-open-word} and
-@code{calc-embedded-close-word} control the region that Calc will
-activate when Embedded mode is entered with @kbd{C-x * w}. They are
-regular expressions.
-
-The default values of @code{calc-embedded-open-word} and
-@code{calc-embedded-close-word} are @code{"^\\|[^-+0-9.eE]"} and
-@code{"$\\|[^-+0-9.eE]"} respectively.
-
-The variable @code{calc-embedded-open-close-word-alist} is used to
-set @code{calc-embedded-open-word} and
-@code{calc-embedded-close-word} to different regular
-expressions depending on the major mode of the editing buffer.
+The variable @code{calc-embedded-word-regexp} determines the expression
+that Calc will activate when Embedded mode is entered with @kbd{C-x *
+w}. It is a regular expressions.
+
+The default value of @code{calc-embedded-word-regexp} is
+@code{"[-+]?[0-9]+\\(\\.[0-9]+\\)?\\([eE][-+]?[0-9]+\\)?"}.
+
+The variable @code{calc-embedded-word-regexp-alist} is used to
+set @code{calc-embedded-word-regexp} to a different regular
+expression depending on the major mode of the editing buffer.
It consists of a list of lists of the form
-@code{(@var{MAJOR-MODE} @var{OPEN-WORD-REGEXP}
-@var{CLOSE-WORD-REGEXP})}, and its default value is
+@code{(@var{MAJOR-MODE} @var{WORD-REGEXP})}, and its default value is
@code{nil}.
@end defvar
and @code{calc-embedded-open-close-plain-alist}.
@end defvar
+@defvar calc-lu-power-reference
+@defvarx calc-lu-field-reference
+See @ref{Logarithmic Units}.@*
+The variables @code{calc-lu-power-reference} and
+@code{calc-lu-field-reference} are unit expressions (written as
+strings) which Calc will use as reference quantities for logarithmic
+units.
+
+The default value of @code{calc-lu-power-reference} is @code{"mW"}
+and the default value of @code{calc-lu-field-reference} is
+@code{"20 uPa"}.
+@end defvar
+
+@defvar calc-note-threshold
+See @ref{Musical Notes}.@*
+The variable @code{calc-note-threshold} is a number (written as a
+string) which determines how close (in cents) a frequency needs to be
+to a note to be recognized as that note.
+
+The default value of @code{calc-note-threshold} is 1.
+@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
of @code{calc-multiplication-has-precedence} is @code{t}.
@end defvar
+@defvar calc-undo-length
+The variable @code{calc-undo-length} determines the number of undo
+steps that Calc will keep track of when @code{calc-quit} is called.
+If @code{calc-undo-length} is a non-negative integer, then this is the
+number of undo steps that will be preserved; if
+@code{calc-undo-length} has any other value, then all undo steps will
+be preserved. The default value of @code{calc-undo-length} is @expr{100}.
+@end defvar
+
@node Reporting Bugs, Summary, Customizing Calc, Top
@appendix Reporting Bugs
so any efforts can be coordinated.
The latest version of Calc is available from Savannah, in the Emacs
-CVS tree. See @uref{http://savannah.gnu.org/projects/emacs}.
+repository. See @uref{http://savannah.gnu.org/projects/emacs}.
@c [summary]
@node Summary, Key Index, Reporting Bugs, Top
@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}
@r{ v x@: k T @: @: @:utpt@:(x,v)}
@r{ v x@: I k T @: @: @:ltpt@:(x,v)}
+@c
+@r{ a b@: l + @: @: @:lupadd@:(a,b)}
+@r{ a b@: H l + @: @: @:lufadd@:(a,b)}
+@r{ a b@: l - @: @: @:lupsub@:(a,b)}
+@r{ a b@: H l - @: @: @:lufsub@:(a,b)}
+@r{ a b@: l * @: @: @:lupmul@:(a,b)}
+@r{ a b@: H l * @: @: @:lufmul@:(a,b)}
+@r{ a b@: l / @: @: @:lupdiv@:(a,b)}
+@r{ a b@: H l / @: @: @:lufdiv@:(a,b)}
+@r{ a@: l d @: @: @:dbpower@:(a)}
+@r{ a b@: O l d @: @: @:dbpower@:(a,b)}
+@r{ a@: H l d @: @: @:dbfield@:(a)}
+@r{ a b@: O H l d @: @: @:dbfield@:(a,b)}
+@r{ a@: l n @: @: @:nppower@:(a)}
+@r{ a b@: O l n @: @: @:nppower@:(a,b)}
+@r{ a@: H l n @: @: @:npfield@:(a)}
+@r{ a b@: O H l n @: @: @:npfield@:(a,b)}
+@r{ a@: l q @: @: @:lupquant@:(a)}
+@r{ a b@: O l q @: @: @:lupquant@:(a,b)}
+@r{ a@: H l q @: @: @:lufquant@:(a)}
+@r{ a b@: O H l q @: @: @:lufquant@:(a,b)}
+@r{ a@: l s @: @: @:spn@:(a)}
+@r{ a@: l m @: @: @:midi@:(a)}
+@r{ a@: l f @: @: @:freq@:(a)}
+
@c
@r{ @: m a @: @: 12,13 @:calc-algebraic-mode@:}
@r{ @: m d @: @: @:calc-degrees-mode@:}
@printindex fn
@bye
-
-
-@ignore
- arch-tag: 77a71809-fa4d-40be-b2cc-da3e8fb137c0
-@end ignore