home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / info / calc.info-12 (.txt) < prev    next >
GNU Info File  |  1994-12-22  |  48KB  |  905 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: Mathematica Language Mode,  Next: Maple Language Mode,  Prev: Eqn Language Mode,  Up: Language Modes
  20. Mathematica Language Mode
  21. -------------------------
  22. The `d M' (`calc-mathematica-language') command selects the conventions
  23. of Mathematica, a powerful and popular mathematical tool from Wolfram
  24. Research, Inc.  Notable differences in Mathematica mode are that the
  25. names of built-in functions are capitalized, and function calls use
  26. square brackets instead of parentheses.  Thus the Calc formula `sin(2
  27. x)' is entered and displayed `Sin[2 x]' in Mathematica mode.
  28.    Vectors and matrices use curly braces in Mathematica.  Complex
  29. numbers are written `3 + 4 I'.  The standard special constants in Calc
  30. are written `Pi', `E', `I', `GoldenRatio', `EulerGamma', `Infinity',
  31. `ComplexInfinity', and `Indeterminate' in Mathematica mode.
  32. Non-decimal numbers are written, e.g., `16^^7fff'.  Floating-point
  33. numbers in scientific notation are written `1.23*10.^3'.  Subscripts
  34. use double square brackets: `a[[i]]'.
  35. File: calc.info,  Node: Maple Language Mode,  Next: Compositions,  Prev: Mathematica Language Mode,  Up: Language Modes
  36. Maple Language Mode
  37. -------------------
  38. The `d W' (`calc-maple-language') command selects the conventions of
  39. Maple, another mathematical tool from the University of Waterloo.
  40.    Maple's language is much like C.  Underscores are allowed in symbol
  41. names; square brackets are used for subscripts; explicit `*'s for
  42. multiplications are required.  Use either `^' or `**' to denote powers.
  43.    Maple uses square brackets for lists and curly braces for sets.  Calc
  44. interprets both notations as vectors, and displays vectors with square
  45. brackets.  This means Maple sets will be converted to lists when they
  46. pass through Calc.  As a special case, matrices are written as calls to
  47. the function `matrix', given a list of lists as the argument, and can
  48. be read in this form or with all-capitals `MATRIX'.
  49.    The Maple interval notation `2 .. 3' has no surrounding brackets;
  50. Calc reads `2 .. 3' as the closed interval `[2 .. 3]', and writes any
  51. kind of interval as `2 .. 3'.  This means you cannot see the difference
  52. between an open and a closed interval while in Maple display mode.
  53.    Maple writes complex numbers as `3 + 4*I'.  Its special constants
  54. are `Pi', `E', `I', and `infinity' (all three of `inf', `uinf', and
  55. `nan' display as `infinity').  Floating-point numbers are written
  56. `1.23*10.^3'.
  57.    Among things not currently handled by Calc's Maple mode are the
  58. various quote symbols, procedures and functional operators, and inert
  59. (`&') operators.
  60. File: calc.info,  Node: Compositions,  Next: Syntax Tables,  Prev: Maple Language Mode,  Up: Language Modes
  61. Compositions
  62. ------------
  63. There are several "composition functions" which allow you to get
  64. displays in a variety of formats similar to those in Big language mode.
  65. Most of these functions do not evaluate to anything; they are
  66. placeholders which are left in symbolic form by Calc's evaluator but
  67. are recognized by Calc's display formatting routines.
  68.    Two of these, `string' and `bstring', are described elsewhere.
  69. *Note Strings::.  For example, `string("ABC")' is displayed as `ABC'.
  70. When viewed on the stack it will be indistinguishable from the variable
  71. `ABC', but internally it will be stored as `string([65, 66, 67])' and
  72. can still be manipulated this way; for example, the selection and
  73. vector commands `j 1 v v j u' would select the vector portion of this
  74. object and reverse the elements, then deselect to reveal a string whose
  75. characters had been reversed.
  76.    The composition functions do the same thing in all language modes
  77. (although their components will of course be formatted in the current
  78. language mode).  The one exception is Unformatted mode (`d U'), which
  79. does not give the composition functions any special treatment.  The
  80. functions are discussed here because of their relationship to the
  81. language modes.
  82. * Menu:
  83. * Composition Basics::
  84. * Horizontal Compositions::
  85. * Vertical Compositions::
  86. * Other Compositions::
  87. * Information about Compositions::
  88. * User-Defined Compositions::
  89. File: calc.info,  Node: Composition Basics,  Next: Horizontal Compositions,  Prev: Compositions,  Up: Compositions
  90. Composition Basics
  91. ..................
  92. Compositions are generally formed by stacking formulas together
  93. horizontally or vertically in various ways.  Those formulas are
  94. themselves compositions.  TeX users will find this analogous to TeX's
  95. "boxes."  Each multi-line composition has a "baseline"; horizontal
  96. compositions use the baselines to decide how formulas should be
  97. positioned relative to one another.  For example, in the Big mode
  98. formula
  99.                2
  100.           a + b
  101.      17 + ------
  102.             c
  103. the second term of the sum is four lines tall and has line three as its
  104. baseline.  Thus when the term is combined with 17, line three is placed
  105. on the same level as the baseline of 17.
  106.    Another important composition concept is "precedence".  This is an
  107. integer that represents the binding strength of various operators.  For
  108. example, `*' has higher precedence (195) than `+' (180), which means
  109. that `(a * b) + c' will be formatted without the parentheses, but `a *
  110. (b + c)' will keep the parentheses.
  111.    The operator table used by normal and Big language modes has the
  112. following precedences:
  113.      _     1200   (subscripts)
  114.      %     1100   (as in n%)
  115.      -     1000   (as in -n)
  116.      !     1000   (as in !n)
  117.      mod    400
  118.      +/-    300
  119.      !!     210    (as in n!!)
  120.      !      210    (as in n!)
  121.      ^      200
  122.      *      195    (or implicit multiplication)
  123.      / % \  190
  124.      + -    180    (as in a+b)
  125.      |      170
  126.      < =    160    (and other relations)
  127.      &&     110
  128.      ||     100
  129.      ? :     90
  130.      !!!     85
  131.      &&&     80
  132.      |||     75
  133.      :=      50
  134.      ::      45
  135.      =>      40
  136.    The general rule is that if an operator with precedence `n' occurs
  137. as an argument to an operator with precedence `m', then the argument is
  138. enclosed in parentheses if `n < m'.  Top-level expressions and
  139. expressions which are function arguments, vector components, etc., are
  140. formatted with precedence zero (so that they normally never get
  141. additional parentheses).
  142.    For binary left-associative operators like `+', the righthand
  143. argument is actually formatted with one-higher precedence than shown in
  144. the table.  This makes sure `(a + b) + c' omits the parentheses, but
  145. the unnatural form `a + (b + c)' keeps its parentheses.
  146. Right-associative operators like `^' format the lefthand argument with
  147. one-higher precedence.
  148.    The `cprec' function formats an expression with an arbitrary
  149. precedence.  For example, `cprec(abc, 185)' will combine into sums and
  150. products as follows:  `7 + abc', `7 (abc)' (because this `cprec' form
  151. has higher precedence than addition, but lower precedence than
  152. multiplication).
  153.    A final composition issue is "line breaking".  Calc uses two
  154. different strategies for "flat" and "non-flat" compositions.  A
  155. non-flat composition is anything that appears on multiple lines (not
  156. counting line breaking).  Examples would be matrices and Big mode
  157. powers and quotients.  Non-flat compositions are displayed ex