[comp.sources.misc] v15i039: Patch for GNU Emacs Calc, version 1.04 -> 1.05, part 12/20

daveg@csvax.cs.caltech.edu (David Gillespie) (10/15/90)

Posting-number: Volume 15, Issue 39
Submitted-by: daveg@csvax.cs.caltech.edu (David Gillespie)
Archive-name: calc-1.05/part12

#!/bin/sh
# this is part 12 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file calc.patch continued
#
CurArch=12
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
sed 's/^X//' << 'SHAR_EOF' >> calc.patch
X    (or (equal directory "")
X        (setq directory (file-name-as-directory (expand-file-name directory))))
X    (let (copyright-point
X  	autoload-point
X  	(start (point-marker))
X+ 	(mainfile (file-name-nondirectory (buffer-file-name)))
X+ 	checkfile
X+ 	(isextfile nil)
X  	filename
X  	(dest-buffer nil)
X  	(done nil)
X***************
X*** 15710,15715 ****
X--- 23828,23842 ----
X  	(func-list nil)
X  	(cmd-list nil)
X  	(file-list nil))
X+     (cond ((equal mainfile "calc.el")
X+ 	   (setq checkfile "calc-aent.el"))
X+ 	  ((equal mainfile "calc-ext.el")
X+ 	   (setq checkfile "calc-incom.el"
X+ 		 isextfile t))
X+ 	  (t (error "This command is for Calc installers only.  (Refer to the documentation.)")))
X+     (and (or (get-buffer checkfile)
X+ 	     (file-exists-p (concat directory checkfile)))
X+ 	 (error "calc-split has already been used!"))
X      (goto-char (point-min))
X      (search-forward ";;;; (Autoloads here)\n")
X      (setq autoload-point (point-marker))
X***************
X*** 15717,15723 ****
X      (search-forward ";;;;")
X      (forward-char -4)
X      (setq copyright-point (point))
X!     (copy-file (buffer-file-name) "calc-old.el" t)
X      (while (not done)
X        (re-search-forward "^;;;; \\[\\(.*\\)\\]\n\\|^(defun \\|^(fset '")
X        (if (equal (buffer-substring (match-beginning 0)
X--- 23844,23850 ----
X      (search-forward ";;;;")
X      (forward-char -4)
X      (setq copyright-point (point))
X!     (copy-file (buffer-file-name) (concat (buffer-file-name) "X") t)
X      (while (not done)
X        (re-search-forward "^;;;; \\[\\(.*\\)\\]\n\\|^(defun \\|^(fset '")
X        (if (equal (buffer-substring (match-beginning 0)
X***************
X*** 15736,15742 ****
X  		  (delete-region (point) (point-max))
X  		  (setq done t))
X  	      (set-marker start (point))
X! 	      (setq dest-buffer (and (not (equal filename "calc-ext.el"))
X  				     (find-file-noselect
X  				      (concat directory filename))))
X  	      (message "Splitting to %s..." filename)
X--- 23863,23869 ----
X  		  (delete-region (point) (point-max))
X  		  (setq done t))
X  	      (set-marker start (point))
X! 	      (setq dest-buffer (and (not (equal filename mainfile))
X  				     (find-file-noselect
X  				      (concat directory filename))))
X  	      (message "Splitting to %s..." filename)
X***************
X*** 15753,15760 ****
X  		     (insert " [" filename "]")
X  		     (goto-char (point-max))
X  		     (insert "\n"
X! 			     ";; This file is autoloaded from calc-ext, which in turn is loaded from calc.\n"
X! 			     "(require 'calc-ext)\n\n")))))
X  	(and dest-buffer
X  	     (let* ((name (progn
X  			    (looking-at "[^ \n]*")
X--- 23880,23891 ----
X  		     (insert " [" filename "]")
X  		     (goto-char (point-max))
X  		     (insert "\n"
X! 			     ";; This file is autoloaded from " mainfile ".\n"
X! 			     "(require '"
X! 			     (substring mainfile 0 -3)
X! 			     ")\n"
X! 			     "(require (progn (and (boundp 'outbuffer)"
X! 			     " (calc-need-macros)) 'calc))\n\n")))))
X  	(and dest-buffer
X  	     (let* ((name (progn
X  			    (looking-at "[^ \n]*")
X***************
X*** 15791,15801 ****
X      (or no-save
X  	(progn
X  	  (save-some-buffers t)
X! 	  (if (y-or-n-p "Byte-compile all files? ")
X  	      (progn
X! 		(require 'calc)
X! 		(byte-compile-file "calc-ext.el")
X! 		(load-file "calc-ext.elc")
X  		(mapcar (function
X  			 (lambda (x)
X  			   (byte-compile-file
X--- 23922,23933 ----
X      (or no-save
X  	(progn
X  	  (save-some-buffers t)
X! 	  (if (if compile
X! 		  (eq compile t)
X! 		(y-or-n-p "Byte-compile all files? "))
X  	      (progn
X! 		(byte-compile-file mainfile)
X! 		(load-file (concat mainfile "c"))
X  		(mapcar (function
X  			 (lambda (x)
X  			   (byte-compile-file
X*** calc-INSTALL	Mon Aug  6 15:05:42 1990
X--- ../dist/calc-INSTALL	Tue Oct  9 16:57:18 1990
X***************
X*** 2,8 ****
X  Installation
X  ************
X  
X! Calc 1.04 comes as a pair of Emacs Lisp files, generally called
X  `calc.el' and `calc-ext.el'.  The first contains the basic foundations
X  of the Calculator, and is as small as possible to promote quick loading.
X  The second contains all the more advanced commands and functions.  Calc
X--- 2,8 ----
X  Installation
X  ************
X  
X! Calc 1.05 comes as a pair of Emacs Lisp files, generally called
X  `calc.el' and `calc-ext.el'.  The first contains the basic foundations
X  of the Calculator, and is as small as possible to promote quick loading.
X  The second contains all the more advanced commands and functions.  Calc
X***************
X*** 10,28 ****
X  only the first part, and the second part is auto-loaded whenever the
X  first advanced feature is used.
X  
X  
X  Compilation
X  ===========
X  
X! Calc is written in a way that maximizes performance when its code has been
X! byte-compiled; a side effect is that performance is seriously degraded if
X! it *isn't* compiled.  Thus, it is essential to compile the Calculator
X! before trying to use it.  The Emacs command `M-x byte-compile-file'
X! is used to compile an Emacs Lisp file.  Compile each of `calc.el' and
X! `calc-ext.el' to obtain byte-code files `calc.elc' and
X! `calc-ext.elc'.  You may find you need to do `M-x load-file
X! calc.elc' before compiling `calc-ext.el' will work.
X  
X  For your convenience, the FTP distribution of Calc, obtainable from
X  anonymous FTP on `csvax.cs.caltech.edu', includes already-compiled
X  versions of both of these files.
X--- 10,70 ----
X  only the first part, and the second part is auto-loaded whenever the
X  first advanced feature is used.
X  
X+ To install Calc, just follow these simple steps.  If you want more
X+ information, each step is discussed at length in the sections below.
X  
X+   1. Create a "home" directory for Calc in a suitable place.
X+ 
X+   2. Place the files `calc.el', `calc-ext.el', `macedit.el', and
X+      `calc.texinfo' in this home directory.
X+ 
X+   3. Execute the command, `emacs -batch -l calc.el -f calc-install' in
X+      the home directory.  (This will split the two `.el' files into many
X+      smaller files for even faster loading, compile all of those files,
X+      compile `macedit.el', and format the manual for use with the Emacs
X+      Info system.)
X+ 
X+   4. Add all of the `autoload' and `global-set-key' commands shown below
X+      to your `.emacs' file (if you are installing Calc just for
X+      yourself) or to the system `default' file (if you are installing
X+      Calc for your whole system).
X+ 
X+   5. If you wish to use the GNUPLOT-based graphics commands, you may
X+      have to set up a few things in your `.emacs' or `default' file as
X+      described below.
X+ 
X+   6. Test your installation as described at the end of these instructions.
X+ 
X+   7. (Optional.)  To print a hardcopy of the Calc manual (about 300 pages),
X+      move to the Calc home directory and type `tex calc.texinfo',
X+      then `texindex calc.??', then `tex calc.texinfo' again.
X+      Now print the resulting `calc.dvi' file using whatever command
X+      is appropriate on your system.
X+ 
X+ Calc is now installed and ready to go!
X+ 
X+ If you are pressed for disk space, you can remove the `.el' files after
X+ `calc-install' has run, but *not* the `.elc' or `.elX' files!  (The
X+ `.elX' files are copies of the original `.el' files made by
X+ `calc-install' before it splits those files into parts.  You will need
X+ them to install patches for future versions of Calc.)
X+ 
X+ 
X  Compilation
X  ===========
X  
X! Calc is written in a way that maximizes performance when its code has
X! been byte-compiled; a side effect is that performance is seriously
X! degraded if it *isn't* compiled.  Thus, it is essential to compile the
X! Calculator before trying to use it.  The Emacs command `M-x
X! byte-compile-file' is used to compile an Emacs Lisp file.  Compile each
X! of `calc.el' and `calc-ext.el' to obtain byte-code files `calc.elc' and
X! `calc-ext.elc'.  You may find you need to do `M-x load-file calc.elc'
X! before compiling `calc-ext.el' will work.
X  
X+ The `calc-install' command does all necessary byte-compilation
X+ for you.
X+ 
X  For your convenience, the FTP distribution of Calc, obtainable from
X  anonymous FTP on `csvax.cs.caltech.edu', includes already-compiled
X  versions of both of these files.
X***************
X*** 36,53 ****
X  installing Calc just for your own use), or the system's `lisp/default'
X  file (if you are installing Calc publicly).
X  
X!      (autoload 'calc             ".../calc.elc"     "Calculator Mode" t nil)
X!      (autoload 'calc-extensions  ".../calc-ext.elc" nil nil nil)
X!      (autoload 'quick-calc       ".../calc.elc"     "Quick Calculator" t nil)
X!      (autoload 'full-calc        ".../calc.elc"     "Full-screen Calculator" t nil)
X!      (autoload 'calc-eval        ".../calc.elc"     "Call Calculator" nil nil)
X!      (autoload 'calc-grab-region ".../calc-ext.elc" nil t nil)
X       (autoload 'defmath          ".../calc-ext.elc" nil t t)
X  
X  where `.../calc.elc' represents the full path to the `calc.elc'
X  file, and similarly for `.../calc-ext.elc'.  If you have installed
X  these files in Emacs' main `lisp/' directory, you can just write
X! `"calc.elc"' and `"calc-ext.elc"'.
X  
X  The `autoload' command for `calc' is what loads `calc.elc'
X  when you type `M-x calc'.  The `autoload' for `calc-extensions'
X--- 78,98 ----
X  installing Calc just for your own use), or the system's `lisp/default'
X  file (if you are installing Calc publicly).
X  
X!      (autoload 'calc             ".../calc.elc"     "Calculator Mode" t)
X!      (autoload 'calc-extensions  ".../calc-ext.elc" nil)
X!      (autoload 'quick-calc       ".../calc.elc"     "Quick Calculator" t)
X!      (autoload 'full-calc        ".../calc.elc"     "Full-screen Calculator" t)
X!      (autoload 'calc-eval        ".../calc.elc"     "Use Calculator from Lisp")
X!      (autoload 'calc-grab-region ".../calc-ext.elc" nil t)
X       (autoload 'defmath          ".../calc-ext.elc" nil t t)
X  
X  where `.../calc.elc' represents the full path to the `calc.elc'
X  file, and similarly for `.../calc-ext.elc'.  If you have installed
X  these files in Emacs' main `lisp/' directory, you can just write
X! `"calc.elc"' and `"calc-ext.elc"'.  If you have used the
X! `calc-install' method and the home directory you chose is called,
X! say, `/usr/gnu/src/calc', then you would need to write
X! `"/usr/gnu/src/calc/calc.elc"' and similarly for `calc-ext.elc'.
X  
X  The `autoload' command for `calc' is what loads `calc.elc'
X  when you type `M-x calc'.  The `autoload' for `calc-extensions'
X***************
X*** 72,86 ****
X  Splitting `calc-ext'
X  ====================
X  
X! On the other hand, you may find that `calc-ext.el' is too big to load
X! quickly.  You can split the Calculator into still more parts using the
X! `calc-split' command.  This command splits the file `calc-ext.el' into
X! about 20 small files with names like `calc-cplx.el' and `calc-mode.el'
X! in the same directory as `calc-ext.el'.  First, load the file
X! `calc-ext.el' with `C-x C-f'.  Move to the end of the buffer and type
X! `C-x C-e' at the indicated position.  Now type `M-x calc-split'.  This
X! moves most of the text out of `calc-ext.el' and into other files.  All
X! necessary `autoload' commands are inserted into `calc-ext.el'.
X  
X  The `calc-split' command prompts for a directory name; the new files are
X  placed in this directory, and the `autoload' commands are written to
X--- 117,164 ----
X  Splitting `calc-ext'
X  ====================
X  
X! On the other hand, you may find that `calc.el' and `calc-ext.el' are too
X! big to load quickly.  You can split the Calculator into still more parts
X! using the `calc-install' or `calc-split' commands.  The former command
X! does everything necessary to split Calc in a typical installation.
X! Simply use `M-x cd' to change to the directory where you have installed
X! `calc.el' and `calc-ext.el'.  Now use `M-x load-file' to load `calc.el'.
X! Finally, type `M-x calc-install'.  This command will split the two
X! original Calc files into many smaller, quick-loading parts.  It will
X! then byte-compile all of those parts for you.  This process
X! automatically inserts the necessary `autoload' commands into `calc.el'
X! and the `calc-ext.el' to refer to the parts of them that were moved to
X! other files.  These `autoload' commands point to the directory you did
X! your `calc-install' in, so if you move Calc to a new home you'll have to
X! do the `calc-install' over again there.  Note that you will still need
X! to install the `autoload' commands shown above so that Emacs can find
X! the two main Calc files.
X! 
X! The `calc-install' command also formats the manual, assuming
X! you have placed `calc.texinfo' in the same directory.
X! 
X! If you'd rather split and compile the Calculator from the Unix shell
X! or a Makefile, you can use the command
X! 
X!      cd ... ; emacs -batch -l calc.el -f calc-install
X! 
X! where again `...' represents the directory where Calc resides.
X! 
X! Note that when patches are made available for new versions of Calc, they
X! will refer to the old, unsplit version of the files `calc.el' and
X! `calc-ext.el'.  The `calc-install' command makes copies of these under
X! the names `calc.elX' and `calc-ext.elX'; be sure to keep them around so
X! you can rename them back to `calc.el' and `calc-ext.el' before
X! installing new patches.  You can then re-split your updated version of
X! Calc with another `calc-install' command.
X! 
X! 
X! The `calc-split' command gives you better control over the splitting
X! process.  To use it, type `C-x C-f' to load `calc-ext.el'.  Move to the
X! end of the buffer and type `C-x C-e' at the indicated position.  Now
X! type `M-x calc-split'.  This moves most of the text out of `calc-ext.el'
X! and into other files.  You can now load `calc.el' and give another
X! `calc-split' command in it to complete the splitting process.
X  
X  The `calc-split' command prompts for a directory name; the new files are
X  placed in this directory, and the `autoload' commands are written to
X***************
X*** 88,95 ****
X  the default directory name and enter a blank name, in which case the
X  `autoload' commands will be written without directory names on the
X  assumption that Emacs can find the Calc files in one of the default
X! places.  Some people prefer to put the Calc files in a subdirectory by
X! themselves.
X  
X  The `calc-split' command also offers to byte-compile all Calc files
X  automatically.  Note that `calc.el' must have been byte-compiled and
X--- 166,174 ----
X  the default directory name and enter a blank name, in which case the
X  `autoload' commands will be written without directory names on the
X  assumption that Emacs can find the Calc files in one of the default
X! places, such as the main `emacs/lisp' directory.  Some people prefer
X! instead to put the Calc files in a subdirectory of their own, in which
X! case you should answer with that directory's name.
X  
X  The `calc-split' command also offers to byte-compile all Calc files
X  automatically.  Note that `calc.el' must have been byte-compiled and
X***************
X*** 96,120 ****
X  loaded already, just as if you were compiling `calc-ext' whole.  If you
X  choose to compile by hand, you will need to compile `calc.el' first,
X  load it, compile the new `calc-ext.el' and load it, then compile each of
X! the new component files.  Also, note that the `autoload' commands shown
X! above are still correct for use in your startup file.
X  
X! If you do decide to use `calc-split', note that when patches are made
X! available for new versions of Calc, they will refer to the old, unsplit
X! version of the file `calc-ext.el'.  The `calc-split' command makes a
X! copy of this under the name `calc-old.el'; be sure to keep it around so
X! you can rename it back to `calc-ext.el' before installing new patches.
X! You can then use `calc-split' again to re-split your updated version of
X! Calc.
X  
X  
X  Key Bindings
X  ============
X  
X! You may wish to bind the `calc' command to a key.  The
X! recommended keystroke is `M-#' (i.e., Meta-Shift-3).  To set up
X! this key binding, include this command in your `.emacs' or
X! `lisp/default' file:
X  
X       (global-set-key "\e#" 'calc)
X  
X--- 175,193 ----
X  loaded already, just as if you were compiling `calc-ext' whole.  If you
X  choose to compile by hand, you will need to compile `calc.el' first,
X  load it, compile the new `calc-ext.el' and load it, then compile each of
X! the new component files.  If you are using `calc-install' this is all
X! handled for you.
X  
X! The `calc-install' command basically does all of the above steps for
X! you, first for `calc.el', then for `calc-ext.el'.
X  
X  
X  Key Bindings
X  ============
X  
X! You may wish to bind the `calc' command to a key.  The recommended
X! keystroke is `M-#' (i.e., Meta-Shift-3).  To set up this key binding,
X! include this command in your `.emacs' or `lisp/default' file:
X  
X       (global-set-key "\e#" 'calc)
X  
X***************
X*** 121,126 ****
X--- 194,207 ----
X  There are no standard key assignments for `quick-calc' and
X  `calc-grab-region', but you may wish to define some.
X  
X+ Another key binding issue is the DEL key.  Some installations
X+ use a different key (such as backspace) for this purpose.  Calc
X+ normally scans the entire keymap and maps all keys defined like
X+ DEL to the `calc-pop' command.  However, this may be
X+ slow.  You can set the variable `calc-scan-for-dels' to
X+ `nil' to cause only the actual DEL key to be mapped to
X+ `calc-pop'; this will speed loading of Calc.
X+ 
X  
X  The `macedit' Package
X  =====================
X***************
X*** 131,150 ****
X  use it to edit user commands that have been defined by keyboard macros.
X  To autoload it, you will want to include the commands,
X  
X!      (autoload 'edit-kbd-macro      ".../macedit.elc" "Edit Keyboard Macro" t nil)
X!      (autoload 'edit-last-kbd-macro ".../macedit.elc" "Edit Keyboard Macro" t nil)
X  
X  
X  Documentation
X  =============
X  
X  The documentation for Calc (i.e., this manual) comes in a file
X! `calc.texinfo'.  To format this for use as an on-line manual,
X! open this file for editing in Emacs and give the command
X  `M-x texinfo-format-buffer'.  When this finishes, type `C-x C-s'
X  to save.  The result will be a collection of files whose names begin
X! with `calc-info'.  You can also format this into a printable
X! document using TeX, but beware, the manual is about 170 printed pages!
X  
X  There is a Lisp variable called `calc-info-filename' which holds
X  the name of the Info file containing Calc's on-line documentation.
X--- 212,244 ----
X  use it to edit user commands that have been defined by keyboard macros.
X  To autoload it, you will want to include the commands,
X  
X!      (autoload 'edit-kbd-macro      ".../macedit.elc" "Edit Keyboard Macro" t)
X!      (autoload 'edit-last-kbd-macro ".../macedit.elc" "Edit Keyboard Macro" t)
X!      (autoload 'read-kbd-macro      ".../macedit.elc" "Read Keyboard Macro" t)
X  
X  
X+ The GNUPLOT Program
X+ ===================
X+ 
X+ Calc's graphing commands use the GNUPLOT program.  If you have GNUPLOT
X+ but you must type some command other than `gnuplot' to get it, you
X+ should add a command to set the Lisp variable `calc-gnuplot-name' to the
X+ appropriate file name.  You may also need to change the variables
X+ `calc-gnuplot-plot-command' and `calc-gnuplot-print-command' in order to
X+ get correct displays and hardcopies, respectively, of your plots.
X+ 
X+ 
X  Documentation
X  =============
X  
X  The documentation for Calc (i.e., this manual) comes in a file
X! `calc.texinfo'.  To format this for use as an on-line manual, open
X! this file for editing in Emacs (with `C-x C-f') and give the command
X  `M-x texinfo-format-buffer'.  When this finishes, type `C-x C-s'
X  to save.  The result will be a collection of files whose names begin
X! with `calc-info'.  The `calc-install' command does this for you.
X! You can also format this into a printable document using TeX,
X! but beware, the manual is almost 300 printed pages!
X  
X  There is a Lisp variable called `calc-info-filename' which holds
X  the name of the Info file containing Calc's on-line documentation.
X***************
X*** 155,161 ****
X       (setq calc-info-filename ".../calc-info")
X  
X  in your `.emacs' or `lisp/default' file, where again `...'
X! represents the directory containing the Info files.
X  
X  
X  Settings File
X--- 249,256 ----
X       (setq calc-info-filename ".../calc-info")
X  
X  in your `.emacs' or `lisp/default' file, where again `...'
X! represents the directory containing the Info files.  Again, if you
X! use `calc-install' this is handled for you.
X  
X  
X  Settings File
X***************
X*** 178,185 ****
X  `i' to make sure Calc can find its Info documentation.  Press `q'
X  to exit the Info system and `M-#' to re-enter the Calculator.
X  Type `20 S' to compute the sine of 20 degrees; this will test the
X! autoloading of the extensions module.  The result should be 0.342020143326.
X  Finally, press `M-#' again to make sure the Calculator can exit.
X  
X  (The above text is included in both the Calc documentation and the
X! file INSTALL in the Calc distribution directory.)
X--- 273,285 ----
X  `i' to make sure Calc can find its Info documentation.  Press `q'
X  to exit the Info system and `M-#' to re-enter the Calculator.
X  Type `20 S' to compute the sine of 20 degrees; this will test the
X! autoloading of the extensions module (and the split submodules, if you
X! have used this feature).  The result should be 0.342020143326.
X  Finally, press `M-#' again to make sure the Calculator can exit.
X  
X+ You may also wish to test the GNUPLOT interface; to plot a sine wave,
X+ type `' [0 .. 360], sin(x) RET g f'.
X+ 
X+ 
X  (The above text is included in both the Calc documentation and the
X! file calc-INSTALL in the Calc distribution directory.)
X*** calc.texinfo	Mon Aug  6 15:05:36 1990
X--- ../dist/calc.texinfo	Tue Oct  9 16:54:30 1990
X***************
X*** 1,7 ****
X  \input texinfo                  @c -*-texinfo-*-
X  @comment %**start of header (This is for running Texinfo on a region.)
X  @setfilename calc-info
X! @settitle GNU Emacs Calc 1.04 Manual
X  @setchapternewpage odd
X  @comment %**end of header (This is for running Texinfo on a region.)
X  
X--- 1,7 ----
X  \input texinfo                  @c -*-texinfo-*-
X  @comment %**start of header (This is for running Texinfo on a region.)
X  @setfilename calc-info
X! @settitle GNU Emacs Calc 1.05 Manual
X  @setchapternewpage odd
X  @comment %**end of header (This is for running Texinfo on a region.)
X  
X***************
X*** 38,46 ****
X  @sp 6
X  @center @titlefont{Calc Manual}
X  @sp 4
X! @center GNU Emacs Calc Version 1.04
X  @sp 1
X! @center July 1990
X  @sp 5
X  @center Dave Gillespie
X  @page
X--- 38,46 ----
X  @sp 6
X  @center @titlefont{Calc Manual}
X  @sp 4
X! @center GNU Emacs Calc Version 1.05
X  @sp 1
X! @center October 1990
X  @sp 5
X  @center Dave Gillespie
X  @page
X***************
X*** 73,83 ****
X  @end titlepage
X  
X  @ifinfo
X! @node Top, Introduction,, (dir)
X  @ichapter The GNU Emacs Calculator
X  
X! @dfn{Calc} is an advanced desk calculator and mathematical tool that runs
X! as part of the GNU Emacs environment.
X  
X  This manual is divided into two major parts, the Tutorial and the
X  Reference.  The Tutorial introduces all the major aspects of Calculator
X--- 73,83 ----
X  @end titlepage
X  
X  @ifinfo
X! @node Top, Quick Overview,, (dir)
X  @ichapter The GNU Emacs Calculator
X  
X! @dfn{Calc 1.05} is an advanced desk calculator and mathematical tool
X! that runs as part of the GNU Emacs environment.
X  
X  This manual is divided into two major parts, the Tutorial and the
X  Reference.  The Tutorial introduces all the major aspects of Calculator
X***************
X*** 99,104 ****
X--- 99,105 ----
X  * Scientific Functions::  Trancendentals and other scientific functions.
X  * Binary Functions::	  Bitwise operations on integers.
X  * Matrix Functions::	  Operations on vectors and matrices.
X+ * Graphics::		  Commands for making graphs of data.
X  * Algebra::	          Manipulating expressions algebraically.
X  * Units::	          Operations on numbers with units.
X  * Store and Recall::	  Storing and recalling variables.
X***************
X*** 342,348 ****
X  ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
X  @end enumerate
X  
X! @node Introduction, Data Types, Quick Overview, Top
X  @chapter Introduction
X  
X  @dfn{Calc} is an advanced calculator and mathematical tool that runs as
X--- 343,349 ----
X  ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
X  @end enumerate
X  
X! @node Introduction, Data Types, Tutorial, Top
X  @chapter Introduction
X  
X  @dfn{Calc} is an advanced calculator and mathematical tool that runs as
X***************
X*** 370,375 ****
X--- 371,378 ----
X  @item
X  Kill and yank to and from regular editing buffers.
X  @item
X+ Graphics using GNUPLOT, a versatile (and free) plotting program.
X+ @item
X  Easy programming using keyboard macros, algebraic formulas,
X  algebraic rewrite rules, or Lisp code.
X  @end itemize
X***************
X*** 384,389 ****
X--- 387,394 ----
X  But Calc has the advantages of convenience, portability, and availability
X  of the source code.  And, of course, it's free!
X  
X+ @xref{Installation}, for instructions on setting up and installing Calc.
X+ 
X  @pindex calc
X  @pindex calc-mode
X  @cindex Starting the Calculator
X***************
X*** 437,446 ****
X--- 442,458 ----
X  routines can use @samp{(calc 0)} or @samp{(calc 1)} to auto-load the
X  Calculator.  (Also, @pxref{Grabbing From Buffers}.)@refill
X  
X+ @pindex full-calc
X+ You can also type @kbd{M-x full-calc} to get a Calculator that uses
X+ the full height of the Emacs screen.  From the Unix shell you can
X+ type @samp{emacs -f full-calc} to start a new Emacs specifically for
X+ use as a calculator.
X+ 
X  @kindex ?
X  @kindex h
X  @kindex i
X  @pindex calc-help
X+ @pindex calc-full-help
X  @pindex calc-info
X  @cindex Help commands
X  The @kbd{?} key (@code{calc-help}) displays a series of brief help messages.
X***************
X*** 448,458 ****
X  @key{ESC} and @kbd{C-x} prefixes.  You can type
X  @kbd{?} after a prefix to see a list of commands beginning with that
X  prefix.  (If the message includes @samp{[MORE]}, press @kbd{?} again
X! to see additional commands for that prefix.)  Also, @kbd{h}
X! (@code{describe-mode}) calls up more complete help
X! information on the Calculator in another window, and
X! @kbd{i} (@code{calc-info}) runs the Emacs Info system to read this
X! manual on-line.@refill
X  
X  @kindex q
X  @pindex calc-quit
X--- 460,471 ----
X  @key{ESC} and @kbd{C-x} prefixes.  You can type
X  @kbd{?} after a prefix to see a list of commands beginning with that
X  prefix.  (If the message includes @samp{[MORE]}, press @kbd{?} again
X! to see additional commands for that prefix.)  To see all the various
X! sets of @kbd{?} messages at once, you can press @kbd{h}
X! (@code{calc-full-help}).  The result of this command, when printed,
X! makes a handy sort of ``quick-reference card.''  Finally, @kbd{i}
X! (@code{calc-info}) runs the Emacs Info system to read this manual
X! on-line.@refill
X  
X  @kindex q
X  @pindex calc-quit
X***************
X*** 467,480 ****
X  
X  @kindex d ~
X  @pindex calc-refresh
X- @kindex d `
X- @pindex calc-realign
X  @cindex Refreshing a garbled display
X  @cindex Garbled displays, refreshing
X  The @kbd{d ~} key sequence (@code{calc-refresh}) redraws the contents of
X  the Calculator buffer from memory.  Use this if the contents of the
X! buffer have been damaged somehow.  The @kbd{o} key and @kbd{d `} key
X! (@code{calc-realign}) move the cursor back to its ``home'' position at
X  the bottom of the Calculator buffer.@refill
X  
X  @kindex <
X--- 480,491 ----
X  
X  @kindex d ~
X  @pindex calc-refresh
X  @cindex Refreshing a garbled display
X  @cindex Garbled displays, refreshing
X  The @kbd{d ~} key sequence (@code{calc-refresh}) redraws the contents of
X  the Calculator buffer from memory.  Use this if the contents of the
X! buffer have been damaged somehow.  The @kbd{o} key (@code{calc-realign})
X! moves the cursor back to its ``home'' position at
X  the bottom of the Calculator buffer.@refill
X  
X  @kindex <
X***************
X*** 554,592 ****
X  numbers are computed to the current precision, which may be arbitrarily
X  large.  Press @kbd{p} to set the current precision.
X  
X! Erroneous calculations such as dividing 1 by 0 simply leave an
X  unsimplified formula (like @samp{1 / 0}) on the stack.  If the
X  Calculator leaves a formula unsimplified, press @kbd{w} to see why.
X  Press @kbd{d w} to enable a mode where this happens automatically.
X  
X  Press @kbd{?} for a brief summary of Calculator commands.  Press @kbd{?}
X! repeatedly to cycle among the lines of the summary.
X  
X! Press @kbd{d ?} for a list of commands for changing the display format.
X! For example, @kbd{d f} sets fixed-point notation.  (After you type @kbd{?}
X! the Calculator is still waiting for a key to complete the @samp{d} sequence;
X! type @kbd{C-g} to cancel the prefix.)
X  
X  Press @kbd{m ?} for a list of other mode-setting commands.  Press @kbd{m m}
X  to save all current mode settings in your @file{.emacs} file.
X  
X! Press @kbd{c ?} for a list of commands for numeric conversions, such as
X! degrees-to-radians and back.
X! 
X! Press @kbd{b ?} for a list of binary-arithmetic commands.  (Press @kbd{d 2}
X! or @kbd{d 0} to switch between binary and decimal display of integers.)
X! Press @kbd{b w} to see or change the current word size for binary operations.
X! 
X! Press @kbd{a ?} for a list of commands for manipulating algebraic formulas.
X  
X- Press @kbd{v ?} for a list of commands for manipulating vectors and
X- matrices.
X- 
X- Press @kbd{k ?} for a list of commands related to number theory and
X- combinatorial analysis.
X- 
X- Press @kbd{t ?} for a list of commands for manipulating the trail.
X- 
X  Press @kbd{Z ?} for a list of commands for defining your own commands.
X  Press @kbd{z ?} for a list of commands you have defined.
X  
X--- 565,592 ----
X  numbers are computed to the current precision, which may be arbitrarily
X  large.  Press @kbd{p} to set the current precision.
X  
X! Erroneous calculations such as dividing 1 by 0 leave an
X  unsimplified formula (like @samp{1 / 0}) on the stack.  If the
X  Calculator leaves a formula unsimplified, press @kbd{w} to see why.
X  Press @kbd{d w} to enable a mode where this happens automatically.
X  
X  Press @kbd{?} for a brief summary of Calculator commands.  Press @kbd{?}
X! repeatedly to cycle among the lines of the summary.  Press @kbd{h} to
X! see the whole summary at once.
X  
X! Press @kbd{f ?} for a list of commands for additional math functions.
X! (After you type @kbd{?} the Calculator is still waiting for a key to
X! complete the @samp{f} sequence; type @kbd{C-g} to cancel the prefix.)
X  
X+ Press @kbd{d ?} for a list of commands for changing the display format.
X  Press @kbd{m ?} for a list of other mode-setting commands.  Press @kbd{m m}
X  to save all current mode settings in your @file{.emacs} file.
X  
X! Other prefixes are @kbd{c} (numeric conversions), @kbd{b} (binary
X! arithmetic), @kbd{a} (algebra), @kbd{j} (selecting sub-formulas),
X! @kbd{v} (vectors and matrices), @kbd{k} (combinatorics, statistics,
X! and number theory), @kbd{g} (graphics), and @kbd{t} (manipulating the trail).
X  
X  Press @kbd{Z ?} for a list of commands for defining your own commands.
X  Press @kbd{z ?} for a list of commands you have defined.
X  
X***************
X*** 596,601 ****
X--- 596,602 ----
X  Press @kbd{y} to copy the top number on the stack into the most recently
X  used editing buffer.  Use @kbd{M-x calc-grab-region} or @kbd{C-u - M-#}
X  in an editing buffer to transfer a region of data to the Calculator stack.
X+ @xref{List Tutorial}, for examples of its use.
X  
X  @node Tutorial, Introduction, Quick Overview, Top
X  @chapter Tutorial
X***************
X*** 627,632 ****
X--- 628,635 ----
X  * Types Tutorial::
X  * Algebra Tutorial::
X  * Programming Tutorial::
X+ 
X+ * Answers to Exercises::
X  @end menu
X  
X  @node Basic Tutorial, Arithmetic Tutorial, Tutorial, Tutorial
X***************
X*** 634,640 ****
X  
X  In this section, we learn how to turn the Calculator on and off, how
X  RPN and algebraic-style calculations work, and how to undo and redo
X! an operation made by mistake.
X  
X  @menu
X  * On and Off Tutorial::     Turning Calc on and off.
X--- 637,643 ----
X  
X  In this section, we learn how to turn the Calculator on and off, how
X  RPN and algebraic-style calculations work, and how to undo and redo
X! an operation done by mistake.
X  
X  @menu
X  * On and Off Tutorial::     Turning Calc on and off.
X***************
X*** 706,711 ****
X--- 709,716 ----
X  stack, and numbers are normally only removed from the top of the
X  stack.@refill
X  
X+ @cindex Operators
X+ @cindex Operands
X  In an operation like @samp{2+3}, the 2 and 3 are called the @dfn{operands}
X  and the @samp{+} is the @dfn{operator}.  In an RPN calculator you always
X  enter the operands first, then the operator.  Each time you type a
X***************
X*** 713,721 ****
X  When you press an operator key like @kbd{+}, Calc pops the appropriate
X  number of operands from the stack and pushes back the result.
X  
X! Thus we could add the numbers 2 and 3 in an RPN calculator by typing the
X! keys: @kbd{2 @key{RET} 3 @key{RET} +}.  (@key{RET} corresponds to the
X! @key{ENTER} key on traditional RPN calculators.)  The first four
X  keystrokes ``push'' the numbers 2 and 3 onto the stack.  The @kbd{+} key
X  ``pops'' the top two numbers from the stack, adds them, and pushes the
X  result (5) back onto the stack.  Here's how the stack will look at
X--- 718,726 ----
X  When you press an operator key like @kbd{+}, Calc pops the appropriate
X  number of operands from the stack and pushes back the result.
X  
X! Thus we could add the numbers 2 and 3 in an RPN calculator by typing:
X! @kbd{2 @key{RET} 3 @key{RET} +}.  (The @key{RET} key, Return, corresponds to
X! the @key{ENTER} key on traditional RPN calculators.)  The first four
X  keystrokes ``push'' the numbers 2 and 3 onto the stack.  The @kbd{+} key
X  ``pops'' the top two numbers from the stack, adds them, and pushes the
X  result (5) back onto the stack.  Here's how the stack will look at
X***************
X*** 736,741 ****
X--- 741,748 ----
X  the Stack window.  This may seem backwards, but it turns out to be
X  less distracting in regular use.
X  
X+ @cindex Stack levels
X+ @cindex Levels of stack
X  The numbers @samp{1:} and @samp{2:} on the left are @dfn{stack level
X  numbers}.  Old RPN calculators always had four stack levels called
X  @code{x}, @code{y}, @code{z}, and @code{t}.  Calc's stack can grow
X***************
X*** 777,782 ****
X--- 784,805 ----
X  with @samp{Calc: 3} in the minibuffer.  In these situations, you can
X  press the optional @key{RET} to see the stack as the figure shows.
X  
X+ (@bullet) @strong{Exercise 1.}  (This tutorial will include exercises
X+ at various points.  Try them if you wish.  Answers to all the exercises
X+ are located at the end of the Tutorial chapter.  Each exercise will
X+ include a cross-reference to its particular answer.  If you are
X+ reading with the Emacs Info system, press @kbd{f} and the
X+ exercise number to go to the answer, then the letter @kbd{l} to
X+ return to where you were.)
X+ 
X+ First exercise:  What will the keystrokes @kbd{1 @key{RET} 2 @key{RET}
X+ 3 @key{RET} 4 + * -} compute?  (@samp{*} is the symbol for multiplication.)
X+ Figure it out by hand, then try it with Calc to see if you're right.
X+ @xref{RPN Answer 1, 1}. (@bullet)
X+ 
X+ (@bullet) @strong{Exercise 2.}  Compute @samp{2*4 + 7*9.5 + 5/4} using the
X+ stack.  @xref{RPN Answer 2, 2}. (@bullet)
X+ 
X  The @key{DEL} key is called Backspace on some keyboards.  It is
X  whatever key you would use to correct a simple typing error when
X  regularly using Emacs.  The @key{DEL} key pops and throws away the
X***************
X*** 784,790 ****
X  the Trail if you should need it later on.)  There are many places
X  in this tutorial where we assume you have used @key{DEL} to erase the
X  results of the previous example at the beginning of a new example.
X! In the few places that it is really important to use @key{DEL} to
X  clear away old results, the text will remind you to do so.
X  
X  Since the @kbd{-} key is also an operator (it subtracts the top two
X--- 807,813 ----
X  the Trail if you should need it later on.)  There are many places
X  in this tutorial where we assume you have used @key{DEL} to erase the
X  results of the previous example at the beginning of a new example.
X! In the few places where it is really important to use @key{DEL} to
X  clear away old results, the text will remind you to do so.
X  
X  Since the @kbd{-} key is also an operator (it subtracts the top two
X***************
X*** 797,802 ****
X--- 820,826 ----
X  the number at the top of the stack (or the number being entered)
X  from positive to negative or vice-versa.
X  
X+ @cindex Duplicating a stack entry
X  If you press @key{RET} when you're not entering a number, the effect
X  is to duplicate the top number on the stack.  Consider this calculation:
X  
X***************
X*** 817,822 ****
X--- 841,847 ----
X  as @key{RET}; you could replace all three occurrences of @key{RET} in
X  the above example with @key{SPC} and the effect would be the same.
X  
X+ @cindex Exchanging stack entries
X  Another stack manipulation key is @key{TAB}.  This exchanges the top
X  two stack entries.  Suppose you have computed @kbd{2 @key{RET} 3 +}
X  to get 5, and then you realize what you really wanted to compute
X***************
X*** 860,865 ****
X--- 885,895 ----
X  @end example
X  @end group
X  
X+ (@bullet) @strong{Exercise 3.} Suppose the numbers 10, 20, and 30 are
X+ on the stack.  Figure out how to add one to the number in level 2
X+ without affecting the rest of the stack.  Also figure out how to add
X+ one to the number in level 3.  @xref{RPN Answer 3, 3}. (@bullet)
X+ 
X  Operations like @kbd{+}, @kbd{-}, @kbd{*}, @kbd{/}, and @kbd{^} pop two
X  arguments from the stack and push a result.  Operations like @kbd{n} and
X  @kbd{Q} (square root) pop a single number and push the result.  You can
X***************
X*** 875,883 ****
X  @end example
X  @end group
X  
X  Here we use the Pythagorean Theorem to determine the hypotenuse of a
X! right triangle.  Calc actually has a built-in command for that, but
X! it isn't on any key.  Thus you must enter it using @kbd{M-x} notation:
X  
X  @group
X  @example
X--- 905,918 ----
X  @end example
X  @end group
X  
X+ (Note that capital @kbd{Q} means to hold down the Shift key while
X+ typing @kbd{q}.  Remember, plain unshifted @kbd{q} is the Quit command.)
X+ 
X+ @cindex Pythagorean Theorem
X  Here we use the Pythagorean Theorem to determine the hypotenuse of a
X! right triangle.  Calc actually has a built-in command for that called
X! @kbd{f h}, but let's suppose we can't remember the necessary keystrokes.
X! We can still enter it by its full name using @kbd{M-x} notation:
X  
X  @group
X  @example
X***************
X*** 910,916 ****
X  @example
X  1:  4          1:  -4         1:  (0, 2)
X      .              .              .
X-                    .
X  
X    4 RET            n              Q
X  @end example
X--- 945,950 ----
X***************
X*** 934,940 ****
X  @example
X  1:  ( ...      2:  ( ...      1:  (2, ...    1:  (2, ...    1:  (2, 3)
X      .          1:  2              .              3              .
X!                                                  .
X  
X      (              2              ,              3              )
X  @end example
X--- 968,974 ----
X  @example
X  1:  ( ...      2:  ( ...      1:  (2, ...    1:  (2, ...    1:  (2, 3)
X      .          1:  2              .              3              .
X!                    .                             .
X  
X      (              2              ,              3              )
X  @end example
X***************
X*** 947,953 ****
X  @example
X  1:  ( ...      2:  ( ...      3:  ( ...      1:  ( ...      1:  ( ...
X      .          1:  2          2:  2              5              5
X!                               1:  3              .              .
X                                    .
X                                                               (error)
X      (             2 RET           3              +              +
X--- 981,987 ----
X  @example
X  1:  ( ...      2:  ( ...      3:  ( ...      1:  ( ...      1:  ( ...
X      .          1:  2          2:  2              5              5
X!                    .          1:  3              .              .
X                                    .
X                                                               (error)
X      (             2 RET           3              +              +
X***************
X*** 974,980 ****
X  Note that the @kbd{,} (comma) key did not have to be used here.
X  When you press @kbd{)} all the stack entries between the incomplete
X  entry and the top are collected, so there's never really a reason
X! to use @kbd{,}.  It's up to you.
X  
X  Vectors are entered the same way as complex numbers, but with square
X  brackets in place of parentheses.  We'll meet vectors again later in
X--- 1008,1020 ----
X  Note that the @kbd{,} (comma) key did not have to be used here.
X  When you press @kbd{)} all the stack entries between the incomplete
X  entry and the top are collected, so there's never really a reason
X! to use the comma.  It's up to you.
X! 
X! (@bullet) @strong{Exercise 4.}  To enter the complex number @samp{(2, 3)},
X! your friend Joe typed @kbd{( 2 , @key{SPC} 3 )}.  What happened?
X! (Joe thought of a clever way to correct his mistake in only two
X! keystrokes, but it didn't quite work.  Try it to find out why.)
X! @xref{RPN Answer 4, 4}. (@bullet)
X  
X  Vectors are entered the same way as complex numbers, but with square
X  brackets in place of parentheses.  We'll meet vectors again later in
X***************
X*** 1017,1022 ****
X--- 1057,1064 ----
X  @end example
X  @end group
X  
X+ @cindex Clearing the stack
X+ @cindex Emptying the stack
X  Another common idiom is @kbd{M-0 DEL}, which clears the stack.
X  (The @kbd{M-0} numeric prefix tells @key{DEL} to operate on the
X  entire stack.)
X***************
X*** 1073,1079 ****
X  
X  Calc's order of evaluation is the same as for most computer languages,
X  except that @samp{*} binds more strongly than @samp{/}, as the above
X! example shows.
X  
X  Operators at the same level are evaluated from left to right, except
X  that @samp{^} is evaluated from right to left.  Thus, @samp{2-3-4} is
X--- 1115,1122 ----
X  
X  Calc's order of evaluation is the same as for most computer languages,
X  except that @samp{*} binds more strongly than @samp{/}, as the above
X! example shows.  As in normal mathematical notation, the @samp{*} symbol
X! can often be omitted:  @samp{2 a} is the same as @samp{2*a}.
X  
X  Operators at the same level are evaluated from left to right, except
X  that @samp{^} is evaluated from right to left.  Thus, @samp{2-3-4} is
X***************
X*** 1127,1132 ****
X--- 1170,1179 ----
X  an apostrophe first, but it also means we need to press @key{RET}
X  after every entry, even for a simple number like @samp{1}.
X  
X+ (You can type @kbd{C-u m a} to enable a special ``incomplete algebraic
X+ mode'' in which the @kbd{(} and @kbd{[} keys use algebraic entry even
X+ though regular numeric keys still use numeric entry.)
X+ 
X  Press @kbd{m a} again to leave algebraic mode.
X  
X  Actual non-RPN calculators use a mixture of algebraic and RPN styles.
X***************
X*** 1153,1158 ****
X--- 1200,1210 ----
X  Notice that we didn't need to press an apostrophe for the @kbd{$+1},
X  because the dollar sign always begins an algebraic entry.
X  
X+ (@bullet) @strong{Exercise 1.}  How could you get the same effect as
X+ pressing @kbd{Q} but using an algebraic entry instead?  How about
X+ if the @kbd{Q} key on your keyboard were broken?
X+ @xref{Algebraic Answer 1, 1}. (@bullet)
X+ 
X  Algebraic formulas can include @dfn{variables}.  To store in a
X  variable, press @kbd{s}, then type the variable name, then press
X  @key{RET}.  A variable name should consist of one or more letters
X***************
X*** 1206,1212 ****
X  
X  @group
X  @example
X! 1:  2. + log10(0) + log10(5, 6) + foo(3)
X      .
X  
X   ' log10(100) + log10(0) + log10(5,6) + foo(3) RET
X--- 1258,1264 ----
X  
X  @group
X  @example
X! 1:  2 + log10(0) + log10(5, 6) + foo(3)
X      .
X  
X   ' log10(100) + log10(0) + log10(5,6) + foo(3) RET
X***************
X*** 1222,1227 ****
X--- 1274,1289 ----
X  Pressing @kbd{w} the first time will report the too-many-arguments
X  problem; pressing it again will report the logarithm-of-zero problem.
X  
X+ (@bullet) @strong{Exercise 2.}  Joe entered the formula @samp{2 x y},
X+ stored 5 in @samp{x}, pressed @kbd{=}, and got the expected result,
X+ @samp{10 y}.  He then tried the same for the formula @samp{2 x (1+y)},
X+ expecting @samp{10 (1+y)}, but it didn't work.  Why not?
X+ @xref{Algebraic Answer 2, 2}. (@bullet)
X+ 
X+ (@bullet) @strong{Exercise 3.}  What result would you expect
X+ @kbd{1 @key{RET} 0 /} to give?  What if you then type @kbd{0 *}?
X+ @xref{Algebraic Answer 3, 3}. (@bullet)
X+ 
X  We will encounter formulas involving variables and functions again
X  when we discuss the algebra and calculus features of the Calculator.
X  
X***************
X*** 1270,1278 ****
X  @end example
X  @end group
X  
X! We are unable to redo past the @samp{6}, since that was placed there
X  by something other than an undo command.
X  
X  You can think of undo and redo as a sort of ``time machine.''  Press
X  @kbd{U} to go backward in time, @kbd{D} to go forward.  If you go
X  backward and do something (like @kbd{*}) then, as any science fiction
X--- 1332,1341 ----
X  @end example
X  @end group
X  
X! It is not possible to redo past the @samp{6}, since that was placed there
X  by something other than an undo command.
X  
X+ @cindex Time travel
X  You can think of undo and redo as a sort of ``time machine.''  Press
X  @kbd{U} to go backward in time, @kbd{D} to go forward.  If you go
X  backward and do something (like @kbd{*}) then, as any science fiction
X***************
X*** 1306,1317 ****
X  incremental search; you can now press @kbd{C-s} or @kbd{C-r} to
X  continue the search forwards or backwards as you like.
X  
X! To finish the search, press @key{ESC} (or @kbd{C-[} if your keyboard
X! doesn't have @key{ESC}).  This halts the incremental search and
X! leaves the trail pointer at the thing we found.  Now we can type
X! @kbd{t y} to yank that number onto the stack.  If we hadn't
X  remembered the ``241'', we could simply have searched for @kbd{2^3^4},
X! then pressed @kbd{ESC t n} to halt and then move to the next item.
X  
X  You may have noticed that all the trail-related commands begin with
X  the letter @kbd{t}.  Calc has so many commands that there aren't
X--- 1369,1379 ----
X  incremental search; you can now press @kbd{C-s} or @kbd{C-r} to
X  continue the search forwards or backwards as you like.
X  
X! To finish the search, press @key{RET}.  This halts the incremental
X! search and leaves the trail pointer at the thing we found.  Now we
X! can type @kbd{t y} to yank that number onto the stack.  If we hadn't
X  remembered the ``241'', we could simply have searched for @kbd{2^3^4},
X! then pressed @kbd{@key{RET} t n} to halt and then move to the next item.
X  
X  You may have noticed that all the trail-related commands begin with
X  the letter @kbd{t}.  Calc has so many commands that there aren't
X***************
X*** 1352,1360 ****
X  @samp{pi}, it's got several errors.  Press @kbd{`} to edit this number.
X  Now use the normal Emacs cursor motion and editing keys to change
X  the second 4 to a 5, and to transpose the 3 and the 9.  When you
X! press @key{RET}, the number of the stack will be replaced by your
X  new number.  This also works for formulas, vectors, and other types
X! of values you can put on the stack.
X  
X  @node Modes Tutorial, , Undo Tutorial, Basic Tutorial
X  @subsection Mode-Setting Commands
X--- 1414,1423 ----
X  @samp{pi}, it's got several errors.  Press @kbd{`} to edit this number.
X  Now use the normal Emacs cursor motion and editing keys to change
X  the second 4 to a 5, and to transpose the 3 and the 9.  When you
X! press @key{RET}, the number on the stack will be replaced by your
X  new number.  This also works for formulas, vectors, and other types
X! of values you can put on the stack.  The @kbd{`} key also works
X! during entry of a number or algebraic formula.
X  
X  @node Modes Tutorial, , Undo Tutorial, Basic Tutorial
X  @subsection Mode-Setting Commands
X***************
X*** 1430,1435 ****
X--- 1493,1502 ----
X  use floating-point arithmetic to get the answer, not exact integer
X  arithmetic.
X  
X+ You can use the @kbd{F} (@code{calc-floor}) command to convert a
X+ floating-point value to an integer, and @kbd{c f} (@code{calc-float})
X+ to convert an integer to floating-point form.
X+ 
X  Let's try entering that last calculation:
X  
X  @group
X***************
X*** 1457,1462 ****
X--- 1524,1530 ----
X  @end example
X  @end group
X  
X+ @cindex Round-off errors
X  Hey, the answer is different!  Look closely at the middle columns
X  of the two examples.  In the first, the stack contained the
X  exact integer @samp{10000}, but in the second it contained
X***************
X*** 1485,1490 ****
X--- 1553,1559 ----
X  accurate; in fact, the result was only off by one unit in the
X  last place.
X  
X+ @cindex Guard digits
X  Calc does many of its internal calculations to a slightly higher
X  precision, but it doesn't always bump the precision up enough.
X  In each case, Calc added about two digits of precision during
X***************
X*** 1535,1540 ****
X--- 1604,1610 ----
X  
X  Type @kbd{d n} now to return to the normal float format.
X  
X+ @cindex Large numbers, readability
X  Large integers have their own problems.  Let's look back at
X  the result of @kbd{2^3^4}.
X  
X***************
X*** 1630,1635 ****
X--- 1700,1713 ----
X  in whatever radix you've chosen with @kbd{d r}.  Floating-point numbers
X  are always entered and displayed in decimal.
X  
X+ @cindex Hexadecimal floating-point
X+ @cindex Floating point, non-decimal radix
X+ (@bullet) @strong{Exercise 1.}  Calc doesn't have any direct way to
X+ enter the hexadecimal floating-point number @samp{16#3A.7F}, but what if
X+ you were given this number and had to enter it anyway?  Find the square
X+ root of this number, still expressed in hexadecimal with four digits
X+ after the point.  @xref{Modes Answer 1, 1}. (@bullet)
X+ 
X  The @kbd{m} prefix key has another set of modes, relating to the way
X  Calc interprets your inputs and does computations.  Whereas @kbd{d}-prefix
X  modes generally affect the way thing look, @kbd{m}-prefix modes affect
X***************
X*** 1657,1662 ****
X--- 1735,1745 ----
X  temporarily reduces the precision by one digit while it
X  re-rounds the number on the top of the stack.
X  
X+ (@bullet) @strong{Exercise 2.}  Your friend Joe computed the sine
X+ of 45 degrees as shown above, then, hoping to avoid an inexact
X+ result, he increased the precision to 16 digits before squaring.
X+ What happened?  @xref{Modes Answer 2, 2}. (@bullet)
X+ 
X  To do this calculation in radians, we would type @kbd{m r} first.
X  (The indicator changes to @samp{Rad}.)  45 degrees corresponds to
X  @samp{pi/4} radians.  To get @samp{pi}, press the @kbd{P} key.  (Once
X***************
X*** 1668,1674 ****
X  1:  3.14159265359   1:  0.785398163398   1:  0.707106781187
X      .                   .                .
X                                          
X!     P                   4 /              S
X  @end example
X  @end group
X  
X--- 1751,1757 ----
X  1:  3.14159265359   1:  0.785398163398   1:  0.707106781187
X      .                   .                .
X                                          
X!     P                   4 /       m r    S
X  @end example
X  @end group
X  
X***************
X*** 1693,1701 ****
X  @group
X  @example
X  1:  45         1:  0.785398163396   1:  45.
X!     .              .                .
X  
X!     45             c r              c d
X  @end example
X  @end group
X  
X--- 1776,1784 ----
X  @group
X  @example
X  1:  45         1:  0.785398163396   1:  45.
X!     .              .                    .
X  
X!     45             c r                  c d
X  @end example
X  @end group
X  
X***************
X*** 1711,1723 ****
X  1:  9              .                    .
X      .
X  
X!  12 RET 9          /          m f       U /
X  @end example
X  @end group
X  
X  In the first case, we get an approximate floating-point result.
X! In the second case, we get an exact fractional result
X! (four-thirds).
X  
X  You can enter a fraction at any time using @kbd{:} notation.
X  (Calc uses @kbd{:} instead of @kbd{/} as the fraction separator
X--- 1794,1805 ----
X  1:  9              .                    .
X      .
X  
X!  12 RET 9          /          m f       U /      m f
X  @end example
X  @end group
X  
X  In the first case, we get an approximate floating-point result.
X! In the second case, we get an exact fractional result (four-thirds).
X  
X  You can enter a fraction at any time using @kbd{:} notation.
X  (Calc uses @kbd{:} instead of @kbd{/} as the fraction separator
X***************
X*** 1724,1731 ****
X  because @kbd{/} is already used to divide the top two stack
X  elements.)  Calculations involving fractions will always
X  produce exact fractional results; fraction mode only says
X! what to do when dividing integers.
X  
X  @node Arithmetic Tutorial, Vector/Matrix Tutorial, Basic Tutorial, Tutorial
X  @section Arithmetic Tutorial
X  
X--- 1806,1819 ----
X  because @kbd{/} is already used to divide the top two stack
X  elements.)  Calculations involving fractions will always
X  produce exact fractional results; fraction mode only says
X! what to do when dividing two integers.
X  
X+ @cindex Fractions vs. floats
X+ @cindex Floats vs. fractions
X+ (@bullet) @strong{Exercise 3.}  If fractional arithmetic is exact,
X+ why would you ever use floating-point numbers instead?
X+ @xref{Modes Answer 3, 3}. (@bullet)
X+ 
X  @node Arithmetic Tutorial, Vector/Matrix Tutorial, Basic Tutorial, Tutorial
X  @section Arithmetic Tutorial
X  
X***************
X*** 1746,1751 ****
X--- 1834,1840 ----
X  @end example
X  @end group
X  
X+ @cindex Binary operators
X  You can apply a ``binary operator'' like @kbd{+} across any number of
X  stack entries by giving it a numeric prefix.  You can also apply it
X  pairwise to several stack elements along with the top one if you use
X***************
X*** 1763,1768 ****
X--- 1852,1858 ----
X  @end example
X  @end group
X  
X+ @cindex Unary operators
X  You can apply a ``unary operator'' like @kbd{&} to the top @var{n}
X  stack entries with a numeric prefix, too.
X  
X***************
X*** 1826,1831 ****
X--- 1916,1927 ----
X  @end example
X  @end group
X  
X+ (@bullet) @strong{Exercise 1.}  The @kbd{\} command would appear to be a
X+ frill, since you could always do the same thing with @kbd{/ F}.  Think
X+ of a situation where this is not true---@kbd{/ F} would be inadequate.
X+ Now think of a way you could get around the problem if Calc didn't
X+ provide a @kbd{\} command.  @xref{Arithmetic Answer 1, 1}. (@bullet)
X+ 
X  We've already seen the @kbd{Q} (square root) and @kbd{S} (sine)
X  commands.  Other commands along those lines are @kbd{C} (cosine),
SHAR_EOF
echo "End of part 12, continue with part 13"
echo "13" > s2_seq_.tmp
exit 0