]> code.delx.au - gnu-emacs/blobdiff - doc/misc/calc.texi
consistently use @insertcopying, @direntry, @contents
[gnu-emacs] / doc / misc / calc.texi
index be38321f5cfeefafb3800a151ebe738aca75b93c..823dccfe136a793da0d20ca4528d9461e4536b9b 100644 (file)
@@ -93,11 +93,11 @@ This file documents Calc, the GNU Emacs calculator, included with GNU Emacs 23.1
 @end ifnotinfo
 
 Copyright @copyright{} 1990, 1991, 2001, 2002, 2003, 2004,
-2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+2005, 2006, 2007, 2008, 2009 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
@@ -127,8 +127,6 @@ developing GNU and promoting software freedom.''
 @page
 
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1990, 1991, 2001, 2002, 2003, 2004,
-   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 @insertcopying
 @end titlepage
 
@@ -161,6 +159,8 @@ file), type @kbd{?}.  (You can also type @kbd{h} to run through a
 longer Info tutorial.)
 @end ifinfo
 
+@insertcopying
+
 @menu
 * Getting Started::       General description and overview.
 @ifinfo
@@ -286,13 +286,13 @@ but Calc has the advantages of convenience, portability, and freedom.
 
 @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
+This 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).
 @c [when-split]
@@ -320,24 +320,25 @@ of Calc.  Or, you can look in the table of contents or the Concept
 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
@@ -548,7 +549,7 @@ many weeks have passed since then.
 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
@@ -560,7 +561,7 @@ system.  Type @kbd{d N} to return to normal notation.
 
 @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
@@ -717,9 +718,11 @@ normal partial-screen mode.
 
 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)
@@ -871,7 +874,8 @@ is
 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
@@ -886,15 +890,16 @@ is
 @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
@@ -908,6 +913,9 @@ is
 @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.
 
@@ -953,9 +961,9 @@ To leave Embedded mode, type @kbd{C-x * e} again.  The mode line
 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.
@@ -1266,7 +1274,7 @@ you have followed a cross-reference, you can press the letter
 
 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::
@@ -1296,10 +1304,13 @@ self-explanatory.  @xref{Embedded Mode}, for a description of
 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
@@ -1747,9 +1758,9 @@ Calculator in Algebraic mode, which is closer to the way
 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{'})
@@ -14108,12 +14119,12 @@ to the function name @code{Vec}, because @code{vec} is the name of
 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
@@ -14213,9 +14224,11 @@ in Calc, @TeX{}, La@TeX{} and @dfn{eqn} (described in the next section):
 @starindex
 @end ignore
 @tindex VEC
+@ignore
 @iftex
 @endgroup
 @end iftex
+@end ignore
 @example
 Calc      TeX           LaTeX         eqn
 ----      ---           -----         ---
@@ -21908,24 +21921,33 @@ formula using algebraic entry, then multiplies both sides of the
 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
@@ -27877,7 +27899,11 @@ typing @kbd{u d rod} defines the new unit @samp{rod} to be equivalent to
 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
@@ -30744,11 +30770,10 @@ other one, except it now uses @samp{\'} (``end-of-buffer'') and
 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
@@ -34879,26 +34904,21 @@ It consists of a list of lists of the form
 @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