home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / info / calc.info-23 (.txt) < prev    next >
GNU Info File  |  1994-12-22  |  49KB  |  792 lines

  1. This is Info file calc.info, produced by Makeinfo-1.55 from the input
  2. file calc.texinfo.
  3.    This file documents Calc, the GNU Emacs calculator.
  4.    Copyright (C) 1990, 1991 Free Software Foundation, Inc.
  5.    Permission is granted to make and distribute verbatim copies of this
  6. manual provided the copyright notice and this permission notice are
  7. preserved on all copies.
  8.    Permission is granted to copy and distribute modified versions of
  9. this manual under the conditions for verbatim copying, provided also
  10. that the section entitled "GNU General Public License" is included
  11. exactly as in the original, and provided that the entire resulting
  12. derived work is distributed under the terms of a permission notice
  13. identical to this one.
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions, except that the section entitled "GNU General Public License"
  17. may be included in a translation approved by the author instead of in
  18. the original English.
  19. File: calc.info,  Node: Evaluates-To Operator,  Prev: Let Command,  Up: Store and Recall
  20. The Evaluates-To Operator
  21. =========================
  22. The special algebraic symbol `=>' is known as the "evaluates-to
  23. operator".  (It will show up as an `evalto' function call in other
  24. language modes like Pascal and TeX.)  This is a binary operator, that
  25. is, it has a lefthand and a righthand argument, although it can be
  26. entered with the righthand argument omitted.
  27.    A formula like `A => B' is evaluated by Calc as follows:  First, A
  28. is not simplified or modified in any way.  The previous value of
  29. argument B is thrown away; the formula A is then copied and evaluated
  30. as if by the `=' command according to all current modes and stored
  31. variable values, and the result is installed as the new value of B.
  32.    For example, suppose you enter the algebraic formula `2 + 3 => 17'.
  33. The number 17 is ignored, and the lefthand argument is left in its
  34. unevaluated form; the result is the formula `2 + 3 => 5'.
  35.    You can enter an `=>' formula either directly using algebraic entry
  36. (in which case the righthand side may be omitted since it is going to
  37. be replaced right away anyhow), or by using the `s =' (`calc-evalto')
  38. command, which takes A from the stack and replaces it with `A => B'.
  39.    Calc keeps track of all `=>' operators on the stack, and recomputes
  40. them whenever anything changes that might affect their values, i.e., a
  41. mode setting or variable value.  This occurs only if the `=>' operator
  42. is at the top level of the formula, or if it is part of a top-level
  43. vector.  In other words, pushing `2 + (a => 17)' will change the 17 to
  44. the actual value of `a' when you enter the formula, but the result will
  45. not be dynamically updated when `a' is changed later because the `=>'
  46. operator is buried inside a sum.  However, a vector of `=>' operators
  47. will be recomputed, since it is convenient to push a vector like `[a
  48. =>, b =>, c =>]' on the stack to make a concise display of all the
  49. variables in your problem.  (Another way to do this would be to use
  50. `[a, b, c] =>', which provides a slightly different format of display.
  51. You can use whichever you find easiest to read.)
  52.    The `m C' (`calc-auto-recompute') command allows you to turn this
  53. automatic recomputation on or off.  If you turn recomputation off, you
  54. must explicitly recompute an `=>' operator on the stack in one of the
  55. usual ways, such as by pressing `='.  Turning recomputation off
  56. temporarily can save a lot of time if you will be changing several
  57. modes or variables before you look at the `=>' entries again.
  58.    Most commands are not especially useful with `=>' operators as
  59. arguments.  For example, given `x + 2 => 17', it won't work to type `1
  60. +' to get `x + 3 => 18'.  If you want to operate on the lefthand side
  61. of the `=>' operator on the top of the stack, type `j 1' (that's the
  62. digit "one") to select the lefthand side, execute your commands, then
  63. type `j u' to unselect.
  64.    All current modes apply when an `=>' operator is computed, including
  65. the current simplification mode.  Recall that the formula `x + y + x'
  66. is not handled by Calc's default simplifications, but the `a s' command
  67. will reduce it to the simpler form `y + 2 x'.  You can also type `m A'
  68. to enable an algebraic-simplification mode in which the equivalent of
  69. `a s' is used on all of Calc's results.  If you enter `x + y + x =>'
  70. normally, the result will be `x + y + x => x + y + x'.  If you change to
  71. algebraic-simplification mode, the result will be `x + y + x => y + 2
  72. x'.  However, just pressing `a s' once will have no effect on `x + y +
  73. x => x + y + x', because the righthand side depends only on the
  74. lefthand side and the current mode settings, and the lefthand side is
  75. not affected by commands like `a s'.
  76.    The "let" command (`s l') has an interesting interaction with the
  77. `=>' operator.  The `s l' command evaluates the second-to-top stack
  78. entry with the top stack entry supplying a temporary value for a given
  79. variable.  As you might expect, if that stack entry is an `=>' operator
  80. its righthand side will temporarily show this value for the variable.
  81. In fact, all `=>'s on the stack will be updated if they refer to that
  82. variable.  But this change is temporary in the sense that the next
  83. command that causes Calc to look at those stack entries will make them
  84. revert to the old variable value.
  85.      2:  a => a             2:  a => 17         2:  a => a
  86.      1:  a + 1 => a + 1     1:  a + 1 => 18     1:  a + 1 => a + 1
  87.          .                      .                   .
  88.      
  89.                                 17 s l a RET        p 8 RET
  90.    Here the `p 8' command changes the current precision, thus causing
  91. the `=>' forms to be recomputed after the influence of the "let" is
  92. gone.  The `d SPC' command (`calc-refresh') is a handy way to force the
  93. `=>' operators on the stack to be recomputed without any other side
  94. effects.
  95.    Embedded Mode also uses `=>' operators.  In embedded mode, the
  96. lefthand side of an `=>' operator can refer to variables assigned
  97. elsewhere in the file by `:=' operators.  The assignment operator `a :=
  98. 17' does not actually do anything by itself.  But Embedded Mode
  99. recognizes it and marks it as a sort of file-local definition of the
  100. variable.  You can enter `:=' operators in algebraic mode, or by using
  101. the `s :' (`calc-assign') [`assign'] command which takes a variable and
  102. value from the stack and replaces them with an assignment.
  103.    *Note TeX Language Mode::, for the way `=>' appears in TeX language
  104. output.  The "eqn" mode gives similar treatment to `=>'.
  105. File: calc.info,  Node: Graphics,  Next: Kill and Yank,  Prev: Store and Recall,  Up: Top
  106. Graphics
  107. ********
  108. The commands for graphing data begin with the `g' prefix key.  Calc
  109. uses GNUPLOT 2.0 or 3.0 to do graphics.  These commands will only work
  110. if GNUPLOT is available on your system.  (While GNUPLOT sounds like a
  111. relative of GNU Emacs, it is actually completely unrelated.  However,
  112. it is free software and can be obtained from the Free Software
  113. Foundation's machine `prep.ai.mit.edu'.)
  114.    If you have GNUPLOT installed on your system but Calc is unable to
  115. find it, you may need to set the `calc-gnuplot-name' variable in your
  116. `.emacs' file.  You may also need to set some Lisp variables to show
  117. Calc how to run GNUPLOT on your system; these are described under `g D'
  118. and `g O' below.  If you are using the X window system, Calc will
  119. configure GNUPLOT for you automatically.  If you have GNUPLOT 3.0 and
  120. you are not using X, Calc will configure GNUPLOT to display graphs
  121. using simple character graphics that will work on any terminal.
  122. * Menu:
  123. * Basic Graphics::
  124. * Three Dimensional Graphics::
  125. * Managing Curves::
  126. * Graphics Options::
  127. * Devices::
  128. File: calc.info,  Node: Basic Graphics,  Next: Three Dimensional Graphics,  Prev: Graphics,  Up: Graphics
  129. Basic Graphics
  130. ==============
  131. The easiest graphics command is `g f' (`calc-graph-fast').  This
  132. command takes two vectors of equal length from the stack.  The vector
  133. at the top of the stack represents the "y" values of the various data
  134. points.  The vector in the second-to-top position represents the
  135. corresponding "x" values.  This command runs GNUPLOT (if it has not
  136. alr