/[emacs]/emacs/man/calc.texi
ViewVC logotype

Diff of /emacs/man/calc.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.46 by jpb, Thu Feb 10 18:54:10 2005 UTC revision 1.47 by jpb, Fri Feb 11 05:44:58 2005 UTC
# Line 17  Line 17 
17  @c $x$ in TeX, @samp{x} otherwise.  @c $x$ in TeX, @samp{x} otherwise.
18    
19  @iftex  @iftex
20  @macro texline{stuff}  @macro texline
 \stuff\  
21  @end macro  @end macro
22  @alias infoline=comment  @alias infoline=comment
23  @tex  @alias expr=math
24  \gdef\exprsetup{\tex \let\t\ttfont \turnoffactive}  @alias tfn=code
 \gdef\expr{\exprsetup$\exprfinish}  
 \gdef\exprfinish#1{#1$\endgroup}  
 @end tex  
25  @alias mathit=expr  @alias mathit=expr
26  @macro cpi{}  @macro cpi{}
27  @math{@pi{}}  @math{@pi{}}
# Line 41  Line 37 
37  \stuff\  \stuff\
38  @end macro  @end macro
39  @alias expr=samp  @alias expr=samp
40    @alias tfn=t
41  @alias mathit=i  @alias mathit=i
42  @macro cpi{}  @macro cpi{}
43  @expr{pi}  @expr{pi}
# Line 663  Click on the @key{2}, @key{ENTER}, @key{ Line 660  Click on the @key{2}, @key{ENTER}, @key{
660  ``buttons'' using your left mouse button.  ``buttons'' using your left mouse button.
661    
662  @noindent  @noindent
663  Click on @key{PI}, @key{2}, and @t{y^x}.  Click on @key{PI}, @key{2}, and @tfn{y^x}.
664    
665  @noindent  @noindent
666  Click on @key{INV}, then @key{ENTER} to swap the two results.  Click on @key{INV}, then @key{ENTER} to swap the two results.
# Line 9071  apply and the rewrites will stop right a Line 9068  apply and the rewrites will stop right a
9068  @starindex  @starindex
9069  @end ignore  @end ignore
9070  @tindex nterms  @tindex nterms
9071  If @expr{x} is the sum @expr{a + b}, then `@t{nterms(}@var{x}@t{)}' must  If @expr{x} is the sum @expr{a + b}, then `@tfn{nterms(}@var{x}@tfn{)}' must
9072  be `@t{nterms(}@var{a}@t{)}' plus `@t{nterms(}@var{b}@t{)}'.  If @expr{x}  be `@tfn{nterms(}@var{a}@tfn{)}' plus `@tfn{nterms(}@var{b}@tfn{)}'.  If @expr{x}
9073  is not a sum, then `@t{nterms(}@var{x}@t{)}' = 1.  is not a sum, then `@tfn{nterms(}@var{x}@tfn{)}' = 1.
9074    
9075  @smallexample  @smallexample
9076  @group  @group
# Line 10872  Rectangular complex numbers can also be Line 10869  Rectangular complex numbers can also be
10869  notation; @pxref{Complex Formats}.  notation; @pxref{Complex Formats}.
10870    
10871  Polar complex numbers are displayed in the form  Polar complex numbers are displayed in the form
10872  @texline `@t{(}@var{r}@t{;}@math{\theta}@t{)}'  @texline `@tfn{(}@var{r}@tfn{;}@math{\theta}@tfn{)}'
10873  @infoline `@t{(}@var{r}@t{;}@var{theta}@t{)}'  @infoline `@tfn{(}@var{r}@tfn{;}@var{theta}@tfn{)}'
10874  where @var{r} is the nonnegative magnitude and  where @var{r} is the nonnegative magnitude and
10875  @texline @math{\theta}  @texline @math{\theta}
10876  @infoline @var{theta}  @infoline @var{theta}
# Line 11290  conversions. Line 11287  conversions.
11287  A @dfn{modulo form} is a real number which is taken modulo (i.e., within  A @dfn{modulo form} is a real number which is taken modulo (i.e., within
11288  an integer multiple of) some value @var{M}.  Arithmetic modulo @var{M}  an integer multiple of) some value @var{M}.  Arithmetic modulo @var{M}
11289  often arises in number theory.  Modulo forms are written  often arises in number theory.  Modulo forms are written
11290  `@var{a} @t{mod} @var{M}',  `@var{a} @tfn{mod} @var{M}',
11291  where @var{a} and @var{M} are real numbers or HMS forms, and  where @var{a} and @var{M} are real numbers or HMS forms, and
11292  @texline @math{0 \le a < M}.  @texline @math{0 \le a < M}.
11293  @infoline @expr{0 <= a < @var{M}}.  @infoline @expr{0 <= a < @var{M}}.
# Line 11314  are integers, this calculation is done m Line 11311  are integers, this calculation is done m
11311  actually computing the power and then reducing.)  actually computing the power and then reducing.)
11312    
11313  @cindex Modulo division  @cindex Modulo division
11314  Two modulo forms `@var{a} @t{mod} @var{M}' and `@var{b} @t{mod} @var{M}'  Two modulo forms `@var{a} @tfn{mod} @var{M}' and `@var{b} @tfn{mod} @var{M}'
11315  can be divided if @expr{a}, @expr{b}, and @expr{M} are all  can be divided if @expr{a}, @expr{b}, and @expr{M} are all
11316  integers.  The result is the modulo form which, when multiplied by  integers.  The result is the modulo form which, when multiplied by
11317  `@var{b} @t{mod} @var{M}', produces `@var{a} @t{mod} @var{M}'.  If  `@var{b} @tfn{mod} @var{M}', produces `@var{a} @tfn{mod} @var{M}'.  If
11318  there is no solution to this equation (which can happen only when  there is no solution to this equation (which can happen only when
11319  @expr{M} is non-prime), or if any of the arguments are non-integers, the  @expr{M} is non-prime), or if any of the arguments are non-integers, the
11320  division is left in symbolic form.  Other operations, such as square  division is left in symbolic form.  Other operations, such as square
11321  roots, are not yet supported for modulo forms.  (Note that, although  roots, are not yet supported for modulo forms.  (Note that, although
11322  @w{`@t{(}@var{a} @t{mod} @var{M}@t{)^.5}'} will compute a ``modulo square root''  @w{`@tfn{(}@var{a} @tfn{mod} @var{M}@tfn{)^.5}'} will compute a ``modulo square root''
11323  in the sense of reducing  in the sense of reducing
11324  @texline @math{\sqrt a}  @texline @math{\sqrt a}
11325  @infoline @expr{sqrt(a)}  @infoline @expr{sqrt(a)}
# Line 11374  The algebraic function @samp{makemod(a, Line 11371  The algebraic function @samp{makemod(a,
11371  @cindex Standard deviations  @cindex Standard deviations
11372  An @dfn{error form} is a number with an associated standard  An @dfn{error form} is a number with an associated standard
11373  deviation, as in @samp{2.3 +/- 0.12}.  The notation  deviation, as in @samp{2.3 +/- 0.12}.  The notation
11374  @texline `@var{x} @t{+/-} @math{\sigma}'  @texline `@var{x} @tfn{+/-} @math{\sigma}'
11375  @infoline `@var{x} @t{+/-} sigma'  @infoline `@var{x} @tfn{+/-} sigma'
11376  stands for an uncertain value which follows  stands for an uncertain value which follows
11377  a normal or Gaussian distribution of mean @expr{x} and standard  a normal or Gaussian distribution of mean @expr{x} and standard
11378  deviation or ``error''  deviation or ``error''
# Line 11421  Consult a good text on error analysis fo Line 11418  Consult a good text on error analysis fo
11418  of standard deviations.  Actual errors often are neither Gaussian-distributed  of standard deviations.  Actual errors often are neither Gaussian-distributed
11419  nor uncorrelated, and the above formulas are valid only when errors  nor uncorrelated, and the above formulas are valid only when errors
11420  are small.  As an example, the error arising from  are small.  As an example, the error arising from
11421  @texline `@t{sin(}@var{x} @t{+/-} @math{\sigma}@t{)}'  @texline `@tfn{sin(}@var{x} @tfn{+/-} @math{\sigma}@tfn{)}'
11422  @infoline `@t{sin(}@var{x} @t{+/-} @var{sigma}@t{)}'  @infoline `@tfn{sin(}@var{x} @tfn{+/-} @var{sigma}@tfn{)}'
11423  is  is
11424  @texline `@math{\sigma} @t{abs(cos(}@var{x}@t{))}'.    @texline `@math{\sigma} @tfn{abs(cos(}@var{x}@tfn{))}'.  
11425  @infoline `@var{sigma} @t{abs(cos(}@var{x}@t{))}'.    @infoline `@var{sigma} @tfn{abs(cos(}@var{x}@tfn{))}'.  
11426  When @expr{x} is close to zero,  When @expr{x} is close to zero,
11427  @texline @math{\cos x}  @texline @math{\cos x}
11428  @infoline @expr{cos(x)}  @infoline @expr{cos(x)}
# Line 11557  contain zero inside them Calc is forced Line 11554  contain zero inside them Calc is forced
11554  While it may seem that intervals and error forms are similar, they are  While it may seem that intervals and error forms are similar, they are
11555  based on entirely different concepts of inexact quantities.  An error  based on entirely different concepts of inexact quantities.  An error
11556  form  form
11557  @texline `@var{x} @t{+/-} @math{\sigma}'  @texline `@var{x} @tfn{+/-} @math{\sigma}'
11558  @infoline `@var{x} @t{+/-} @var{sigma}'  @infoline `@var{x} @tfn{+/-} @var{sigma}'
11559  means a variable is random, and its value could  means a variable is random, and its value could
11560  be anything but is ``probably'' within one  be anything but is ``probably'' within one
11561  @texline @math{\sigma}  @texline @math{\sigma}
11562  @infoline @var{sigma}  @infoline @var{sigma}
11563  of the mean value @expr{x}. An interval  of the mean value @expr{x}. An interval
11564  `@t{[}@var{a} @t{..@:} @var{b}@t{]}' means a  `@tfn{[}@var{a} @tfn{..@:} @var{b}@tfn{]}' means a
11565  variable's value is unknown, but guaranteed to lie in the specified  variable's value is unknown, but guaranteed to lie in the specified
11566  range.  Error forms are statistical or ``average case'' approximations;  range.  Error forms are statistical or ``average case'' approximations;
11567  interval arithmetic tends to produce ``worst case'' bounds on an  interval arithmetic tends to produce ``worst case'' bounds on an
# Line 12742  The @kbd{m D} (@code{calc-default-simpli Line 12739  The @kbd{m D} (@code{calc-default-simpli
12739  default simplifications for all formulas.  This includes many easy and  default simplifications for all formulas.  This includes many easy and
12740  fast algebraic simplifications such as @expr{a+0} to @expr{a}, and  fast algebraic simplifications such as @expr{a+0} to @expr{a}, and
12741  @expr{a + 2 a} to @expr{3 a}, as well as evaluating functions like  @expr{a + 2 a} to @expr{3 a}, as well as evaluating functions like
12742  @texline @t{deriv}@expr{(x^2,x)}  @expr{@tfn{deriv}(x^2, x)} to @expr{2 x}.
 @infoline @expr{@t{deriv}(x^2, x)}  
 to @expr{2 x}.  
12743    
12744  @kindex m B  @kindex m B
12745  @pindex calc-bin-simplify-mode  @pindex calc-bin-simplify-mode
# Line 16512  no second argument at all. Line 16507  no second argument at all.
16507    
16508  @cindex Fractional part of a number  @cindex Fractional part of a number
16509  To compute the fractional part of a number (i.e., the amount which, when  To compute the fractional part of a number (i.e., the amount which, when
16510  added to `@t{floor(}@var{n}@t{)}', will produce @var{n}) just take @var{n}  added to `@tfn{floor(}@var{n}@tfn{)}', will produce @var{n}) just take @var{n}
16511  modulo 1 using the @code{%} command.  modulo 1 using the @code{%} command.
16512    
16513  Note also the @kbd{\} (integer quotient), @kbd{f I} (integer logarithm),  Note also the @kbd{\} (integer quotient), @kbd{f I} (integer logarithm),
# Line 16539  this command replaces each element by it Line 16534  this command replaces each element by it
16534  The @kbd{G} (@code{calc-argument}) [@code{arg}] command computes the  The @kbd{G} (@code{calc-argument}) [@code{arg}] command computes the
16535  ``argument'' or polar angle of a complex number.  For a number in polar  ``argument'' or polar angle of a complex number.  For a number in polar
16536  notation, this is simply the second component of the pair  notation, this is simply the second component of the pair
16537  @texline `@t{(}@var{r}@t{;}@math{\theta}@t{)}'.  @texline `@tfn{(}@var{r}@tfn{;}@math{\theta}@tfn{)}'.
16538  @infoline `@t{(}@var{r}@t{;}@var{theta}@t{)}'.  @infoline `@tfn{(}@var{r}@tfn{;}@var{theta}@tfn{)}'.
16539  The result is expressed according to the current angular mode and will  The result is expressed according to the current angular mode and will
16540  be in the range @mathit{-180} degrees (exclusive) to @mathit{+180} degrees  be in the range @mathit{-180} degrees (exclusive) to @mathit{+180} degrees
16541  (inclusive), or the equivalent range in radians.  (inclusive), or the equivalent range in radians.
# Line 18808  where @var{m} and Line 18803  where @var{m} and
18803  are both real numbers, the result uses a Gaussian distribution with mean  are both real numbers, the result uses a Gaussian distribution with mean
18804  @var{m} and standard deviation  @var{m} and standard deviation
18805  @texline @math{\sigma}.  @texline @math{\sigma}.
18806  @var{s}.  @infoline @var{s}.
18807    
18808  If @expr{M} is an interval form, the lower and upper bounds specify the  If @expr{M} is an interval form, the lower and upper bounds specify the
18809  acceptable limits of the random numbers.  If both bounds are integers,  acceptable limits of the random numbers.  If both bounds are integers,
# Line 20488  has an infinite weight, next to which an Line 20483  has an infinite weight, next to which an
20483  weight is completely negligible.)  weight is completely negligible.)
20484    
20485  This function also works for distributions (error forms or  This function also works for distributions (error forms or
20486  intervals).  The mean of an error form `@var{a} @t{+/-} @var{b}' is simply  intervals).  The mean of an error form `@var{a} @tfn{+/-} @var{b}' is simply
20487  @expr{a}.  The mean of an interval is the mean of the minimum  @expr{a}.  The mean of an interval is the mean of the minimum
20488  and maximum values of the interval.  and maximum values of the interval.
20489    
# Line 22260  Manipulation}.  The @kbd{m D} command tu Line 22255  Manipulation}.  The @kbd{m D} command tu
22255  back on.  back on.
22256    
22257  The most basic default simplification is the evaluation of functions.  The most basic default simplification is the evaluation of functions.
22258  For example, @expr{2 + 3} is evaluated to @expr{5}, and @expr{@t{sqrt}(9)}  For example, @expr{2 + 3} is evaluated to @expr{5}, and @expr{@tfn{sqrt}(9)}
22259  is evaluated to @expr{3}.  Evaluation does not occur if the arguments  is evaluated to @expr{3}.  Evaluation does not occur if the arguments
22260  to a function are somehow of the wrong type @expr{@t{tan}([2,3,4])}),  to a function are somehow of the wrong type @expr{@tfn{tan}([2,3,4])}),
22261  range (@expr{@t{tan}(90)}), or number (@expr{@t{tan}(3,5)}),  range (@expr{@tfn{tan}(90)}), or number (@expr{@tfn{tan}(3,5)}),
22262  or if the function name is not recognized (@expr{@t{f}(5)}), or if  or if the function name is not recognized (@expr{@tfn{f}(5)}), or if
22263  Symbolic mode (@pxref{Symbolic Mode}) prevents evaluation  Symbolic mode (@pxref{Symbolic Mode}) prevents evaluation
22264  (@expr{@t{sqrt}(2)}).  (@expr{@tfn{sqrt}(2)}).
22265    
22266  Calc simplifies (evaluates) the arguments to a function before it  Calc simplifies (evaluates) the arguments to a function before it
22267  simplifies the function itself.  Thus @expr{@t{sqrt}(5+4)} is  simplifies the function itself.  Thus @expr{@tfn{sqrt}(5+4)} is
22268  simplified to @expr{@t{sqrt}(9)} before the @code{sqrt} function  simplified to @expr{@tfn{sqrt}(9)} before the @code{sqrt} function
22269  itself is applied.  There are very few exceptions to this rule:  itself is applied.  There are very few exceptions to this rule:
22270  @code{quote}, @code{lambda}, and @code{condition} (the @code{::}  @code{quote}, @code{lambda}, and @code{condition} (the @code{::}
22271  operator) do not evaluate their arguments, @code{if} (the @code{? :}  operator) do not evaluate their arguments, @code{if} (the @code{? :}
# Line 22395  terms of the product: @expr{x^a x^b} goe Line 22390  terms of the product: @expr{x^a x^b} goe
22390  @texline @math{x^{a+b}}  @texline @math{x^{a+b}}
22391  @infoline @expr{x^(a+b)}  @infoline @expr{x^(a+b)}
22392  where @expr{a} is a number, or an implicit 1 (as in @expr{x}),  where @expr{a} is a number, or an implicit 1 (as in @expr{x}),
22393  or the implicit one-half of @expr{@t{sqrt}(x)}, and similarly for  or the implicit one-half of @expr{@tfn{sqrt}(x)}, and similarly for
22394  @expr{b}.  The result is written using @samp{sqrt} or @samp{1/sqrt}  @expr{b}.  The result is written using @samp{sqrt} or @samp{1/sqrt}
22395  if the sum of the powers is @expr{1/2} or @expr{-1/2}, respectively.  if the sum of the powers is @expr{1/2} or @expr{-1/2}, respectively.
22396  If the sum of the powers is zero, the product is simplified to  If the sum of the powers is zero, the product is simplified to
# Line 22486  is safe to simplify, but Line 22481  is safe to simplify, but
22481  is not.)  @xref{Declarations}, for ways to inform Calc that your  is not.)  @xref{Declarations}, for ways to inform Calc that your
22482  variables satisfy these requirements.  variables satisfy these requirements.
22483    
22484  As a special case of this rule, @expr{@t{sqrt}(x)^n} is simplified to  As a special case of this rule, @expr{@tfn{sqrt}(x)^n} is simplified to
22485  @texline @math{x^{n/2}}  @texline @math{x^{n/2}}
22486  @infoline @expr{x^(n/2)}  @infoline @expr{x^(n/2)}
22487  only for even integers @expr{n}.  only for even integers @expr{n}.
22488    
22489  If @expr{a} is known to be real, @expr{b} is an even integer, and  If @expr{a} is known to be real, @expr{b} is an even integer, and
22490  @expr{c} is a half- or quarter-integer, then @expr{(a^b)^c} is  @expr{c} is a half- or quarter-integer, then @expr{(a^b)^c} is
22491  simplified to @expr{@t{abs}(a^(b c))}.  simplified to @expr{@tfn{abs}(a^(b c))}.
22492    
22493  Also, @expr{(-a)^b} is simplified to @expr{a^b} if @expr{b} is an  Also, @expr{(-a)^b} is simplified to @expr{a^b} if @expr{b} is an
22494  even integer, or to @expr{-(a^b)} if @expr{b} is an odd integer,  even integer, or to @expr{-(a^b)} if @expr{b} is an odd integer,
22495  for any negative-looking expression @expr{-a}.  for any negative-looking expression @expr{-a}.
22496    
22497  Square roots @expr{@t{sqrt}(x)} generally act like one-half powers  Square roots @expr{@tfn{sqrt}(x)} generally act like one-half powers
22498  @texline @math{x^{1:2}}  @texline @math{x^{1:2}}
22499  @infoline @expr{x^1:2}  @infoline @expr{x^1:2}
22500  for the purposes of the above-listed simplifications.  for the purposes of the above-listed simplifications.
# Line 22510  Also, note that Line 22505  Also, note that
22505  is changed to  is changed to
22506  @texline @math{x^{-1:2}},  @texline @math{x^{-1:2}},
22507  @infoline @expr{x^(-1:2)},  @infoline @expr{x^(-1:2)},
22508  but @expr{1 / @t{sqrt}(x)} is left alone.  but @expr{1 / @tfn{sqrt}(x)} is left alone.
22509    
22510  @tex  @tex
22511  \bigskip  \bigskip
22512  @end tex  @end tex
22513    
22514  Generic identity matrices (@pxref{Matrix Mode}) are simplified by the  Generic identity matrices (@pxref{Matrix Mode}) are simplified by the
22515  following rules:  @expr{@t{idn}(a) + b} to @expr{a + b} if @expr{b}  following rules:  @expr{@tfn{idn}(a) + b} to @expr{a + b} if @expr{b}
22516  is provably scalar, or expanded out if @expr{b} is a matrix;  is provably scalar, or expanded out if @expr{b} is a matrix;
22517  @expr{@t{idn}(a) + @t{idn}(b)} to @expr{@t{idn}(a + b)};  @expr{@tfn{idn}(a) + @tfn{idn}(b)} to @expr{@tfn{idn}(a + b)};
22518  @expr{-@t{idn}(a)} to @expr{@t{idn}(-a)}; @expr{a @t{idn}(b)} to  @expr{-@tfn{idn}(a)} to @expr{@tfn{idn}(-a)}; @expr{a @tfn{idn}(b)} to
22519  @expr{@t{idn}(a b)} if @expr{a} is provably scalar, or to @expr{a b}  @expr{@tfn{idn}(a b)} if @expr{a} is provably scalar, or to @expr{a b}
22520  if @expr{a} is provably non-scalar;  @expr{@t{idn}(a) @t{idn}(b)} to  if @expr{a} is provably non-scalar;  @expr{@tfn{idn}(a) @tfn{idn}(b)} to
22521  @expr{@t{idn}(a b)}; analogous simplifications for quotients involving  @expr{@tfn{idn}(a b)}; analogous simplifications for quotients involving
22522  @code{idn}; and @expr{@t{idn}(a)^n} to @expr{@t{idn}(a^n)} where  @code{idn}; and @expr{@tfn{idn}(a)^n} to @expr{@tfn{idn}(a^n)} where
22523  @expr{n} is an integer.  @expr{n} is an integer.
22524    
22525  @tex  @tex
# Line 22533  if @expr{a} is provably non-scalar;  @ex Line 22528  if @expr{a} is provably non-scalar;  @ex
22528    
22529  The @code{floor} function and other integer truncation functions  The @code{floor} function and other integer truncation functions
22530  vanish if the argument is provably integer-valued, so that  vanish if the argument is provably integer-valued, so that
22531  @expr{@t{floor}(@t{round}(x))} simplifies to @expr{@t{round}(x)}.  @expr{@tfn{floor}(@tfn{round}(x))} simplifies to @expr{@tfn{round}(x)}.
22532  Also, combinations of @code{float}, @code{floor} and its friends,  Also, combinations of @code{float}, @code{floor} and its friends,
22533  and @code{ffloor} and its friends, are simplified in appropriate  and @code{ffloor} and its friends, are simplified in appropriate
22534  ways.  @xref{Integer Truncation}.  ways.  @xref{Integer Truncation}.
22535    
22536  The expression @expr{@t{abs}(-x)} changes to @expr{@t{abs}(x)}.  The expression @expr{@tfn{abs}(-x)} changes to @expr{@tfn{abs}(x)}.
22537  The expression @expr{@t{abs}(@t{abs}(x))} changes to  The expression @expr{@tfn{abs}(@tfn{abs}(x))} changes to
22538  @expr{@t{abs}(x)};  in fact, @expr{@t{abs}(x)} changes to @expr{x} or  @expr{@tfn{abs}(x)};  in fact, @expr{@tfn{abs}(x)} changes to @expr{x} or
22539  @expr{-x} if @expr{x} is provably nonnegative or nonpositive  @expr{-x} if @expr{x} is provably nonnegative or nonpositive
22540  (@pxref{Declarations}).  (@pxref{Declarations}).
22541    
22542  While most functions do not recognize the variable @code{i} as an  While most functions do not recognize the variable @code{i} as an
22543  imaginary number, the @code{arg} function does handle the two cases  imaginary number, the @code{arg} function does handle the two cases
22544  @expr{@t{arg}(@t{i})} and @expr{@t{arg}(-@t{i})} just for convenience.  @expr{@tfn{arg}(@tfn{i})} and @expr{@tfn{arg}(-@tfn{i})} just for convenience.
22545    
22546  The expression @expr{@t{conj}(@t{conj}(x))} simplifies to @expr{x}.  The expression @expr{@tfn{conj}(@tfn{conj}(x))} simplifies to @expr{x}.
22547  Various other expressions involving @code{conj}, @code{re}, and  Various other expressions involving @code{conj}, @code{re}, and
22548  @code{im} are simplified, especially if some of the arguments are  @code{im} are simplified, especially if some of the arguments are
22549  provably real or involve the constant @code{i}.  For example,  provably real or involve the constant @code{i}.  For example,
22550  @expr{@t{conj}(a + b i)} is changed to  @expr{@tfn{conj}(a + b i)} is changed to
22551  @expr{@t{conj}(a) - @t{conj}(b) i},  or to @expr{a - b i} if @expr{a}  @expr{@tfn{conj}(a) - @tfn{conj}(b) i},  or to @expr{a - b i} if @expr{a}
22552  and @expr{b} are known to be real.  and @expr{b} are known to be real.
22553    
22554  Functions like @code{sin} and @code{arctan} generally don't have  Functions like @code{sin} and @code{arctan} generally don't have
# Line 22563  described in the next section does provi Line 22558  described in the next section does provi
22558  these functions, though.  these functions, though.
22559    
22560  One important simplification that does occur is that  One important simplification that does occur is that
22561  @expr{@t{ln}(@t{e})} is simplified to 1, and @expr{@t{ln}(@t{e}^x)} is  @expr{@tfn{ln}(@tfn{e})} is simplified to 1, and @expr{@tfn{ln}(@tfn{e}^x)} is
22562  simplified to @expr{x} for any @expr{x}.  This occurs even if you have  simplified to @expr{x} for any @expr{x}.  This occurs even if you have
22563  stored a different value in the Calc variable @samp{e}; but this would  stored a different value in the Calc variable @samp{e}; but this would
22564  be a bad idea in any case if you were also using natural logarithms!  be a bad idea in any case if you were also using natural logarithms!
22565    
22566  Among the logical functions, @t{(@var{a} <= @var{b})} changes to  Among the logical functions, @tfn{(@var{a} <= @var{b})} changes to
22567  @t{@var{a} > @var{b}} and so on.  Equations and inequalities where both sides  @tfn{@var{a} > @var{b}} and so on.  Equations and inequalities where both sides
22568  are either negative-looking or zero are simplified by negating both sides  are either negative-looking or zero are simplified by negating both sides
22569  and reversing the inequality.  While it might seem reasonable to simplify  and reversing the inequality.  While it might seem reasonable to simplify
22570  @expr{!!x} to @expr{x}, this would not be valid in general because  @expr{!!x} to @expr{x}, this would not be valid in general because
# Line 22693  user might not have been thinking of. Line 22688  user might not have been thinking of.
22688  Square roots of integer or rational arguments are simplified in  Square roots of integer or rational arguments are simplified in
22689  several ways.  (Note that these will be left unevaluated only in  several ways.  (Note that these will be left unevaluated only in
22690  Symbolic mode.)  First, square integer or rational factors are  Symbolic mode.)  First, square integer or rational factors are
22691  pulled out so that @expr{@t{sqrt}(8)} is rewritten as  pulled out so that @expr{@tfn{sqrt}(8)} is rewritten as
22692  @texline @math{2\,\t{sqrt}(2)}.  @texline @math{2\,@tfn{sqrt}(2)}.
22693  @infoline @expr{2 sqrt(2)}.    @infoline @expr{2 sqrt(2)}.  
22694  Conceptually speaking this implies factoring the argument into primes  Conceptually speaking this implies factoring the argument into primes
22695  and moving pairs of primes out of the square root, but for reasons of  and moving pairs of primes out of the square root, but for reasons of
22696  efficiency Calc only looks for primes up to 29.  efficiency Calc only looks for primes up to 29.
22697    
22698  Square roots in the denominator of a quotient are moved to the  Square roots in the denominator of a quotient are moved to the
22699  numerator:  @expr{1 / @t{sqrt}(3)} changes to @expr{@t{sqrt}(3) / 3}.  numerator:  @expr{1 / @tfn{sqrt}(3)} changes to @expr{@tfn{sqrt}(3) / 3}.
22700  The same effect occurs for the square root of a fraction:  The same effect occurs for the square root of a fraction:
22701  @expr{@t{sqrt}(2:3)} changes to @expr{@t{sqrt}(6) / 3}.  @expr{@tfn{sqrt}(2:3)} changes to @expr{@tfn{sqrt}(6) / 3}.
22702    
22703  @tex  @tex
22704  \bigskip  \bigskip
# Line 22736  declared to be an integer. Line 22731  declared to be an integer.
22731  @end tex  @end tex
22732    
22733  Trigonometric functions are simplified in several ways.  First,  Trigonometric functions are simplified in several ways.  First,
22734  @expr{@t{sin}(@t{arcsin}(x))} is simplified to @expr{x}, and  @expr{@tfn{sin}(@tfn{arcsin}(x))} is simplified to @expr{x}, and
22735  similarly for @code{cos} and @code{tan}.  If the argument to  similarly for @code{cos} and @code{tan}.  If the argument to
22736  @code{sin} is negative-looking, it is simplified to  @code{sin} is negative-looking, it is simplified to
22737  @expr{-@t{sin}(x),},  and similarly for @code{cos} and @code{tan}.  @expr{-@tfn{sin}(x),},  and similarly for @code{cos} and @code{tan}.
22738  Finally, certain special values of the argument are recognized;  Finally, certain special values of the argument are recognized;
22739  @pxref{Trigonometric and Hyperbolic Functions}.  @pxref{Trigonometric and Hyperbolic Functions}.
22740    
22741  Trigonometric functions of inverses of different trigonometric  Trigonometric functions of inverses of different trigonometric
22742  functions can also be simplified, as in @expr{@t{sin}(@t{arccos}(x))}  functions can also be simplified, as in @expr{@tfn{sin}(@tfn{arccos}(x))}
22743  to @expr{@t{sqrt}(1 - x^2)}.  to @expr{@tfn{sqrt}(1 - x^2)}.
22744    
22745  Hyperbolic functions of their inverses and of negative-looking  Hyperbolic functions of their inverses and of negative-looking
22746  arguments are also handled, as are exponentials of inverse  arguments are also handled, as are exponentials of inverse
# Line 22754  hyperbolic functions. Line 22749  hyperbolic functions.
22749  No simplifications for inverse trigonometric and hyperbolic  No simplifications for inverse trigonometric and hyperbolic
22750  functions are known, except for negative arguments of @code{arcsin},  functions are known, except for negative arguments of @code{arcsin},
22751  @code{arctan}, @code{arcsinh}, and @code{arctanh}.  Note that  @code{arctan}, @code{arcsinh}, and @code{arctanh}.  Note that
22752  @expr{@t{arcsin}(@t{sin}(x))} can @emph{not} safely change to  @expr{@tfn{arcsin}(@tfn{sin}(x))} can @emph{not} safely change to
22753  @expr{x}, since this only correct within an integer multiple of  @expr{x}, since this only correct within an integer multiple of
22754  @texline @math{2 \pi}  @texline @math{2 \pi}
22755  @infoline @expr{2 pi}  @infoline @expr{2 pi}
22756  radians or 360 degrees.  However, @expr{@t{arcsinh}(@t{sinh}(x))} is  radians or 360 degrees.  However, @expr{@tfn{arcsinh}(@tfn{sinh}(x))} is
22757  simplified to @expr{x} if @expr{x} is known to be real.  simplified to @expr{x} if @expr{x} is known to be real.
22758    
22759  Several simplifications that apply to logarithms and exponentials  Several simplifications that apply to logarithms and exponentials
22760  are that @expr{@t{exp}(@t{ln}(x))},  are that @expr{@tfn{exp}(@tfn{ln}(x))},
22761  @texline @t{e}@math{^{\ln(x)}},  @texline @tfn{e}@math{^{\ln(x)}},
22762  @infoline @expr{e^@t{ln}(x)},  @infoline @expr{e^@tfn{ln}(x)},
22763  and  and
22764  @texline @math{10^{{\rm log10}(x)}}  @texline @math{10^{{\rm log10}(x)}}
22765  @infoline @expr{10^@t{log10}(x)}  @infoline @expr{10^@tfn{log10}(x)}
22766  all reduce to @expr{x}.  Also, @expr{@t{ln}(@t{exp}(x))}, etc., can  all reduce to @expr{x}.  Also, @expr{@tfn{ln}(@tfn{exp}(x))}, etc., can
22767  reduce to @expr{x} if @expr{x} is provably real.  The form  reduce to @expr{x} if @expr{x} is provably real.  The form
22768  @expr{@t{exp}(x)^y} is simplified to @expr{@t{exp}(x y)}.  If @expr{x}  @expr{@tfn{exp}(x)^y} is simplified to @expr{@tfn{exp}(x y)}.  If @expr{x}
22769  is a suitable multiple of  is a suitable multiple of
22770  @texline @math{\pi i}  @texline @math{\pi i}
22771  @infoline @expr{pi i}  @infoline @expr{pi i}
22772  (as described above for the trigonometric functions), then  (as described above for the trigonometric functions), then
22773  @expr{@t{exp}(x)} or @expr{e^x} will be expanded.  Finally,  @expr{@tfn{exp}(x)} or @expr{e^x} will be expanded.  Finally,
22774  @expr{@t{ln}(x)} is simplified to a form involving @code{pi} and  @expr{@tfn{ln}(x)} is simplified to a form involving @code{pi} and
22775  @code{i} where @expr{x} is provably negative, positive imaginary, or  @code{i} where @expr{x} is provably negative, positive imaginary, or
22776  negative imaginary.  negative imaginary.
22777    
# Line 22848  by @kbd{a e}. Line 22843  by @kbd{a e}.
22843    
22844  Inverse trigonometric or hyperbolic functions, called with their  Inverse trigonometric or hyperbolic functions, called with their
22845  corresponding non-inverse functions as arguments, are simplified  corresponding non-inverse functions as arguments, are simplified
22846  by @kbd{a e}.  For example, @expr{@t{arcsin}(@t{sin}(x))} changes  by @kbd{a e}.  For example, @expr{@tfn{arcsin}(@tfn{sin}(x))} changes
22847  to @expr{x}.  Also, @expr{@t{arcsin}(@t{cos}(x))} and  to @expr{x}.  Also, @expr{@tfn{arcsin}(@tfn{cos}(x))} and
22848  @expr{@t{arccos}(@t{sin}(x))} both change to @expr{@t{pi}/2 - x}.  @expr{@tfn{arccos}(@tfn{sin}(x))} both change to @expr{@tfn{pi}/2 - x}.
22849  These simplifications are unsafe because they are valid only for  These simplifications are unsafe because they are valid only for
22850  values of @expr{x} in a certain range; outside that range, values  values of @expr{x} in a certain range; outside that range, values
22851  are folded down to the 360-degree range that the inverse trigonometric  are folded down to the 360-degree range that the inverse trigonometric
# Line 22866  in a restricted range of @expr{x}; for e Line 22861  in a restricted range of @expr{x}; for e
22861  the powers cancel to get @expr{x}, which is valid for positive values  the powers cancel to get @expr{x}, which is valid for positive values
22862  of @expr{x} but not for negative or complex values.  of @expr{x} but not for negative or complex values.
22863    
22864  Similarly, @expr{@t{sqrt}(x^a)} and @expr{@t{sqrt}(x)^a} are both  Similarly, @expr{@tfn{sqrt}(x^a)} and @expr{@tfn{sqrt}(x)^a} are both
22865  simplified (possibly unsafely) to  simplified (possibly unsafely) to
22866  @texline @math{x^{a/2}}.  @texline @math{x^{a/2}}.
22867  @infoline @expr{x^(a/2)}.  @infoline @expr{x^(a/2)}.
22868    
22869  Forms like @expr{@t{sqrt}(1 - sin(x)^2)} are simplified to, e.g.,  Forms like @expr{@tfn{sqrt}(1 - sin(x)^2)} are simplified to, e.g.,
22870  @expr{@t{cos}(x)}.  Calc has identities of this sort for @code{sin},  @expr{@tfn{cos}(x)}.  Calc has identities of this sort for @code{sin},
22871  @code{cos}, @code{tan}, @code{sinh}, and @code{cosh}.  @code{cos}, @code{tan}, @code{sinh}, and @code{cosh}.
22872    
22873  Arguments of square roots are partially factored to look for  Arguments of square roots are partially factored to look for
22874  squared terms that can be extracted.  For example,  squared terms that can be extracted.  For example,
22875  @expr{@t{sqrt}(a^2 b^3 + a^3 b^2)} simplifies to  @expr{@tfn{sqrt}(a^2 b^3 + a^3 b^2)} simplifies to
22876  @expr{a b @t{sqrt}(a+b)}.  @expr{a b @tfn{sqrt}(a+b)}.
22877    
22878  The simplifications of @expr{@t{ln}(@t{exp}(x))},  The simplifications of @expr{@tfn{ln}(@tfn{exp}(x))},
22879  @expr{@t{ln}(@t{e}^x)}, and @expr{@t{log10}(10^x)} to @expr{x} are also  @expr{@tfn{ln}(@tfn{e}^x)}, and @expr{@tfn{log10}(10^x)} to @expr{x} are also
22880  unsafe because of problems with principal values (although these  unsafe because of problems with principal values (although these
22881  simplifications are safe if @expr{x} is known to be real).  simplifications are safe if @expr{x} is known to be real).
22882    
# Line 24433  contain error forms.  The data values mu Line 24428  contain error forms.  The data values mu
24428  or all be plain numbers.  Error forms can go anywhere but generally  or all be plain numbers.  Error forms can go anywhere but generally
24429  go on the numbers in the last row of the data matrix.  If the last  go on the numbers in the last row of the data matrix.  If the last
24430  row contains error forms  row contains error forms
24431  @texline `@var{y_i}@w{ @t{+/-} }@math{\sigma_i}',  @texline `@var{y_i}@w{ @tfn{+/-} }@math{\sigma_i}',
24432  @infoline `@var{y_i}@w{ @t{+/-} }@var{sigma_i}',  @infoline `@var{y_i}@w{ @tfn{+/-} }@var{sigma_i}',
24433  then the  then the
24434  @texline @math{\chi^2}  @texline @math{\chi^2}
24435  @infoline @expr{chi^2}  @infoline @expr{chi^2}
# Line 24586  Linear or multilinear.  @mathit{a + b x Line 24581  Linear or multilinear.  @mathit{a + b x
24581  @item 2-9  @item 2-9
24582  Polynomials.  @mathit{a + b x + c x^2 + d x^3}.  Polynomials.  @mathit{a + b x + c x^2 + d x^3}.
24583  @item e  @item e
24584  Exponential.  @mathit{a} @t{exp}@mathit{(b x)} @t{exp}@mathit{(c y)}.  Exponential.  @mathit{a} @tfn{exp}@mathit{(b x)} @tfn{exp}@mathit{(c y)}.
24585  @item E  @item E
24586  Base-10 exponential.  @mathit{a} @t{10^}@mathit{(b x)} @t{10^}@mathit{(c y)}.  Base-10 exponential.  @mathit{a} @tfn{10^}@mathit{(b x)} @tfn{10^}@mathit{(c y)}.
24587  @item x  @item x
24588  Exponential (alternate notation).  @t{exp}@mathit{(a + b x + c y)}.  Exponential (alternate notation).  @tfn{exp}@mathit{(a + b x + c y)}.
24589  @item X  @item X
24590  Base-10 exponential (alternate).  @t{10^}@mathit{(a + b x + c y)}.  Base-10 exponential (alternate).  @tfn{10^}@mathit{(a + b x + c y)}.
24591  @item l  @item l
24592  Logarithmic.  @mathit{a + b} @t{ln}@mathit{(x) + c} @t{ln}@mathit{(y)}.  Logarithmic.  @mathit{a + b} @tfn{ln}@mathit{(x) + c} @tfn{ln}@mathit{(y)}.
24593  @item L  @item L
24594  Base-10 logarithmic.  @mathit{a + b} @t{log10}@mathit{(x) + c} @t{log10}@mathit{(y)}.  Base-10 logarithmic.  @mathit{a + b} @tfn{log10}@mathit{(x) + c} @tfn{log10}@mathit{(y)}.
24595  @item ^  @item ^
24596  General exponential.  @mathit{a b^x c^y}.  General exponential.  @mathit{a b^x c^y}.
24597  @item p  @item p
# Line 34783  keystrokes are not listed in this summar Line 34778  keystrokes are not listed in this summar
34778  @r{       @:      .     @:number       @:        @:@:0.number}  @r{       @:      .     @:number       @:        @:@:0.number}
34779  @r{       @:      _     @:number       @:        @:-@:number}  @r{       @:      _     @:number       @:        @:-@:number}
34780  @r{       @:      e     @:number       @:        @:@:1e number}  @r{       @:      e     @:number       @:        @:@:1e number}
34781  @r{       @:      #     @:number       @:        @:@:current-radix@t{#}number}  @r{       @:      #     @:number       @:        @:@:current-radix@tfn{#}number}
34782  @r{       @:      P     @:(in number)  @:        @:+/-@:}  @r{       @:      P     @:(in number)  @:        @:+/-@:}
34783  @r{       @:      M     @:(in number)  @:        @:mod@:}  @r{       @:      M     @:(in number)  @:        @:mod@:}
34784  @r{       @:      @@ ' " @:  (in number)@:        @:@:HMS form}  @r{       @:      @@ ' " @:  (in number)@:        @:@:HMS form}
# Line 35343  keystrokes are not listed in this summar Line 35338  keystrokes are not listed in this summar
35338  @r{       @:      s &   @:var          @: 29,47  @:calc-store-inv@:  (v^-1)}  @r{       @:      s &   @:var          @: 29,47  @:calc-store-inv@:  (v^-1)}
35339  @r{       @:      s [   @:var          @: 29,47  @:calc-store-decr@:  (v-1)}  @r{       @:      s [   @:var          @: 29,47  @:calc-store-decr@:  (v-1)}
35340  @r{       @:      s ]   @:var          @: 29,47  @:calc-store-incr@:  (v-(-1))}  @r{       @:      s ]   @:var          @: 29,47  @:calc-store-incr@:  (v-(-1))}
35341  @r{    a b@:      s :   @:             @:     2  @:assign@:(a,b)  a @t{:=} b}  @r{    a b@:      s :   @:             @:     2  @:assign@:(a,b)  a @tfn{:=} b}
35342  @r{      a@:      s =   @:             @:     1  @:evalto@:(a,b)  a @t{=>}}  @r{      a@:      s =   @:             @:     1  @:evalto@:(a,b)  a @tfn{=>}}
35343    
35344  @c  @c
35345  @r{       @:      t [   @:             @:     4  @:calc-trail-first@:}  @r{       @:      t [   @:             @:     4  @:calc-trail-first@:}

Legend:
Removed from v.1.46  
changed lines
  Added in v.1.47

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26