-\input texinfo @c -*-texinfo-*-
+\input texinfo @c -*- mode: texinfo; coding: utf-8 -*-
@comment %**start of header (This is for running Texinfo on a region.)
@c smallbook
@setfilename ../../info/calc.info
@c [title]
@settitle GNU Emacs Calc Manual
-@documentencoding UTF-8
+@include docstyle.texi
@setchapternewpage odd
@comment %**end of header (This is for running Texinfo on a region.)
@c The following macros are used for conditional output for single lines.
@c @texline foo
-@c `foo' will appear only in TeX output
+@c 'foo' will appear only in TeX output
@c @infoline foo
-@c `foo' will appear only in non-TeX output
+@c 'foo' will appear only in non-TeX output
@c @expr{expr} will typeset an expression;
@c $x$ in TeX, @samp{x} otherwise.
@noindent
Type @kbd{P 2 ^} to compute
@texline @math{\pi^2 = 9.86960440109}.
-@infoline the value of `pi' squared, 9.86960440109.
+@infoline the value of @cpi{} squared, 9.86960440109.
@noindent
Type @key{TAB} to exchange the order of these two results.
@noindent
Type @kbd{' pi^2 @key{RET}} to enter
@texline @math{\pi^2}.
-@infoline `pi' squared.
+@infoline @cpi{} squared.
To evaluate this symbolic formula as a number, type @kbd{=}.
@noindent
Many people have contributed to Calc by reporting bugs and suggesting
features, large and small. A few deserve special mention: Tim Peters,
who helped develop the ideas that led to the selection commands, rewrite
-rules, and many other algebra features;
-@texline Fran\c{c}ois
-@infoline Francois
+rules, and many other algebra features; François
Pinard, who contributed an early prototype of the Calc Summary appendix
as well as providing valuable suggestions in many other areas of Calc;
Carl Witty, whose eagle eyes discovered many typographical and factual
@c [tutorial]
@ifinfo
-@c This node is accessed by the `C-x * t' command.
+@c This node is accessed by the 'C-x * t' command.
@node Interactive Tutorial, Tutorial, Getting Started, Top
@chapter Tutorial
One more way to correct an error is by editing the stack entries.
The actual Stack buffer is marked read-only and must not be edited
-directly, but you can press @kbd{`} (the backquote or accent grave)
+directly, but you can press @kbd{`} (grave accent)
to edit a stack entry.
Try entering @samp{3.141439} now. If this is supposed to represent
fit on a typical screen, either, so you will have to use horizontal
scrolling to see them all. Press @kbd{<} and @kbd{>} to scroll the
stack window left and right by half its width. Another way to view
-something large is to press @kbd{`} (back-quote) to edit the top of
+something large is to press @kbd{`} (grave accent) to edit the top of
stack in a separate window. (Press @kbd{C-c C-c} when you are done.)
You can enter non-decimal numbers using the @kbd{#} symbol, too.
to get old vectors back using the @kbd{t y} command.)
An easy way to view a full vector when @kbd{v .} mode is active is
-to press @kbd{`} (back-quote) to edit the vector; editing always works
+to press @kbd{`} (grave accent) to edit the vector; editing always works
with the full, unabbreviated value.
@cindex Least-squares for fitting a straight line
@end smallexample
@noindent
-When we type @kbd{Z `} (that's a back-quote character), Calc saves
+When we type @kbd{Z `} (that's a grave accent), Calc saves
its mode settings and the contents of the ten ``quick variables''
for later reference. When we type @kbd{Z '} (that's an apostrophe
now), Calc restores those saved values. Thus the @kbd{p 4} and
zero, so adding zeros on the left and right is safe. From then on
the job is pretty straightforward.
-Incidentally, Calc provides the
-@texline @dfn{M@"obius} @math{\mu}
-@infoline @dfn{Moebius mu}
+Incidentally, Calc provides the @dfn{Möbius μ}
function which is zero if and only if its argument is square-free. It
would be a much more convenient way to do the above test in practice.
@end smallexample
@noindent
-Et voil@`a, September 13, 1991 is a Friday.
+Et voilà, September 13, 1991 is a Friday.
@smallexample
@group
@texline @math{\log_2 n}
@infoline @expr{log(n,2)}
steps. For example, this program can compute the 1000th Fibonacci
-number (a 209-digit integer!) in about 10 steps; even though the
+number (a 209-digit integer!)@: in about 10 steps; even though the
@kbd{Z < ... Z >} solution had much simpler steps, it would have
required so many steps that it would not have been practical.
keys are available during algebraic entry but not during numeric entry.
In the same vein, during either numeric or algebraic entry you can
-press @kbd{`} (backquote) to switch to @code{calc-edit} mode, where
+press @kbd{`} (grave accent) to switch to @code{calc-edit} mode, where
you complete your half-finished entry in a separate buffer.
@xref{Editing Stack Entries}.
For example, the quoted character @samp{"x"} produces the vector
result @samp{[120]} (because 120 is the ASCII code of the lower-case
-`x'; @pxref{Strings}). Since this is a vector, not an integer, it
+``x''; @pxref{Strings}). Since this is a vector, not an integer, it
is displayed only according to the current mode settings. But
running Quick Calc again and entering @samp{120} will produce the
result @samp{120 (16#78, 8#170, x)} which shows the number in its
@cindex Unix time format
The Unix operating system measures time as an integer number of
seconds since midnight, Jan 1, 1970. To convert a Calc date
-value into a Unix time stamp, first subtract 719164 (the code
+value into a Unix time stamp, first subtract 719163 (the code
for @samp{<Jan 1, 1970>}), then multiply by 86400 (the number of
seconds in a day) and press @kbd{R} to round to the nearest
integer. If you have a date form, you can simply subtract the
day @samp{<Jan 1, 1970>} instead of unpacking and subtracting
-719164. Likewise, divide by 86400 and add @samp{<Jan 1, 1970>}
+719163. Likewise, divide by 86400 and add @samp{<Jan 1, 1970>}
to convert from Unix time to a Calc date form. (Note that
Unix normally maintains the time in the GMT time zone; you may
need to subtract five hours to get New York time, or eight hours
@cindex Editing the stack with Emacs
The @kbd{`} (@code{calc-edit}) command creates a temporary buffer
(@file{*Calc Edit*}) for editing the top-of-stack value using regular
-Emacs commands. Note that @kbd{`} is a backquote, not a quote. With a
-numeric prefix argument, it edits the specified number of stack entries
-at once. (An argument of zero edits the entire stack; a negative
-argument edits one specific stack entry.)
+Emacs commands. Note that @kbd{`} is a grave accent, not an apostrophe.
+With a numeric prefix argument, it edits the specified number of stack
+entries at once. (An argument of zero edits the entire stack; a
+negative argument edits one specific stack entry.)
When you are done editing, press @kbd{C-c C-c} to finish and return
to Calc. The @key{RET} and @key{LFD} keys also work to finish most
@xref{Algebraic Definitions}, for a sample use of
No-Simplification mode.
-
@kindex m N
@pindex calc-num-simplify-mode
The @kbd{m N} (@code{calc-num-simplify-mode}) command turns off simplification
@item Iww
Week number: ISO 8601 week number, ``W01'' for week 1.
@item d
-Day of year: ``34'' for Feb. 3.
+Day of year: ``34'' for Feb.@: 3.
@item ddd
-Day of year: ``034'' for Feb. 3.
+Day of year: ``034'' for Feb.@: 3.
@item bdd
-Day of year: `` 34'' for Feb. 3.
+Day of year: `` 34'' for Feb.@: 3.
@item T
Letter: Literal ``T''.
@item h
The @kbd{k p} (@code{calc-prime-test}) command checks if the integer on
the top of the stack is prime. For integers less than eight million, the
answer is always exact and reasonably fast. For larger integers, a
-probabilistic method is used (see Knuth vol. II, section 4.5.4, algorithm P).
+probabilistic method is used (see Knuth vol.@: II, section 4.5.4, algorithm P).
The number is first checked against small prime factors (up to 13). Then,
any number of iterations of the algorithm are performed. Each step either
discovers that the number is non-prime, or substantially increases the
@pindex calc-moebius
@tindex moebius
The @kbd{k m} (@code{calc-moebius}) [@code{moebius}] command computes the
-@texline M@"obius @math{\mu}
-@infoline Moebius ``mu''
-function. If the input number is a product of @expr{k}
+Möbius μ function. If the input number is a product of @expr{k}
distinct factors, this is @expr{(-1)^k}. If the input number has any
duplicate factors (i.e., can be divided by the same prime more than once),
the result is zero.
$$ a_{i+1} = { a_i + b_i \over 2 } , \qquad b_{i+1} = \sqrt{a_i b_i} $$
@end tex
-@c @cindex Root-mean-square
-@c Another commonly used mean, the RMS (root-mean-square), can be computed
-@c for a vector of numbers simply by using the @kbd{A} command.
+@kindex u R
+@cindex Root-mean-square
+@tindex rms
+The @kbd{u R} (@code{calc-vector-rms}) [@code{rms}]
+command computes the RMS (root-mean-square) of the data values.
+As its name suggests, this is the square root of the mean of the
+squares of the data values.
@kindex u S
@pindex calc-vector-sdev
replace any hyperbolic functions in the formula with the appropriate
combinations of @samp{sinh}s and @samp{cosh}s before simplifying.
-
@menu
* Basic Simplifications::
* Algebraic Simplifications::
@code{tri} to the value on the top of the stack. @xref{Programming}.
@cindex Quaternions
-The following rule set, contributed by
-@texline Fran\c cois
-@infoline Francois
+The following rule set, contributed by François
Pinard, implements @dfn{quaternions}, a generalization of the concept of
complex numbers. Quaternions have four components, and are here
represented by function calls @samp{quat(@var{w}, [@var{x}, @var{y},
If the units you request are inconsistent with the original units, the
number will be converted into your units times whatever ``remainder''
-units are left over. (This can be disabled; @pxref{Customizing Calc}.)
-For example, converting @samp{55 mph} into acres
-produces @samp{6.08e-3 acre / m s}. (Recall that multiplication binds
-more strongly than division in Calc formulas, so the units here are
-acres per meter-second.) Remainder units are expressed in terms of
+units are left over. For example, converting @samp{55 mph} into acres
+produces @samp{6.08e-3 acre / (m s)}. Remainder units are expressed in terms of
``fundamental'' units like @samp{m} and @samp{s}, regardless of the
input units.
+@kindex u n
+@pindex calc-convert-exact-units
+If you intend that your new units be consistent with the original
+units, the @kbd{u n} (@code{calc-convert-exact-units}) command will
+check the units before the conversion. For example, to change
+@samp{mi/hr} to @samp{km/hr}, you could type @kbd{u c km @key{RET}},
+but @kbd{u n km @key{RET}} would signal an error.
+You would need to type @kbd{u n km/hr @key{RET}}.
+
One special exception is that if you specify a single unit name, and
a compatible unit appears somewhere in the units expression, then
that compatible unit will be converted to the new unit and the
@noindent
The definitions of many units have changed over the years. For example,
the meter was originally defined in 1791 as one ten-millionth of the
-distance from the equator to the north pole. In order to be more
+distance from the Equator to the North Pole. In order to be more
precise, the definition was adjusted several times, and now a meter is
defined as the distance that light will travel in a vacuum in
1/299792458 of a second; consequently, the speed of light in a
change this) is the kilogram, which was originally defined as the mass
of one liter of water, but is now defined as the mass of the
international prototype of the kilogram (IPK), a cylinder of platinum-iridium
-kept at the Bureau international des poids et mesures in S@`evres,
+kept at the Bureau international des poids et mesures in Sèvres,
France. (There are several copies of the IPK throughout the world.)
The British imperial units, once defined in terms of physical objects,
were redefined in 1963 in terms of SI units. The US customary units,
The unit of volume ``liters'' can be referred to by either the lower-case
@code{l} or the upper-case @code{L}.
-The unit @code{A} stands for Amperes; the name @code{Ang} is used
-@tex
-for \AA ngstroms.
-@end tex
-@ifnottex
-for Angstroms.
-@end ifnottex
+The unit @code{A} stands for amperes; the name @code{Ang} is used
+for angstroms.
The unit @code{pt} stands for pints; the name @code{point} stands for
a typographical point, defined by @samp{72 point = 1 in}. This is
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
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
@code{1}, Calc converts @code{261.625 Hz} to @code{C_4}.
-
@node Store and Recall, Graphics, Units, Top
@chapter Storing and Recalling
show all objects to their full precision, this feature normally makes no
difference.)
+The @kbd{C-y} command can be given a prefix, which will interpret the
+text being yanked with a different radix. If the text being yanked can be
+interpreted as a binary, octal, hexadecimal, or decimal number, then a
+prefix of @kbd{2}, @kbd{8}, @kbd{6} or @kbd{0} will have Calc
+interpret the yanked text as a number in the appropriate base. For example,
+if @samp{111} has just been killed and is yanked into Calc with a command
+of @kbd{C-2 C-y}, then the number @samp{7} will be put on the stack.
+If you use the plain prefix @kbd{C-u}, then you will be prompted for a
+base to use, which can be any integer from 2 to 36. If Calc doesn't
+allow the text being yanked to be read in a different base (such as if
+the text is an algebraic expression), then the prefix will have no
+effect.
+
@node Saving Into Registers, Inserting From Registers, Yanking Into Stack, Kill and Yank
@section Saving into Registers
outside the macro. The @kbd{Z `} (@code{calc-kbd-push}) and @kbd{Z '}
(@code{calc-kbd-pop}) commands give you both of these capabilities.
-When you type @kbd{Z `} (with a backquote or accent grave character),
+When you type @kbd{Z `} (with a grave accent),
the values of various mode settings are saved away. The ten ``quick''
variables @code{q0} through @code{q9} are also saved. When
you type @w{@kbd{Z '}} (with an apostrophe), these values are restored.
@defun to-simple-fraction f
If @var{f} is a floating-point number which can be represented exactly
-as a small rational number. return that number, else return @var{f}.
+as a small rational number, return that number, else return @var{f}.
For example, 0.75 would be converted to 3:4. This function is very
fast.
@end defun
of @code{calc-multiplication-has-precedence} is @code{t}.
@end defvar
-@defvar calc-ensure-consistent-units
-When converting units, the variable @code{calc-ensure-consistent-units}
-determines whether or not the target units need to be consistent with the
-original units. If @code{calc-ensure-consistent-units} is @code{nil}, then
-the target units don't need to have the same dimensions as the original units;
-for example, converting @samp{100 ft/s} to @samp{m} will produce @samp{30.48 m/s}.
-If @code{calc-ensure-consistent-units} is non-@code{nil}, then the target units
-need to have the same dimensions as the original units; for example, converting
-@samp{100 ft/s} to @samp{m} will result in an error, since @samp{ft/s} and @samp{m}
-have different dimensions. The default value of @code{calc-ensure-consistent-units}
-is @code{nil}.
-@end defvar
-
@defvar calc-context-sensitive-enter
The commands @code{calc-enter} and @code{calc-pop} will typically
duplicate the top of the stack. If
@r{ defn@: u d @:unit, descr @: @:calc-define-unit@:}
@r{ @: u e @: @: @:calc-explain-units@:}
@r{ @: u g @:unit @: @:calc-get-unit-definition@:}
+@r{ @: u n @:units @: 18 @:calc-convert-exact-units@:}
@r{ @: u p @: @: @:calc-permanent-units@:}
@r{ a@: u r @: @: @:calc-remove-units@:}
@r{ a@: u s @: @: @:usimplify@:(a)}
@r{ v@: H u M @: @: 19 @:vmedian@:(v)}
@r{ v@: I H u M @: @: 19 @:vhmean@:(v)}
@r{ v@: u N @: @: 19 @:vmin@:(v)}
+@r{ v@: u R @: @: @:rms@:(v)}
@r{ v@: u S @: @: 19 @:vsdev@:(v)}
@r{ v@: I u S @: @: 19 @:vpsdev@:(v)}
@r{ v@: H u S @: @: 19 @:vvar@:(v)}
@end format
+@c Avoid '@:' from here on, as it now means \sumsep in tex mode.
+
@noindent
NOTES
desired function, or with @kbd{x} or @kbd{z} followed by a function name,
or with @kbd{$} to take a formula from the top of the stack, or with
@kbd{'} and a typed formula. In the last two cases, the formula may
-be a nameless function like @samp{<#1+#2>} or @samp{<x, y : x+y>}, or it
-may include @kbd{$}, @kbd{$$}, etc. (where @kbd{$} will correspond to the
-last argument of the created function), or otherwise you will be
+be a nameless function like @samp{<#1+#2>} or @samp{<x, y : x+y>}; or it
+may include @kbd{$}, @kbd{$$}, etc., where @kbd{$} will correspond to the
+last argument of the created function; or otherwise you will be
prompted for an argument list. The number of vectors popped from the
stack by @kbd{V M} depends on the number of arguments of the function.