home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
gnu
/
info
/
calc.info-12
(
.txt
)
< prev
next >
Wrap
GNU Info File
|
1994-12-22
|
48KB
|
905 lines
This is Info file calc.info, produced by Makeinfo-1.55 from the input
file calc.texinfo.
This file documents Calc, the GNU Emacs calculator.
Copyright (C) 1990, 1991 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the section entitled "GNU General Public License" is included
exactly as in the original, and provided that the entire resulting
derived work is distributed under the terms of a permission notice
identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the section entitled "GNU General Public License"
may be included in a translation approved by the author instead of in
the original English.
File: calc.info, Node: Mathematica Language Mode, Next: Maple Language Mode, Prev: Eqn Language Mode, Up: Language Modes
Mathematica Language Mode
-------------------------
The `d M' (`calc-mathematica-language') command selects the conventions
of Mathematica, a powerful and popular mathematical tool from Wolfram
Research, Inc. Notable differences in Mathematica mode are that the
names of built-in functions are capitalized, and function calls use
square brackets instead of parentheses. Thus the Calc formula `sin(2
x)' is entered and displayed `Sin[2 x]' in Mathematica mode.
Vectors and matrices use curly braces in Mathematica. Complex
numbers are written `3 + 4 I'. The standard special constants in Calc
are written `Pi', `E', `I', `GoldenRatio', `EulerGamma', `Infinity',
`ComplexInfinity', and `Indeterminate' in Mathematica mode.
Non-decimal numbers are written, e.g., `16^^7fff'. Floating-point
numbers in scientific notation are written `1.23*10.^3'. Subscripts
use double square brackets: `a[[i]]'.
File: calc.info, Node: Maple Language Mode, Next: Compositions, Prev: Mathematica Language Mode, Up: Language Modes
Maple Language Mode
-------------------
The `d W' (`calc-maple-language') command selects the conventions of
Maple, another mathematical tool from the University of Waterloo.
Maple's language is much like C. Underscores are allowed in symbol
names; square brackets are used for subscripts; explicit `*'s for
multiplications are required. Use either `^' or `**' to denote powers.
Maple uses square brackets for lists and curly braces for sets. Calc
interprets both notations as vectors, and displays vectors with square
brackets. This means Maple sets will be converted to lists when they
pass through Calc. As a special case, matrices are written as calls to
the function `matrix', given a list of lists as the argument, and can
be read in this form or with all-capitals `MATRIX'.
The Maple interval notation `2 .. 3' has no surrounding brackets;
Calc reads `2 .. 3' as the closed interval `[2 .. 3]', and writes any
kind of interval as `2 .. 3'. This means you cannot see the difference
between an open and a closed interval while in Maple display mode.
Maple writes complex numbers as `3 + 4*I'. Its special constants
are `Pi', `E', `I', and `infinity' (all three of `inf', `uinf', and
`nan' display as `infinity'). Floating-point numbers are written
`1.23*10.^3'.
Among things not currently handled by Calc's Maple mode are the
various quote symbols, procedures and functional operators, and inert
(`&') operators.
File: calc.info, Node: Compositions, Next: Syntax Tables, Prev: Maple Language Mode, Up: Language Modes
Compositions
------------
There are several "composition functions" which allow you to get
displays in a variety of formats similar to those in Big language mode.
Most of these functions do not evaluate to anything; they are
placeholders which are left in symbolic form by Calc's evaluator but
are recognized by Calc's display formatting routines.
Two of these, `string' and `bstring', are described elsewhere.
*Note Strings::. For example, `string("ABC")' is displayed as `ABC'.
When viewed on the stack it will be indistinguishable from the variable
`ABC', but internally it will be stored as `string([65, 66, 67])' and
can still be manipulated this way; for example, the selection and
vector commands `j 1 v v j u' would select the vector portion of this
object and reverse the elements, then deselect to reveal a string whose
characters had been reversed.
The composition functions do the same thing in all language modes
(although their components will of course be formatted in the current
language mode). The one exception is Unformatted mode (`d U'), which
does not give the composition functions any special treatment. The
functions are discussed here because of their relationship to the
language modes.
* Menu:
* Composition Basics::
* Horizontal Compositions::
* Vertical Compositions::
* Other Compositions::
* Information about Compositions::
* User-Defined Compositions::
File: calc.info, Node: Composition Basics, Next: Horizontal Compositions, Prev: Compositions, Up: Compositions
Composition Basics
..................
Compositions are generally formed by stacking formulas together
horizontally or vertically in various ways. Those formulas are
themselves compositions. TeX users will find this analogous to TeX's
"boxes." Each multi-line composition has a "baseline"; horizontal
compositions use the baselines to decide how formulas should be
positioned relative to one another. For example, in the Big mode
formula
2
a + b
17 + ------
c
the second term of the sum is four lines tall and has line three as its
baseline. Thus when the term is combined with 17, line three is placed
on the same level as the baseline of 17.
Another important composition concept is "precedence". This is an
integer that represents the binding strength of various operators. For
example, `*' has higher precedence (195) than `+' (180), which means
that `(a * b) + c' will be formatted without the parentheses, but `a *
(b + c)' will keep the parentheses.
The operator table used by normal and Big language modes has the
following precedences:
_ 1200 (subscripts)
% 1100 (as in n%)
- 1000 (as in -n)
! 1000 (as in !n)
mod 400
+/- 300
!! 210 (as in n!!)
! 210 (as in n!)
^ 200
* 195 (or implicit multiplication)
/ % \ 190
+ - 180 (as in a+b)
| 170
< = 160 (and other relations)
&& 110
|| 100
? : 90
!!! 85
&&& 80
||| 75
:= 50
:: 45
=> 40
The general rule is that if an operator with precedence `n' occurs
as an argument to an operator with precedence `m', then the argument is
enclosed in parentheses if `n < m'. Top-level expressions and
expressions which are function arguments, vector components, etc., are
formatted with precedence zero (so that they normally never get
additional parentheses).
For binary left-associative operators like `+', the righthand
argument is actually formatted with one-higher precedence than shown in
the table. This makes sure `(a + b) + c' omits the parentheses, but
the unnatural form `a + (b + c)' keeps its parentheses.
Right-associative operators like `^' format the lefthand argument with
one-higher precedence.
The `cprec' function formats an expression with an arbitrary
precedence. For example, `cprec(abc, 185)' will combine into sums and
products as follows: `7 + abc', `7 (abc)' (because this `cprec' form
has higher precedence than addition, but lower precedence than
multiplication).
A final composition issue is "line breaking". Calc uses two
different strategies for "flat" and "non-flat" compositions. A
non-flat composition is anything that appears on multiple lines (not
counting line breaking). Examples would be matrices and Big mode
powers and quotients. Non-flat compositions are displayed ex