diff options
| author | Jay Belanger | 2004-12-14 04:53:56 +0000 |
|---|---|---|
| committer | Jay Belanger | 2004-12-14 04:53:56 +0000 |
| commit | 8e04863ed5559631ee420d43fa3ff5c58b7406ce (patch) | |
| tree | 91fb53a784c47f1d195961ab1194b96e571470ef | |
| parent | a0e4e2757acd079e2392ed976312d6b082119448 (diff) | |
| download | emacs-8e04863ed5559631ee420d43fa3ff5c58b7406ce.tar.gz emacs-8e04863ed5559631ee420d43fa3ff5c58b7406ce.zip | |
Replace @tmath macro with @math.
Fix TeX definition of @expr.
Replace @i by @mathi.
| -rw-r--r-- | man/calc.texi | 759 |
1 files changed, 376 insertions, 383 deletions
diff --git a/man/calc.texi b/man/calc.texi index 027ebc7c960..16447e4e953 100644 --- a/man/calc.texi +++ b/man/calc.texi | |||
| @@ -13,28 +13,20 @@ | |||
| 13 | @c @infoline foo | 13 | @c @infoline foo |
| 14 | @c `foo' will appear only in non-TeX output | 14 | @c `foo' will appear only in non-TeX output |
| 15 | 15 | ||
| 16 | @c In TeX output, @tmath{expr} will typeset expr in math mode. | 16 | @c @expr{expr} will typeset an expression; |
| 17 | @c In any output, @expr{expr} will typeset an expression; | ||
| 18 | @c $x$ in TeX, @samp{x} otherwise. | 17 | @c $x$ in TeX, @samp{x} otherwise. |
| 19 | 18 | ||
| 20 | @iftex | 19 | @iftex |
| 21 | @macro texline{stuff} | 20 | @macro texline{stuff} |
| 22 | \stuff\ | 21 | \stuff\ |
| 23 | @end macro | 22 | @end macro |
| 24 | @macro tmath{stuff} | ||
| 25 | @tex | ||
| 26 | $\stuff\$ | ||
| 27 | @end tex | ||
| 28 | @end macro | ||
| 29 | @alias infoline=comment | 23 | @alias infoline=comment |
| 30 | @c @alias expr=math | ||
| 31 | @tex | 24 | @tex |
| 32 | \gdef\expr#1{\tex | 25 | \gdef\exprsetup{\tex \let\t\ttfont \turnoffactive} |
| 33 | \let\t\ttfont | 26 | \gdef\expr{\exprsetup$\exprfinish} |
| 34 | \turnoffactive | 27 | \gdef\exprfinish#1{#1$\endgroup} |
| 35 | $#1$ | ||
| 36 | \endgroup} | ||
| 37 | @end tex | 28 | @end tex |
| 29 | @alias mathit=expr | ||
| 38 | @macro cpi{} | 30 | @macro cpi{} |
| 39 | @math{@pi{}} | 31 | @math{@pi{}} |
| 40 | @end macro | 32 | @end macro |
| @@ -49,6 +41,7 @@ $\stuff\$ | |||
| 49 | \stuff\ | 41 | \stuff\ |
| 50 | @end macro | 42 | @end macro |
| 51 | @alias expr=samp | 43 | @alias expr=samp |
| 44 | @alias mathit=i | ||
| 52 | @macro cpi{} | 45 | @macro cpi{} |
| 53 | @expr{pi} | 46 | @expr{pi} |
| 54 | @end macro | 47 | @end macro |
| @@ -624,12 +617,12 @@ then the command to operate on the numbers. | |||
| 624 | 617 | ||
| 625 | @noindent | 618 | @noindent |
| 626 | Type @kbd{2 @key{RET} 3 + Q} to compute | 619 | Type @kbd{2 @key{RET} 3 + Q} to compute |
| 627 | @texline @tmath{\sqrt{2+3} = 2.2360679775}. | 620 | @texline @math{\sqrt{2+3} = 2.2360679775}. |
| 628 | @infoline the square root of 2+3, which is 2.2360679775. | 621 | @infoline the square root of 2+3, which is 2.2360679775. |
| 629 | 622 | ||
| 630 | @noindent | 623 | @noindent |
| 631 | Type @kbd{P 2 ^} to compute | 624 | Type @kbd{P 2 ^} to compute |
| 632 | @texline @tmath{\pi^2 = 9.86960440109}. | 625 | @texline @math{\pi^2 = 9.86960440109}. |
| 633 | @infoline the value of `pi' squared, 9.86960440109. | 626 | @infoline the value of `pi' squared, 9.86960440109. |
| 634 | 627 | ||
| 635 | @noindent | 628 | @noindent |
| @@ -648,12 +641,12 @@ use the apostrophe key. | |||
| 648 | 641 | ||
| 649 | @noindent | 642 | @noindent |
| 650 | Type @kbd{' sqrt(2+3) @key{RET}} to compute | 643 | Type @kbd{' sqrt(2+3) @key{RET}} to compute |
| 651 | @texline @tmath{\sqrt{2+3}}. | 644 | @texline @math{\sqrt{2+3}}. |
| 652 | @infoline the square root of 2+3. | 645 | @infoline the square root of 2+3. |
| 653 | 646 | ||
| 654 | @noindent | 647 | @noindent |
| 655 | Type @kbd{' pi^2 @key{RET}} to enter | 648 | Type @kbd{' pi^2 @key{RET}} to enter |
| 656 | @texline @tmath{\pi^2}. | 649 | @texline @math{\pi^2}. |
| 657 | @infoline `pi' squared. | 650 | @infoline `pi' squared. |
| 658 | To evaluate this symbolic formula as a number, type @kbd{=}. | 651 | To evaluate this symbolic formula as a number, type @kbd{=}. |
| 659 | 652 | ||
| @@ -713,10 +706,10 @@ the lower-right @samp{8} and press @kbd{M-# r}. | |||
| 713 | 706 | ||
| 714 | @noindent | 707 | @noindent |
| 715 | Type @kbd{v t} to transpose this | 708 | Type @kbd{v t} to transpose this |
| 716 | @texline @tmath{3\times2} | 709 | @texline @math{3\times2} |
| 717 | @infoline 3x2 | 710 | @infoline 3x2 |
| 718 | matrix into a | 711 | matrix into a |
| 719 | @texline @tmath{2\times3} | 712 | @texline @math{2\times3} |
| 720 | @infoline 2x3 | 713 | @infoline 2x3 |
| 721 | matrix. Type @w{@kbd{v u}} to unpack the rows into two separate | 714 | matrix. Type @w{@kbd{v u}} to unpack the rows into two separate |
| 722 | vectors. Now type @w{@kbd{V R + @key{TAB} V R +}} to compute the sums | 715 | vectors. Now type @w{@kbd{V R + @key{TAB} V R +}} to compute the sums |
| @@ -867,9 +860,9 @@ you do. | |||
| 867 | 860 | ||
| 868 | In this case, the trail shows that four numbers (17.3, 3, 2, and 4) | 861 | In this case, the trail shows that four numbers (17.3, 3, 2, and 4) |
| 869 | were first entered into the Calculator, then the 2 and 4 were | 862 | were first entered into the Calculator, then the 2 and 4 were |
| 870 | multiplied to get 8, then the 3 and 8 were subtracted to get @i{-5}. | 863 | multiplied to get 8, then the 3 and 8 were subtracted to get @mathit{-5}. |
| 871 | (The @samp{>} symbol shows that this was the most recent calculation.) | 864 | (The @samp{>} symbol shows that this was the most recent calculation.) |
| 872 | The net result is the two numbers 17.3 and @i{-5} sitting on the stack. | 865 | The net result is the two numbers 17.3 and @mathit{-5} sitting on the stack. |
| 873 | 866 | ||
| 874 | Most Calculator commands deal explicitly with the stack only, but | 867 | Most Calculator commands deal explicitly with the stack only, but |
| 875 | there is a set of commands that allow you to search back through | 868 | there is a set of commands that allow you to search back through |
| @@ -930,7 +923,7 @@ full complexity of the stack and trail. To use it, type @kbd{M-# q} | |||
| 930 | 923 | ||
| 931 | Quick Mode is very simple: It prompts you to type any formula in | 924 | Quick Mode is very simple: It prompts you to type any formula in |
| 932 | standard algebraic notation (like @samp{4 - 2/3}) and then displays | 925 | standard algebraic notation (like @samp{4 - 2/3}) and then displays |
| 933 | the result at the bottom of the Emacs screen (@i{3.33333333333} | 926 | the result at the bottom of the Emacs screen (@mathit{3.33333333333} |
| 934 | in this case). You are then back in the same editing buffer you | 927 | in this case). You are then back in the same editing buffer you |
| 935 | were in before, ready to continue editing or to type @kbd{M-# q} | 928 | were in before, ready to continue editing or to type @kbd{M-# q} |
| 936 | again to do another quick calculation. The result of the calculation | 929 | again to do another quick calculation. The result of the calculation |
| @@ -1343,7 +1336,7 @@ With any prefix argument, reset everything but the stack. | |||
| 1343 | Calc was originally started as a two-week project to occupy a lull | 1336 | Calc was originally started as a two-week project to occupy a lull |
| 1344 | in the author's schedule. Basically, a friend asked if I remembered | 1337 | in the author's schedule. Basically, a friend asked if I remembered |
| 1345 | the value of | 1338 | the value of |
| 1346 | @texline @tmath{2^{32}}. | 1339 | @texline @math{2^{32}}. |
| 1347 | @infoline @expr{2^32}. | 1340 | @infoline @expr{2^32}. |
| 1348 | I didn't offhand, but I said, ``that's easy, just call up an | 1341 | I didn't offhand, but I said, ``that's easy, just call up an |
| 1349 | @code{xcalc}.'' @code{Xcalc} duly reported that the answer to our | 1342 | @code{xcalc}.'' @code{Xcalc} duly reported that the answer to our |
| @@ -1665,7 +1658,7 @@ multiplication.) Figure it out by hand, then try it with Calc to see | |||
| 1665 | if you're right. @xref{RPN Answer 1, 1}. (@bullet{}) | 1658 | if you're right. @xref{RPN Answer 1, 1}. (@bullet{}) |
| 1666 | 1659 | ||
| 1667 | (@bullet{}) @strong{Exercise 2.} Compute | 1660 | (@bullet{}) @strong{Exercise 2.} Compute |
| 1668 | @texline @tmath{(2\times4) + (7\times9.4) + {5\over4}} | 1661 | @texline @math{(2\times4) + (7\times9.4) + {5\over4}} |
| 1669 | @infoline @expr{2*4 + 7*9.5 + 5/4} | 1662 | @infoline @expr{2*4 + 7*9.5 + 5/4} |
| 1670 | using the stack. @xref{RPN Answer 2, 2}. (@bullet{}) | 1663 | using the stack. @xref{RPN Answer 2, 2}. (@bullet{}) |
| 1671 | 1664 | ||
| @@ -2000,7 +1993,7 @@ $$ 2 + { 3 \times 4 \times 5 \over 6 \times 7^8 } - 9 $$ | |||
| 2000 | @end tex | 1993 | @end tex |
| 2001 | 1994 | ||
| 2002 | @noindent | 1995 | @noindent |
| 2003 | The result of this expression will be the number @i{-6.99999826533}. | 1996 | The result of this expression will be the number @mathit{-6.99999826533}. |
| 2004 | 1997 | ||
| 2005 | Calc's order of evaluation is the same as for most computer languages, | 1998 | Calc's order of evaluation is the same as for most computer languages, |
| 2006 | except that @samp{*} binds more strongly than @samp{/}, as the above | 1999 | except that @samp{*} binds more strongly than @samp{/}, as the above |
| @@ -2009,7 +2002,7 @@ can often be omitted: @samp{2 a} is the same as @samp{2*a}. | |||
| 2009 | 2002 | ||
| 2010 | Operators at the same level are evaluated from left to right, except | 2003 | Operators at the same level are evaluated from left to right, except |
| 2011 | that @samp{^} is evaluated from right to left. Thus, @samp{2-3-4} is | 2004 | that @samp{^} is evaluated from right to left. Thus, @samp{2-3-4} is |
| 2012 | equivalent to @samp{(2-3)-4} or @i{-5}, whereas @samp{2^3^4} is equivalent | 2005 | equivalent to @samp{(2-3)-4} or @mathit{-5}, whereas @samp{2^3^4} is equivalent |
| 2013 | to @samp{2^(3^4)} (a very large integer; try it!). | 2006 | to @samp{2^(3^4)} (a very large integer; try it!). |
| 2014 | 2007 | ||
| 2015 | If you tire of typing the apostrophe all the time, there is an | 2008 | If you tire of typing the apostrophe all the time, there is an |
| @@ -2079,7 +2072,7 @@ accomplish this in Calc by performing your calculation as a series | |||
| 2079 | of algebraic entries, using the @kbd{$} sign to tie them together. | 2072 | of algebraic entries, using the @kbd{$} sign to tie them together. |
| 2080 | In an algebraic formula, @kbd{$} represents the number on the top | 2073 | In an algebraic formula, @kbd{$} represents the number on the top |
| 2081 | of the stack. Here, we perform the calculation | 2074 | of the stack. Here, we perform the calculation |
| 2082 | @texline @tmath{\sqrt{2\times4+1}}, | 2075 | @texline @math{\sqrt{2\times4+1}}, |
| 2083 | @infoline @expr{sqrt(2*4+1)}, | 2076 | @infoline @expr{sqrt(2*4+1)}, |
| 2084 | which on a traditional calculator would be done by pressing | 2077 | which on a traditional calculator would be done by pressing |
| 2085 | @kbd{2 * 4 + 1 =} and then the square-root key. | 2078 | @kbd{2 * 4 + 1 =} and then the square-root key. |
| @@ -2741,11 +2734,11 @@ angle is measured in degrees. For example, | |||
| 2741 | @noindent | 2734 | @noindent |
| 2742 | The shift-@kbd{S} command computes the sine of an angle. The sine | 2735 | The shift-@kbd{S} command computes the sine of an angle. The sine |
| 2743 | of 45 degrees is | 2736 | of 45 degrees is |
| 2744 | @texline @tmath{\sqrt{2}/2}; | 2737 | @texline @math{\sqrt{2}/2}; |
| 2745 | @infoline @expr{sqrt(2)/2}; | 2738 | @infoline @expr{sqrt(2)/2}; |
| 2746 | squaring this yields @expr{2/4 = 0.5}. However, there has been a slight | 2739 | squaring this yields @expr{2/4 = 0.5}. However, there has been a slight |
| 2747 | roundoff error because the representation of | 2740 | roundoff error because the representation of |
| 2748 | @texline @tmath{\sqrt{2}/2} | 2741 | @texline @math{\sqrt{2}/2} |
| 2749 | @infoline @expr{sqrt(2)/2} | 2742 | @infoline @expr{sqrt(2)/2} |
| 2750 | wasn't exact. The @kbd{c 1} command is a handy way to clean up numbers | 2743 | wasn't exact. The @kbd{c 1} command is a handy way to clean up numbers |
| 2751 | in this case; it temporarily reduces the precision by one digit while it | 2744 | in this case; it temporarily reduces the precision by one digit while it |
| @@ -2786,7 +2779,7 @@ either radians or degrees, depending on the current angular mode. | |||
| 2786 | 2779 | ||
| 2787 | @noindent | 2780 | @noindent |
| 2788 | Here we compute the Inverse Sine of | 2781 | Here we compute the Inverse Sine of |
| 2789 | @texline @tmath{\sqrt{0.5}}, | 2782 | @texline @math{\sqrt{0.5}}, |
| 2790 | @infoline @expr{sqrt(0.5)}, | 2783 | @infoline @expr{sqrt(0.5)}, |
| 2791 | first in radians, then in degrees. | 2784 | first in radians, then in degrees. |
| 2792 | 2785 | ||
| @@ -2974,9 +2967,9 @@ logarithm). These can be modified by the @kbd{I} (inverse) and | |||
| 2974 | 2967 | ||
| 2975 | Let's compute the sine and cosine of an angle, and verify the | 2968 | Let's compute the sine and cosine of an angle, and verify the |
| 2976 | identity | 2969 | identity |
| 2977 | @texline @tmath{\sin^2x + \cos^2x = 1}. | 2970 | @texline @math{\sin^2x + \cos^2x = 1}. |
| 2978 | @infoline @expr{sin(x)^2 + cos(x)^2 = 1}. | 2971 | @infoline @expr{sin(x)^2 + cos(x)^2 = 1}. |
| 2979 | We'll arbitrarily pick @i{-64} degrees as a good value for @expr{x}. | 2972 | We'll arbitrarily pick @mathit{-64} degrees as a good value for @expr{x}. |
| 2980 | With the angular mode set to degrees (type @w{@kbd{m d}}), do: | 2973 | With the angular mode set to degrees (type @w{@kbd{m d}}), do: |
| 2981 | 2974 | ||
| 2982 | @smallexample | 2975 | @smallexample |
| @@ -2997,7 +2990,7 @@ Remember, @kbd{f h} is the @code{calc-hypot}, or square-root of sum | |||
| 2997 | of squares, command. | 2990 | of squares, command. |
| 2998 | 2991 | ||
| 2999 | Another identity is | 2992 | Another identity is |
| 3000 | @texline @tmath{\displaystyle\tan x = {\sin x \over \cos x}}. | 2993 | @texline @math{\displaystyle\tan x = {\sin x \over \cos x}}. |
| 3001 | @infoline @expr{tan(x) = sin(x) / cos(x)}. | 2994 | @infoline @expr{tan(x) = sin(x) / cos(x)}. |
| 3002 | @smallexample | 2995 | @smallexample |
| 3003 | @group | 2996 | @group |
| @@ -3012,7 +3005,7 @@ Another identity is | |||
| 3012 | 3005 | ||
| 3013 | A physical interpretation of this calculation is that if you move | 3006 | A physical interpretation of this calculation is that if you move |
| 3014 | @expr{0.89879} units downward and @expr{0.43837} units to the right, | 3007 | @expr{0.89879} units downward and @expr{0.43837} units to the right, |
| 3015 | your direction of motion is @i{-64} degrees from horizontal. Suppose | 3008 | your direction of motion is @mathit{-64} degrees from horizontal. Suppose |
| 3016 | we move in the opposite direction, up and to the left: | 3009 | we move in the opposite direction, up and to the left: |
| 3017 | 3010 | ||
| 3018 | @smallexample | 3011 | @smallexample |
| @@ -3060,7 +3053,7 @@ the top two stack elements right after the @kbd{U U}, then a pair of | |||
| 3060 | 3053 | ||
| 3061 | A similar identity is supposed to hold for hyperbolic sines and cosines, | 3054 | A similar identity is supposed to hold for hyperbolic sines and cosines, |
| 3062 | except that it is the @emph{difference} | 3055 | except that it is the @emph{difference} |
| 3063 | @texline @tmath{\cosh^2x - \sinh^2x} | 3056 | @texline @math{\cosh^2x - \sinh^2x} |
| 3064 | @infoline @expr{cosh(x)^2 - sinh(x)^2} | 3057 | @infoline @expr{cosh(x)^2 - sinh(x)^2} |
| 3065 | that always equals one. Let's try to verify this identity. | 3058 | that always equals one. Let's try to verify this identity. |
| 3066 | 3059 | ||
| @@ -3167,7 +3160,7 @@ in this case). | |||
| 3167 | 3160 | ||
| 3168 | If you take the factorial of a non-integer, Calc uses a generalized | 3161 | If you take the factorial of a non-integer, Calc uses a generalized |
| 3169 | factorial function defined in terms of Euler's Gamma function | 3162 | factorial function defined in terms of Euler's Gamma function |
| 3170 | @texline @tmath{\Gamma(n)} | 3163 | @texline @math{\Gamma(n)} |
| 3171 | @infoline @expr{gamma(n)} | 3164 | @infoline @expr{gamma(n)} |
| 3172 | (which is itself available as the @kbd{f g} command). | 3165 | (which is itself available as the @kbd{f g} command). |
| 3173 | 3166 | ||
| @@ -3184,13 +3177,13 @@ factorial function defined in terms of Euler's Gamma function | |||
| 3184 | 3177 | ||
| 3185 | @noindent | 3178 | @noindent |
| 3186 | Here we verify the identity | 3179 | Here we verify the identity |
| 3187 | @texline @tmath{n! = \Gamma(n+1)}. | 3180 | @texline @math{n! = \Gamma(n+1)}. |
| 3188 | @infoline @expr{@var{n}!@: = gamma(@var{n}+1)}. | 3181 | @infoline @expr{@var{n}!@: = gamma(@var{n}+1)}. |
| 3189 | 3182 | ||
| 3190 | The binomial coefficient @var{n}-choose-@var{m} | 3183 | The binomial coefficient @var{n}-choose-@var{m} |
| 3191 | @texline or @tmath{\displaystyle {n \choose m}} | 3184 | @texline or @math{\displaystyle {n \choose m}} |
| 3192 | is defined by | 3185 | is defined by |
| 3193 | @texline @tmath{\displaystyle {n! \over m! \, (n-m)!}} | 3186 | @texline @math{\displaystyle {n! \over m! \, (n-m)!}} |
| 3194 | @infoline @expr{n!@: / m!@: (n-m)!} | 3187 | @infoline @expr{n!@: / m!@: (n-m)!} |
| 3195 | for all reals @expr{n} and @expr{m}. The intermediate results in this | 3188 | for all reals @expr{n} and @expr{m}. The intermediate results in this |
| 3196 | formula can become quite large even if the final result is small; the | 3189 | formula can become quite large even if the final result is small; the |
| @@ -3475,7 +3468,7 @@ vector. | |||
| 3475 | 3468 | ||
| 3476 | (@bullet{}) @strong{Exercise 1.} Use @samp{*} to sum along the rows | 3469 | (@bullet{}) @strong{Exercise 1.} Use @samp{*} to sum along the rows |
| 3477 | of the above | 3470 | of the above |
| 3478 | @texline @tmath{2\times3} | 3471 | @texline @math{2\times3} |
| 3479 | @infoline 2x3 | 3472 | @infoline 2x3 |
| 3480 | matrix to get @expr{[6, 15]}. Now use @samp{*} to sum along the columns | 3473 | matrix to get @expr{[6, 15]}. Now use @samp{*} to sum along the columns |
| 3481 | to get @expr{[5, 7, 9]}. | 3474 | to get @expr{[5, 7, 9]}. |
| @@ -3626,10 +3619,10 @@ assume the vector was a row vector in order to make the dimensions | |||
| 3626 | come out right, and the answer would be incorrect. If you | 3619 | come out right, and the answer would be incorrect. If you |
| 3627 | don't feel safe letting Calc take either interpretation of your | 3620 | don't feel safe letting Calc take either interpretation of your |
| 3628 | vectors, use explicit | 3621 | vectors, use explicit |
| 3629 | @texline @tmath{N\times1} | 3622 | @texline @math{N\times1} |
| 3630 | @infoline Nx1 | 3623 | @infoline Nx1 |
| 3631 | or | 3624 | or |
| 3632 | @texline @tmath{1\times N} | 3625 | @texline @math{1\times N} |
| 3633 | @infoline 1xN | 3626 | @infoline 1xN |
| 3634 | matrices instead. In this case, you would enter the original column | 3627 | matrices instead. In this case, you would enter the original column |
| 3635 | vector as @samp{[[6], [2], [3]]} or @samp{[6; 2; 3]}. | 3628 | vector as @samp{[[6], [2], [3]]} or @samp{[6; 2; 3]}. |
| @@ -3678,7 +3671,7 @@ on the left by the transpose of @expr{A}: | |||
| 3678 | $A^T A \, X = A^T B$, where $A^T$ is the transpose \samp{trn(A)}. | 3671 | $A^T A \, X = A^T B$, where $A^T$ is the transpose \samp{trn(A)}. |
| 3679 | @end tex | 3672 | @end tex |
| 3680 | Now | 3673 | Now |
| 3681 | @texline @tmath{A^T A} | 3674 | @texline @math{A^T A} |
| 3682 | @infoline @expr{trn(A)*A} | 3675 | @infoline @expr{trn(A)*A} |
| 3683 | is a square matrix so a solution is possible. It turns out that the | 3676 | is a square matrix so a solution is possible. It turns out that the |
| 3684 | @expr{X} vector you compute in this way will be a ``least-squares'' | 3677 | @expr{X} vector you compute in this way will be a ``least-squares'' |
| @@ -3774,7 +3767,7 @@ of each element. | |||
| 3774 | 3767 | ||
| 3775 | (@bullet{}) @strong{Exercise 1.} Compute a vector of powers of two | 3768 | (@bullet{}) @strong{Exercise 1.} Compute a vector of powers of two |
| 3776 | from | 3769 | from |
| 3777 | @texline @tmath{2^{-4}} | 3770 | @texline @math{2^{-4}} |
| 3778 | @infoline @expr{2^-4} | 3771 | @infoline @expr{2^-4} |
| 3779 | to @expr{2^4}. @xref{List Answer 1, 1}. (@bullet{}) | 3772 | to @expr{2^4}. @xref{List Answer 1, 1}. (@bullet{}) |
| 3780 | 3773 | ||
| @@ -3978,7 +3971,7 @@ $$ m = {N \sum x y - \sum x \sum y \over | |||
| 3978 | 3971 | ||
| 3979 | @noindent | 3972 | @noindent |
| 3980 | where | 3973 | where |
| 3981 | @texline @tmath{\sum x} | 3974 | @texline @math{\sum x} |
| 3982 | @infoline @expr{sum(x)} | 3975 | @infoline @expr{sum(x)} |
| 3983 | represents the sum of all the values of @expr{x}. While there is an | 3976 | represents the sum of all the values of @expr{x}. While there is an |
| 3984 | actual @code{sum} function in Calc, it's easier to sum a vector using a | 3977 | actual @code{sum} function in Calc, it's easier to sum a vector using a |
| @@ -4083,7 +4076,7 @@ $$ b = {\sum y - m \sum x \over N} $$ | |||
| 4083 | @end smallexample | 4076 | @end smallexample |
| 4084 | 4077 | ||
| 4085 | Let's ``plot'' this straight line approximation, | 4078 | Let's ``plot'' this straight line approximation, |
| 4086 | @texline @tmath{y \approx m x + b}, | 4079 | @texline @math{y \approx m x + b}, |
| 4087 | @infoline @expr{m x + b}, | 4080 | @infoline @expr{m x + b}, |
| 4088 | and compare it with the original data. | 4081 | and compare it with the original data. |
| 4089 | 4082 | ||
| @@ -4336,7 +4329,7 @@ command to enable multi-line display of vectors.) | |||
| 4336 | @cindex Maximizing a function over a list of values | 4329 | @cindex Maximizing a function over a list of values |
| 4337 | @c [fix-ref Numerical Solutions] | 4330 | @c [fix-ref Numerical Solutions] |
| 4338 | (@bullet{}) @strong{Exercise 8.} Compute a list of values of Bessel's | 4331 | (@bullet{}) @strong{Exercise 8.} Compute a list of values of Bessel's |
| 4339 | @texline @tmath{J_1(x)} | 4332 | @texline @math{J_1(x)} |
| 4340 | @infoline @expr{J1} | 4333 | @infoline @expr{J1} |
| 4341 | function @samp{besJ(1,x)} for @expr{x} from 0 to 5 in steps of 0.25. | 4334 | function @samp{besJ(1,x)} for @expr{x} from 0 to 5 in steps of 0.25. |
| 4342 | Find the value of @expr{x} (from among the above set of values) for | 4335 | Find the value of @expr{x} (from among the above set of values) for |
| @@ -4348,7 +4341,7 @@ of thing automatically; @pxref{Numerical Solutions}.) | |||
| 4348 | 4341 | ||
| 4349 | @cindex Digits, vectors of | 4342 | @cindex Digits, vectors of |
| 4350 | (@bullet{}) @strong{Exercise 9.} You are given an integer in the range | 4343 | (@bullet{}) @strong{Exercise 9.} You are given an integer in the range |
| 4351 | @texline @tmath{0 \le N < 10^m} | 4344 | @texline @math{0 \le N < 10^m} |
| 4352 | @infoline @expr{0 <= N < 10^m} | 4345 | @infoline @expr{0 <= N < 10^m} |
| 4353 | for @expr{m=12} (i.e., an integer of less than | 4346 | for @expr{m=12} (i.e., an integer of less than |
| 4354 | twelve digits). Convert this integer into a vector of @expr{m} | 4347 | twelve digits). Convert this integer into a vector of @expr{m} |
| @@ -4364,14 +4357,14 @@ happened? How would you do this test? @xref{List Answer 10, 10}. (@bullet{}) | |||
| 4364 | 4357 | ||
| 4365 | (@bullet{}) @strong{Exercise 11.} The area of a circle of radius one | 4358 | (@bullet{}) @strong{Exercise 11.} The area of a circle of radius one |
| 4366 | is @cpi{}. The area of the | 4359 | is @cpi{}. The area of the |
| 4367 | @texline @tmath{2\times2} | 4360 | @texline @math{2\times2} |
| 4368 | @infoline 2x2 | 4361 | @infoline 2x2 |
| 4369 | square that encloses that circle is 4. So if we throw @var{n} darts at | 4362 | square that encloses that circle is 4. So if we throw @var{n} darts at |
| 4370 | random points in the square, about @cpiover{4} of them will land inside | 4363 | random points in the square, about @cpiover{4} of them will land inside |
| 4371 | the circle. This gives us an entertaining way to estimate the value of | 4364 | the circle. This gives us an entertaining way to estimate the value of |
| 4372 | @cpi{}. The @w{@kbd{k r}} | 4365 | @cpi{}. The @w{@kbd{k r}} |
| 4373 | command picks a random number between zero and the value on the stack. | 4366 | command picks a random number between zero and the value on the stack. |
| 4374 | We could get a random floating-point number between @i{-1} and 1 by typing | 4367 | We could get a random floating-point number between @mathit{-1} and 1 by typing |
| 4375 | @w{@kbd{2.0 k r 1 -}}. Build a vector of 100 random @expr{(x,y)} points in | 4368 | @w{@kbd{2.0 k r 1 -}}. Build a vector of 100 random @expr{(x,y)} points in |
| 4376 | this square, then use vector mapping and reduction to count how many | 4369 | this square, then use vector mapping and reduction to count how many |
| 4377 | points lie inside the unit circle. Hint: Use the @kbd{v b} command. | 4370 | points lie inside the unit circle. Hint: Use the @kbd{v b} command. |
| @@ -4383,12 +4376,12 @@ another way to calculate @cpi{}. Say you have an infinite field | |||
| 4383 | of vertical lines with a spacing of one inch. Toss a one-inch matchstick | 4376 | of vertical lines with a spacing of one inch. Toss a one-inch matchstick |
| 4384 | onto the field. The probability that the matchstick will land crossing | 4377 | onto the field. The probability that the matchstick will land crossing |
| 4385 | a line turns out to be | 4378 | a line turns out to be |
| 4386 | @texline @tmath{2/\pi}. | 4379 | @texline @math{2/\pi}. |
| 4387 | @infoline @expr{2/pi}. | 4380 | @infoline @expr{2/pi}. |
| 4388 | Toss 100 matchsticks to estimate @cpi{}. (If you want still more fun, | 4381 | Toss 100 matchsticks to estimate @cpi{}. (If you want still more fun, |
| 4389 | the probability that the GCD (@w{@kbd{k g}}) of two large integers is | 4382 | the probability that the GCD (@w{@kbd{k g}}) of two large integers is |
| 4390 | one turns out to be | 4383 | one turns out to be |
| 4391 | @texline @tmath{6/\pi^2}. | 4384 | @texline @math{6/\pi^2}. |
| 4392 | @infoline @expr{6/pi^2}. | 4385 | @infoline @expr{6/pi^2}. |
| 4393 | That provides yet another way to estimate @cpi{}.) | 4386 | That provides yet another way to estimate @cpi{}.) |
| 4394 | @xref{List Answer 12, 12}. (@bullet{}) | 4387 | @xref{List Answer 12, 12}. (@bullet{}) |
| @@ -4418,7 +4411,7 @@ value and a number of steps @var{n} from the stack; it then applies the | |||
| 4418 | function you give to the starting value 0, 1, 2, up to @var{n} times | 4411 | function you give to the starting value 0, 1, 2, up to @var{n} times |
| 4419 | and returns a vector of the results. Use this command to create a | 4412 | and returns a vector of the results. Use this command to create a |
| 4420 | ``random walk'' of 50 steps. Start with the two-dimensional point | 4413 | ``random walk'' of 50 steps. Start with the two-dimensional point |
| 4421 | @expr{(0,0)}; then take one step a random distance between @i{-1} and 1 | 4414 | @expr{(0,0)}; then take one step a random distance between @mathit{-1} and 1 |
| 4422 | in both @expr{x} and @expr{y}; then take another step, and so on. Use the | 4415 | in both @expr{x} and @expr{y}; then take another step, and so on. Use the |
| 4423 | @kbd{g f} command to display this random walk. Now modify your random | 4416 | @kbd{g f} command to display this random walk. Now modify your random |
| 4424 | walk to walk a unit distance, but in a random direction, at each step. | 4417 | walk to walk a unit distance, but in a random direction, at each step. |
| @@ -4497,7 +4490,7 @@ to allow for roundoff error!) @xref{Types Answer 1, 1}. (@bullet{}) | |||
| 4497 | @end smallexample | 4490 | @end smallexample |
| 4498 | 4491 | ||
| 4499 | @noindent | 4492 | @noindent |
| 4500 | The square root of @i{-9} is by default rendered in rectangular form | 4493 | The square root of @mathit{-9} is by default rendered in rectangular form |
| 4501 | (@w{@expr{0 + 3i}}), but we can convert it to polar form (3 with a | 4494 | (@w{@expr{0 + 3i}}), but we can convert it to polar form (3 with a |
| 4502 | phase angle of 90 degrees). All the usual arithmetic and scientific | 4495 | phase angle of 90 degrees). All the usual arithmetic and scientific |
| 4503 | operations are defined on both types of complex numbers. | 4496 | operations are defined on both types of complex numbers. |
| @@ -4522,14 +4515,14 @@ algebraic entry. | |||
| 4522 | 4515 | ||
| 4523 | @noindent | 4516 | @noindent |
| 4524 | Since infinity is infinitely large, multiplying it by any finite | 4517 | Since infinity is infinitely large, multiplying it by any finite |
| 4525 | number (like @i{-17}) has no effect, except that since @i{-17} | 4518 | number (like @mathit{-17}) has no effect, except that since @mathit{-17} |
| 4526 | is negative, it changes a plus infinity to a minus infinity. | 4519 | is negative, it changes a plus infinity to a minus infinity. |
| 4527 | (``A huge positive number, multiplied by @i{-17}, yields a huge | 4520 | (``A huge positive number, multiplied by @mathit{-17}, yields a huge |
| 4528 | negative number.'') Adding any finite number to infinity also | 4521 | negative number.'') Adding any finite number to infinity also |
| 4529 | leaves it unchanged. Taking an absolute value gives us plus | 4522 | leaves it unchanged. Taking an absolute value gives us plus |
| 4530 | infinity again. Finally, we add this plus infinity to the minus | 4523 | infinity again. Finally, we add this plus infinity to the minus |
| 4531 | infinity we had earlier. If you work it out, you might expect | 4524 | infinity we had earlier. If you work it out, you might expect |
| 4532 | the answer to be @i{-72} for this. But the 72 has been completely | 4525 | the answer to be @mathit{-72} for this. But the 72 has been completely |
| 4533 | lost next to the infinities; by the time we compute @w{@samp{inf - inf}} | 4526 | lost next to the infinities; by the time we compute @w{@samp{inf - inf}} |
| 4534 | the finite difference between them, if any, is undetectable. | 4527 | the finite difference between them, if any, is undetectable. |
| 4535 | So we say the result is @dfn{indeterminate}, which Calc writes | 4528 | So we say the result is @dfn{indeterminate}, which Calc writes |
| @@ -4686,7 +4679,7 @@ a 60% chance that the result is correct within 0.59 degrees. | |||
| 4686 | 4679 | ||
| 4687 | @cindex Torus, volume of | 4680 | @cindex Torus, volume of |
| 4688 | (@bullet{}) @strong{Exercise 7.} The volume of a torus (a donut shape) is | 4681 | (@bullet{}) @strong{Exercise 7.} The volume of a torus (a donut shape) is |
| 4689 | @texline @tmath{2 \pi^2 R r^2} | 4682 | @texline @math{2 \pi^2 R r^2} |
| 4690 | @infoline @w{@expr{2 pi^2 R r^2}} | 4683 | @infoline @w{@expr{2 pi^2 R r^2}} |
| 4691 | where @expr{R} is the radius of the circle that | 4684 | where @expr{R} is the radius of the circle that |
| 4692 | defines the center of the tube and @expr{r} is the radius of the tube | 4685 | defines the center of the tube and @expr{r} is the radius of the tube |
| @@ -4786,7 +4779,7 @@ that arises in the second one. | |||
| 4786 | @cindex Fermat, primality test of | 4779 | @cindex Fermat, primality test of |
| 4787 | (@bullet{}) @strong{Exercise 10.} A theorem of Pierre de Fermat | 4780 | (@bullet{}) @strong{Exercise 10.} A theorem of Pierre de Fermat |
| 4788 | says that | 4781 | says that |
| 4789 | @texline @w{@tmath{x^{n-1} \bmod n = 1}} | 4782 | @texline @w{@math{x^{n-1} \bmod n = 1}} |
| 4790 | @infoline @expr{x^(n-1) mod n = 1} | 4783 | @infoline @expr{x^(n-1) mod n = 1} |
| 4791 | if @expr{n} is a prime number and @expr{x} is an integer less than | 4784 | if @expr{n} is a prime number and @expr{x} is an integer less than |
| 4792 | @expr{n}. If @expr{n} is @emph{not} a prime number, this will | 4785 | @expr{n}. If @expr{n} is @emph{not} a prime number, this will |
| @@ -4814,7 +4807,7 @@ This calculation tells me it is six hours and 22 minutes until midnight. | |||
| 4814 | 4807 | ||
| 4815 | (@bullet{}) @strong{Exercise 11.} A rule of thumb is that one year | 4808 | (@bullet{}) @strong{Exercise 11.} A rule of thumb is that one year |
| 4816 | is about | 4809 | is about |
| 4817 | @texline @tmath{\pi \times 10^7} | 4810 | @texline @math{\pi \times 10^7} |
| 4818 | @infoline @w{@expr{pi * 10^7}} | 4811 | @infoline @w{@expr{pi * 10^7}} |
| 4819 | seconds. What time will it be that many seconds from right now? | 4812 | seconds. What time will it be that many seconds from right now? |
| 4820 | @xref{Types Answer 11, 11}. (@bullet{}) | 4813 | @xref{Types Answer 11, 11}. (@bullet{}) |
| @@ -5121,7 +5114,7 @@ solution by pressing @kbd{H} (the Hyperbolic flag) before @kbd{a S}. | |||
| 5121 | 5114 | ||
| 5122 | @noindent | 5115 | @noindent |
| 5123 | Calc has invented the variable @samp{s1} to represent an unknown sign; | 5116 | Calc has invented the variable @samp{s1} to represent an unknown sign; |
| 5124 | it is supposed to be either @i{+1} or @i{-1}. Here we have used | 5117 | it is supposed to be either @mathit{+1} or @mathit{-1}. Here we have used |
| 5125 | the ``let'' command to evaluate the expression when the sign is negative. | 5118 | the ``let'' command to evaluate the expression when the sign is negative. |
| 5126 | If we plugged this into our second derivative we would get the same, | 5119 | If we plugged this into our second derivative we would get the same, |
| 5127 | negative, answer, so @expr{x = -1.19023} is also a maximum. | 5120 | negative, answer, so @expr{x = -1.19023} is also a maximum. |
| @@ -5291,7 +5284,7 @@ One way to do it is again with vector mapping and reduction: | |||
| 5291 | 5284 | ||
| 5292 | (@bullet{}) @strong{Exercise 3.} Find the integral from 1 to @expr{y} | 5285 | (@bullet{}) @strong{Exercise 3.} Find the integral from 1 to @expr{y} |
| 5293 | of | 5286 | of |
| 5294 | @texline @tmath{x \sin \pi x} | 5287 | @texline @math{x \sin \pi x} |
| 5295 | @infoline @w{@expr{x sin(pi x)}} | 5288 | @infoline @w{@expr{x sin(pi x)}} |
| 5296 | (where the sine is calculated in radians). Find the values of the | 5289 | (where the sine is calculated in radians). Find the values of the |
| 5297 | integral for integers @expr{y} from 1 to 5. @xref{Algebra Answer 3, | 5290 | integral for integers @expr{y} from 1 to 5. @xref{Algebra Answer 3, |
| @@ -5300,7 +5293,7 @@ integral for integers @expr{y} from 1 to 5. @xref{Algebra Answer 3, | |||
| 5300 | Calc's integrator can do many simple integrals symbolically, but many | 5293 | Calc's integrator can do many simple integrals symbolically, but many |
| 5301 | others are beyond its capabilities. Suppose we wish to find the area | 5294 | others are beyond its capabilities. Suppose we wish to find the area |
| 5302 | under the curve | 5295 | under the curve |
| 5303 | @texline @tmath{\sin x \ln x} | 5296 | @texline @math{\sin x \ln x} |
| 5304 | @infoline @expr{sin(x) ln(x)} | 5297 | @infoline @expr{sin(x) ln(x)} |
| 5305 | over the same range of @expr{x}. If you entered this formula and typed | 5298 | over the same range of @expr{x}. If you entered this formula and typed |
| 5306 | @kbd{a i x @key{RET}} (don't bother to try this), Calc would work for a | 5299 | @kbd{a i x @key{RET}} (don't bother to try this), Calc would work for a |
| @@ -5442,7 +5435,7 @@ $$ h (f(a) + f(a+h) + f(a+2h) + f(a+3h) + \cdots | |||
| 5442 | @end tex | 5435 | @end tex |
| 5443 | 5436 | ||
| 5444 | Compute the integral from 1 to 2 of | 5437 | Compute the integral from 1 to 2 of |
| 5445 | @texline @tmath{\sin x \ln x} | 5438 | @texline @math{\sin x \ln x} |
| 5446 | @infoline @expr{sin(x) ln(x)} | 5439 | @infoline @expr{sin(x) ln(x)} |
| 5447 | using Simpson's rule with 10 slices. | 5440 | using Simpson's rule with 10 slices. |
| 5448 | @xref{Algebra Answer 4, 4}. (@bullet{}) | 5441 | @xref{Algebra Answer 4, 4}. (@bullet{}) |
| @@ -5988,7 +5981,7 @@ in @samp{a + 1} for @samp{x} in the defining formula. | |||
| 5988 | @end ignore | 5981 | @end ignore |
| 5989 | @tindex Si | 5982 | @tindex Si |
| 5990 | (@bullet{}) @strong{Exercise 1.} The ``sine integral'' function | 5983 | (@bullet{}) @strong{Exercise 1.} The ``sine integral'' function |
| 5991 | @texline @tmath{{\rm Si}(x)} | 5984 | @texline @math{{\rm Si}(x)} |
| 5992 | @infoline @expr{Si(x)} | 5985 | @infoline @expr{Si(x)} |
| 5993 | is defined as the integral of @samp{sin(t)/t} for | 5986 | is defined as the integral of @samp{sin(t)/t} for |
| 5994 | @expr{t = 0} to @expr{x} in radians. (It was invented because this | 5987 | @expr{t = 0} to @expr{x} in radians. (It was invented because this |
| @@ -6066,7 +6059,7 @@ the following functions: | |||
| 6066 | @enumerate | 6059 | @enumerate |
| 6067 | @item | 6060 | @item |
| 6068 | Compute | 6061 | Compute |
| 6069 | @texline @tmath{\displaystyle{\sin x \over x}}, | 6062 | @texline @math{\displaystyle{\sin x \over x}}, |
| 6070 | @infoline @expr{sin(x) / x}, | 6063 | @infoline @expr{sin(x) / x}, |
| 6071 | where @expr{x} is the number on the top of the stack. | 6064 | where @expr{x} is the number on the top of the stack. |
| 6072 | 6065 | ||
| @@ -6132,13 +6125,13 @@ key if you have one, makes a copy of the number in level 2.) | |||
| 6132 | @cindex Phi, golden ratio | 6125 | @cindex Phi, golden ratio |
| 6133 | A fascinating property of the Fibonacci numbers is that the @expr{n}th | 6126 | A fascinating property of the Fibonacci numbers is that the @expr{n}th |
| 6134 | Fibonacci number can be found directly by computing | 6127 | Fibonacci number can be found directly by computing |
| 6135 | @texline @tmath{\phi^n / \sqrt{5}} | 6128 | @texline @math{\phi^n / \sqrt{5}} |
| 6136 | @infoline @expr{phi^n / sqrt(5)} | 6129 | @infoline @expr{phi^n / sqrt(5)} |
| 6137 | and then rounding to the nearest integer, where | 6130 | and then rounding to the nearest integer, where |
| 6138 | @texline @tmath{\phi} (``phi''), | 6131 | @texline @math{\phi} (``phi''), |
| 6139 | @infoline @expr{phi}, | 6132 | @infoline @expr{phi}, |
| 6140 | the ``golden ratio,'' is | 6133 | the ``golden ratio,'' is |
| 6141 | @texline @tmath{(1 + \sqrt{5}) / 2}. | 6134 | @texline @math{(1 + \sqrt{5}) / 2}. |
| 6142 | @infoline @expr{(1 + sqrt(5)) / 2}. | 6135 | @infoline @expr{(1 + sqrt(5)) / 2}. |
| 6143 | (For convenience, this constant is available from the @code{phi} | 6136 | (For convenience, this constant is available from the @code{phi} |
| 6144 | variable, or the @kbd{I H P} command.) | 6137 | variable, or the @kbd{I H P} command.) |
| @@ -6155,17 +6148,17 @@ variable, or the @kbd{I H P} command.) | |||
| 6155 | @cindex Continued fractions | 6148 | @cindex Continued fractions |
| 6156 | (@bullet{}) @strong{Exercise 5.} The @dfn{continued fraction} | 6149 | (@bullet{}) @strong{Exercise 5.} The @dfn{continued fraction} |
| 6157 | representation of | 6150 | representation of |
| 6158 | @texline @tmath{\phi} | 6151 | @texline @math{\phi} |
| 6159 | @infoline @expr{phi} | 6152 | @infoline @expr{phi} |
| 6160 | is | 6153 | is |
| 6161 | @texline @tmath{1 + 1/(1 + 1/(1 + 1/( \ldots )))}. | 6154 | @texline @math{1 + 1/(1 + 1/(1 + 1/( \ldots )))}. |
| 6162 | @infoline @expr{1 + 1/(1 + 1/(1 + 1/( ...@: )))}. | 6155 | @infoline @expr{1 + 1/(1 + 1/(1 + 1/( ...@: )))}. |
| 6163 | We can compute an approximate value by carrying this however far | 6156 | We can compute an approximate value by carrying this however far |
| 6164 | and then replacing the innermost | 6157 | and then replacing the innermost |
| 6165 | @texline @tmath{1/( \ldots )} | 6158 | @texline @math{1/( \ldots )} |
| 6166 | @infoline @expr{1/( ...@: )} | 6159 | @infoline @expr{1/( ...@: )} |
| 6167 | by 1. Approximate | 6160 | by 1. Approximate |
| 6168 | @texline @tmath{\phi} | 6161 | @texline @math{\phi} |
| 6169 | @infoline @expr{phi} | 6162 | @infoline @expr{phi} |
| 6170 | using a twenty-term continued fraction. | 6163 | using a twenty-term continued fraction. |
| 6171 | @xref{Programming Answer 5, 5}. (@bullet{}) | 6164 | @xref{Programming Answer 5, 5}. (@bullet{}) |
| @@ -6265,7 +6258,7 @@ The @dfn{Bernoulli numbers} are a sequence with the interesting | |||
| 6265 | property that all of the odd Bernoulli numbers are zero, and the | 6258 | property that all of the odd Bernoulli numbers are zero, and the |
| 6266 | even ones, while difficult to compute, can be roughly approximated | 6259 | even ones, while difficult to compute, can be roughly approximated |
| 6267 | by the formula | 6260 | by the formula |
| 6268 | @texline @tmath{\displaystyle{2 n! \over (2 \pi)^n}}. | 6261 | @texline @math{\displaystyle{2 n! \over (2 \pi)^n}}. |
| 6269 | @infoline @expr{2 n!@: / (2 pi)^n}. | 6262 | @infoline @expr{2 n!@: / (2 pi)^n}. |
| 6270 | Let's write a keyboard macro to compute (approximate) Bernoulli numbers. | 6263 | Let's write a keyboard macro to compute (approximate) Bernoulli numbers. |
| 6271 | (Calc has a command, @kbd{k b}, to compute exact Bernoulli numbers, but | 6264 | (Calc has a command, @kbd{k b}, to compute exact Bernoulli numbers, but |
| @@ -6439,14 +6432,14 @@ $$ x_{\rm new} = x - {f(x) \over f'(x)} $$ | |||
| 6439 | @noindent | 6432 | @noindent |
| 6440 | where @expr{f'(x)} is the derivative of @expr{f}. The @expr{x} | 6433 | where @expr{f'(x)} is the derivative of @expr{f}. The @expr{x} |
| 6441 | values will quickly converge to a solution, i.e., eventually | 6434 | values will quickly converge to a solution, i.e., eventually |
| 6442 | @texline @tmath{x_{\rm new}} | 6435 | @texline @math{x_{\rm new}} |
| 6443 | @infoline @expr{new_x} | 6436 | @infoline @expr{new_x} |
| 6444 | and @expr{x} will be equal to within the limits | 6437 | and @expr{x} will be equal to within the limits |
| 6445 | of the current precision. Write a program which takes a formula | 6438 | of the current precision. Write a program which takes a formula |
| 6446 | involving the variable @expr{x}, and an initial guess @expr{x_0}, | 6439 | involving the variable @expr{x}, and an initial guess @expr{x_0}, |
| 6447 | on the stack, and produces a value of @expr{x} for which the formula | 6440 | on the stack, and produces a value of @expr{x} for which the formula |
| 6448 | is zero. Use it to find a solution of | 6441 | is zero. Use it to find a solution of |
| 6449 | @texline @tmath{\sin(\cos x) = 0.5} | 6442 | @texline @math{\sin(\cos x) = 0.5} |
| 6450 | @infoline @expr{sin(cos(x)) = 0.5} | 6443 | @infoline @expr{sin(cos(x)) = 0.5} |
| 6451 | near @expr{x = 4.5}. (Use angles measured in radians.) Note that | 6444 | near @expr{x = 4.5}. (Use angles measured in radians.) Note that |
| 6452 | the built-in @w{@kbd{a R}} (@code{calc-find-root}) command uses Newton's | 6445 | the built-in @w{@kbd{a R}} (@code{calc-find-root}) command uses Newton's |
| @@ -6456,10 +6449,10 @@ method when it is able. @xref{Programming Answer 8, 8}. (@bullet{}) | |||
| 6456 | @cindex Gamma constant, Euler's | 6449 | @cindex Gamma constant, Euler's |
| 6457 | @cindex Euler's gamma constant | 6450 | @cindex Euler's gamma constant |
| 6458 | (@bullet{}) @strong{Exercise 9.} The @dfn{digamma} function | 6451 | (@bullet{}) @strong{Exercise 9.} The @dfn{digamma} function |
| 6459 | @texline @tmath{\psi(z) (``psi'')} | 6452 | @texline @math{\psi(z) (``psi'')} |
| 6460 | @infoline @expr{psi(z)} | 6453 | @infoline @expr{psi(z)} |
| 6461 | is defined as the derivative of | 6454 | is defined as the derivative of |
| 6462 | @texline @tmath{\ln \Gamma(z)}. | 6455 | @texline @math{\ln \Gamma(z)}. |
| 6463 | @infoline @expr{ln(gamma(z))}. | 6456 | @infoline @expr{ln(gamma(z))}. |
| 6464 | For large values of @expr{z}, it can be approximated by the infinite sum | 6457 | For large values of @expr{z}, it can be approximated by the infinite sum |
| 6465 | 6458 | ||
| @@ -6478,7 +6471,7 @@ $$ | |||
| 6478 | 6471 | ||
| 6479 | @noindent | 6472 | @noindent |
| 6480 | where | 6473 | where |
| 6481 | @texline @tmath{\sum} | 6474 | @texline @math{\sum} |
| 6482 | @infoline @expr{sum} | 6475 | @infoline @expr{sum} |
| 6483 | represents the sum over @expr{n} from 1 to infinity | 6476 | represents the sum over @expr{n} from 1 to infinity |
| 6484 | (or to some limit high enough to give the desired accuracy), and | 6477 | (or to some limit high enough to give the desired accuracy), and |
| @@ -6486,27 +6479,27 @@ the @code{bern} function produces (exact) Bernoulli numbers. | |||
| 6486 | While this sum is not guaranteed to converge, in practice it is safe. | 6479 | While this sum is not guaranteed to converge, in practice it is safe. |
| 6487 | An interesting mathematical constant is Euler's gamma, which is equal | 6480 | An interesting mathematical constant is Euler's gamma, which is equal |
| 6488 | to about 0.5772. One way to compute it is by the formula, | 6481 | to about 0.5772. One way to compute it is by the formula, |
| 6489 | @texline @tmath{\gamma = -\psi(1)}. | 6482 | @texline @math{\gamma = -\psi(1)}. |
| 6490 | @infoline @expr{gamma = -psi(1)}. | 6483 | @infoline @expr{gamma = -psi(1)}. |
| 6491 | Unfortunately, 1 isn't a large enough argument | 6484 | Unfortunately, 1 isn't a large enough argument |
| 6492 | for the above formula to work (5 is a much safer value for @expr{z}). | 6485 | for the above formula to work (5 is a much safer value for @expr{z}). |
| 6493 | Fortunately, we can compute | 6486 | Fortunately, we can compute |
| 6494 | @texline @tmath{\psi(1)} | 6487 | @texline @math{\psi(1)} |
| 6495 | @infoline @expr{psi(1)} | 6488 | @infoline @expr{psi(1)} |
| 6496 | from | 6489 | from |
| 6497 | @texline @tmath{\psi(5)} | 6490 | @texline @math{\psi(5)} |
| 6498 | @infoline @expr{psi(5)} | 6491 | @infoline @expr{psi(5)} |
| 6499 | using the recurrence | 6492 | using the recurrence |
| 6500 | @texline @tmath{\psi(z+1) = \psi(z) + {1 \over z}}. | 6493 | @texline @math{\psi(z+1) = \psi(z) + {1 \over z}}. |
| 6501 | @infoline @expr{psi(z+1) = psi(z) + 1/z}. | 6494 | @infoline @expr{psi(z+1) = psi(z) + 1/z}. |
| 6502 | Your task: Develop a program to compute | 6495 | Your task: Develop a program to compute |
| 6503 | @texline @tmath{\psi(z)}; | 6496 | @texline @math{\psi(z)}; |
| 6504 | @infoline @expr{psi(z)}; | 6497 | @infoline @expr{psi(z)}; |
| 6505 | it should ``pump up'' @expr{z} | 6498 | it should ``pump up'' @expr{z} |
| 6506 | if necessary to be greater than 5, then use the above summation | 6499 | if necessary to be greater than 5, then use the above summation |
| 6507 | formula. Use looping commands to compute the sum. Use your function | 6500 | formula. Use looping commands to compute the sum. Use your function |
| 6508 | to compute | 6501 | to compute |
| 6509 | @texline @tmath{\gamma} | 6502 | @texline @math{\gamma} |
| 6510 | @infoline @expr{gamma} | 6503 | @infoline @expr{gamma} |
| 6511 | to twelve decimal places. (Calc has a built-in command | 6504 | to twelve decimal places. (Calc has a built-in command |
| 6512 | for Euler's constant, @kbd{I P}, which you can use to check your answer.) | 6505 | for Euler's constant, @kbd{I P}, which you can use to check your answer.) |
| @@ -6683,18 +6676,18 @@ This section includes answers to all the exercises in the Calc tutorial. | |||
| 6683 | @kbd{1 @key{RET} 2 @key{RET} 3 @key{RET} 4 + * -} | 6676 | @kbd{1 @key{RET} 2 @key{RET} 3 @key{RET} 4 + * -} |
| 6684 | 6677 | ||
| 6685 | The result is | 6678 | The result is |
| 6686 | @texline @tmath{1 - (2 \times (3 + 4)) = -13}. | 6679 | @texline @math{1 - (2 \times (3 + 4)) = -13}. |
| 6687 | @infoline @expr{1 - (2 * (3 + 4)) = -13}. | 6680 | @infoline @expr{1 - (2 * (3 + 4)) = -13}. |
| 6688 | 6681 | ||
| 6689 | @node RPN Answer 2, RPN Answer 3, RPN Answer 1, Answers to Exercises | 6682 | @node RPN Answer 2, RPN Answer 3, RPN Answer 1, Answers to Exercises |
| 6690 | @subsection RPN Tutorial Exercise 2 | 6683 | @subsection RPN Tutorial Exercise 2 |
| 6691 | 6684 | ||
| 6692 | @noindent | 6685 | @noindent |
| 6693 | @texline @tmath{2\times4 + 7\times9.5 + {5\over4} = 75.75} | 6686 | @texline @math{2\times4 + 7\times9.5 + {5\over4} = 75.75} |
| 6694 | @infoline @expr{2*4 + 7*9.5 + 5/4 = 75.75} | 6687 | @infoline @expr{2*4 + 7*9.5 + 5/4 = 75.75} |
| 6695 | 6688 | ||
| 6696 | After computing the intermediate term | 6689 | After computing the intermediate term |
| 6697 | @texline @tmath{2\times4 = 8}, | 6690 | @texline @math{2\times4 = 8}, |
| 6698 | @infoline @expr{2*4 = 8}, | 6691 | @infoline @expr{2*4 = 8}, |
| 6699 | you can leave that result on the stack while you compute the second | 6692 | you can leave that result on the stack while you compute the second |
| 6700 | term. With both of these results waiting on the stack you can then | 6693 | term. With both of these results waiting on the stack you can then |
| @@ -7003,7 +6996,7 @@ give a floating-point result that is inaccurate even when rounded | |||
| 7003 | down to an integer. Consider @expr{123456789 / 2} when the current | 6996 | down to an integer. Consider @expr{123456789 / 2} when the current |
| 7004 | precision is 6 digits. The true answer is @expr{61728394.5}, but | 6997 | precision is 6 digits. The true answer is @expr{61728394.5}, but |
| 7005 | with a precision of 6 this will be rounded to | 6998 | with a precision of 6 this will be rounded to |
| 7006 | @texline @tmath{12345700.0/2.0 = 61728500.0}. | 6999 | @texline @math{12345700.0/2.0 = 61728500.0}. |
| 7007 | @infoline @expr{12345700.@: / 2.@: = 61728500.}. | 7000 | @infoline @expr{12345700.@: / 2.@: = 61728500.}. |
| 7008 | The result, when converted to an integer, will be off by 106. | 7001 | The result, when converted to an integer, will be off by 106. |
| 7009 | 7002 | ||
| @@ -7114,16 +7107,16 @@ Type @kbd{d N} to return to ``normal'' display mode afterwards. | |||
| 7114 | 7107 | ||
| 7115 | @noindent | 7108 | @noindent |
| 7116 | To solve | 7109 | To solve |
| 7117 | @texline @tmath{A^T A \, X = A^T B}, | 7110 | @texline @math{A^T A \, X = A^T B}, |
| 7118 | @infoline @expr{trn(A) * A * X = trn(A) * B}, | 7111 | @infoline @expr{trn(A) * A * X = trn(A) * B}, |
| 7119 | first we compute | 7112 | first we compute |
| 7120 | @texline @tmath{A' = A^T A} | 7113 | @texline @math{A' = A^T A} |
| 7121 | @infoline @expr{A2 = trn(A) * A} | 7114 | @infoline @expr{A2 = trn(A) * A} |
| 7122 | and | 7115 | and |
| 7123 | @texline @tmath{B' = A^T B}; | 7116 | @texline @math{B' = A^T B}; |
| 7124 | @infoline @expr{B2 = trn(A) * B}; | 7117 | @infoline @expr{B2 = trn(A) * B}; |
| 7125 | now, we have a system | 7118 | now, we have a system |
| 7126 | @texline @tmath{A' X = B'} | 7119 | @texline @math{A' X = B'} |
| 7127 | @infoline @expr{A2 * X = B2} | 7120 | @infoline @expr{A2 * X = B2} |
| 7128 | which we can solve using Calc's @samp{/} command. | 7121 | which we can solve using Calc's @samp{/} command. |
| 7129 | 7122 | ||
| @@ -7155,7 +7148,7 @@ $$ | |||
| 7155 | 7148 | ||
| 7156 | The first step is to enter the coefficient matrix. We'll store it in | 7149 | The first step is to enter the coefficient matrix. We'll store it in |
| 7157 | quick variable number 7 for later reference. Next, we compute the | 7150 | quick variable number 7 for later reference. Next, we compute the |
| 7158 | @texline @tmath{B'} | 7151 | @texline @math{B'} |
| 7159 | @infoline @expr{B2} | 7152 | @infoline @expr{B2} |
| 7160 | vector. | 7153 | vector. |
| 7161 | 7154 | ||
| @@ -7173,7 +7166,7 @@ vector. | |||
| 7173 | 7166 | ||
| 7174 | @noindent | 7167 | @noindent |
| 7175 | Now we compute the matrix | 7168 | Now we compute the matrix |
| 7176 | @texline @tmath{A'} | 7169 | @texline @math{A'} |
| 7177 | @infoline @expr{A2} | 7170 | @infoline @expr{A2} |
| 7178 | and divide. | 7171 | and divide. |
| 7179 | 7172 | ||
| @@ -7194,16 +7187,16 @@ and divide. | |||
| 7194 | round-off error.) | 7187 | round-off error.) |
| 7195 | 7188 | ||
| 7196 | Notice that the answers are similar to those for the | 7189 | Notice that the answers are similar to those for the |
| 7197 | @texline @tmath{3\times3} | 7190 | @texline @math{3\times3} |
| 7198 | @infoline 3x3 | 7191 | @infoline 3x3 |
| 7199 | system solved in the text. That's because the fourth equation that was | 7192 | system solved in the text. That's because the fourth equation that was |
| 7200 | added to the system is almost identical to the first one multiplied | 7193 | added to the system is almost identical to the first one multiplied |
| 7201 | by two. (If it were identical, we would have gotten the exact same | 7194 | by two. (If it were identical, we would have gotten the exact same |
| 7202 | answer since the | 7195 | answer since the |
| 7203 | @texline @tmath{4\times3} | 7196 | @texline @math{4\times3} |
| 7204 | @infoline 4x3 | 7197 | @infoline 4x3 |
| 7205 | system would be equivalent to the original | 7198 | system would be equivalent to the original |
| 7206 | @texline @tmath{3\times3} | 7199 | @texline @math{3\times3} |
| 7207 | @infoline 3x3 | 7200 | @infoline 3x3 |
| 7208 | system.) | 7201 | system.) |
| 7209 | 7202 | ||
| @@ -7280,7 +7273,7 @@ $$ m \times x + b \times 1 = y $$ | |||
| 7280 | @end tex | 7273 | @end tex |
| 7281 | 7274 | ||
| 7282 | Thus we want a | 7275 | Thus we want a |
| 7283 | @texline @tmath{19\times2} | 7276 | @texline @math{19\times2} |
| 7284 | @infoline 19x2 | 7277 | @infoline 19x2 |
| 7285 | matrix with our @expr{x} vector as one column and | 7278 | matrix with our @expr{x} vector as one column and |
| 7286 | ones as the other column. So, first we build the column of ones, then | 7279 | ones as the other column. So, first we build the column of ones, then |
| @@ -7299,10 +7292,10 @@ we combine the two columns to form our @expr{A} matrix. | |||
| 7299 | 7292 | ||
| 7300 | @noindent | 7293 | @noindent |
| 7301 | Now we compute | 7294 | Now we compute |
| 7302 | @texline @tmath{A^T y} | 7295 | @texline @math{A^T y} |
| 7303 | @infoline @expr{trn(A) * y} | 7296 | @infoline @expr{trn(A) * y} |
| 7304 | and | 7297 | and |
| 7305 | @texline @tmath{A^T A} | 7298 | @texline @math{A^T A} |
| 7306 | @infoline @expr{trn(A) * A} | 7299 | @infoline @expr{trn(A) * A} |
| 7307 | and divide. | 7300 | and divide. |
| 7308 | 7301 | ||
| @@ -7330,7 +7323,7 @@ and divide. | |||
| 7330 | @end smallexample | 7323 | @end smallexample |
| 7331 | 7324 | ||
| 7332 | Since we were solving equations of the form | 7325 | Since we were solving equations of the form |
| 7333 | @texline @tmath{m \times x + b \times 1 = y}, | 7326 | @texline @math{m \times x + b \times 1 = y}, |
| 7334 | @infoline @expr{m*x + b*1 = y}, | 7327 | @infoline @expr{m*x + b*1 = y}, |
| 7335 | these numbers should be @expr{m} and @expr{b}, respectively. Sure | 7328 | these numbers should be @expr{m} and @expr{b}, respectively. Sure |
| 7336 | enough, they agree exactly with the result computed using @kbd{V M} and | 7329 | enough, they agree exactly with the result computed using @kbd{V M} and |
| @@ -7393,7 +7386,7 @@ then raise the number to that power.) | |||
| 7393 | 7386 | ||
| 7394 | @noindent | 7387 | @noindent |
| 7395 | A number @expr{j} is a divisor of @expr{n} if | 7388 | A number @expr{j} is a divisor of @expr{n} if |
| 7396 | @texline @tmath{n \mathbin{\hbox{\code{\%}}} j = 0}. | 7389 | @texline @math{n \mathbin{\hbox{\code{\%}}} j = 0}. |
| 7397 | @infoline @samp{n % j = 0}. | 7390 | @infoline @samp{n % j = 0}. |
| 7398 | The first step is to get a vector that identifies the divisors. | 7391 | The first step is to get a vector that identifies the divisors. |
| 7399 | 7392 | ||
| @@ -7464,7 +7457,7 @@ zero, so adding zeros on the left and right is safe. From then on | |||
| 7464 | the job is pretty straightforward. | 7457 | the job is pretty straightforward. |
| 7465 | 7458 | ||
| 7466 | Incidentally, Calc provides the | 7459 | Incidentally, Calc provides the |
| 7467 | @texline @dfn{M@"obius} @tmath{\mu} | 7460 | @texline @dfn{M@"obius} @math{\mu} |
| 7468 | @infoline @dfn{Moebius mu} | 7461 | @infoline @dfn{Moebius mu} |
| 7469 | function which is zero if and only if its argument is square-free. It | 7462 | function which is zero if and only if its argument is square-free. It |
| 7470 | would be a much more convenient way to do the above test in practice. | 7463 | would be a much more convenient way to do the above test in practice. |
| @@ -7498,7 +7491,7 @@ The numbers down the lefthand edge of the list we desire are called | |||
| 7498 | the ``triangular numbers'' (now you know why!). The @expr{n}th | 7491 | the ``triangular numbers'' (now you know why!). The @expr{n}th |
| 7499 | triangular number is the sum of the integers from 1 to @expr{n}, and | 7492 | triangular number is the sum of the integers from 1 to @expr{n}, and |
| 7500 | can be computed directly by the formula | 7493 | can be computed directly by the formula |
| 7501 | @texline @tmath{n (n+1) \over 2}. | 7494 | @texline @math{n (n+1) \over 2}. |
| 7502 | @infoline @expr{n * (n+1) / 2}. | 7495 | @infoline @expr{n * (n+1) / 2}. |
| 7503 | 7496 | ||
| 7504 | @smallexample | 7497 | @smallexample |
| @@ -7594,7 +7587,7 @@ A way to isolate the maximum value is to compute the maximum using | |||
| 7594 | @noindent | 7587 | @noindent |
| 7595 | It's a good idea to verify, as in the last step above, that only | 7588 | It's a good idea to verify, as in the last step above, that only |
| 7596 | one value is equal to the maximum. (After all, a plot of | 7589 | one value is equal to the maximum. (After all, a plot of |
| 7597 | @texline @tmath{\sin x} | 7590 | @texline @math{\sin x} |
| 7598 | @infoline @expr{sin(x)} | 7591 | @infoline @expr{sin(x)} |
| 7599 | might have many points all equal to the maximum value, 1.) | 7592 | might have many points all equal to the maximum value, 1.) |
| 7600 | 7593 | ||
| @@ -7866,10 +7859,10 @@ This problem can be made a lot easier by taking advantage of some | |||
| 7866 | symmetries. First of all, after some thought it's clear that the | 7859 | symmetries. First of all, after some thought it's clear that the |
| 7867 | @expr{y} axis can be ignored altogether. Just pick a random @expr{x} | 7860 | @expr{y} axis can be ignored altogether. Just pick a random @expr{x} |
| 7868 | component for one end of the match, pick a random direction | 7861 | component for one end of the match, pick a random direction |
| 7869 | @texline @tmath{\theta}, | 7862 | @texline @math{\theta}, |
| 7870 | @infoline @expr{theta}, | 7863 | @infoline @expr{theta}, |
| 7871 | and see if @expr{x} and | 7864 | and see if @expr{x} and |
| 7872 | @texline @tmath{x + \cos \theta} | 7865 | @texline @math{x + \cos \theta} |
| 7873 | @infoline @expr{x + cos(theta)} | 7866 | @infoline @expr{x + cos(theta)} |
| 7874 | (which is the @expr{x} coordinate of the other endpoint) cross a line. | 7867 | (which is the @expr{x} coordinate of the other endpoint) cross a line. |
| 7875 | The lines are at integer coordinates, so this happens when the two | 7868 | The lines are at integer coordinates, so this happens when the two |
| @@ -7886,10 +7879,10 @@ coordinates 0 and 1 for the lines on either side of the leftmost | |||
| 7886 | endpoint. The rightmost endpoint will be between 0 and 1 if the | 7879 | endpoint. The rightmost endpoint will be between 0 and 1 if the |
| 7887 | match does not cross a line, or between 1 and 2 if it does. So: | 7880 | match does not cross a line, or between 1 and 2 if it does. So: |
| 7888 | Pick random @expr{x} and | 7881 | Pick random @expr{x} and |
| 7889 | @texline @tmath{\theta}, | 7882 | @texline @math{\theta}, |
| 7890 | @infoline @expr{theta}, | 7883 | @infoline @expr{theta}, |
| 7891 | compute | 7884 | compute |
| 7892 | @texline @tmath{x + \cos \theta}, | 7885 | @texline @math{x + \cos \theta}, |
| 7893 | @infoline @expr{x + cos(theta)}, | 7886 | @infoline @expr{x + cos(theta)}, |
| 7894 | and count how many of the results are greater than one. Simple! | 7887 | and count how many of the results are greater than one. Simple! |
| 7895 | 7888 | ||
| @@ -8214,7 +8207,7 @@ precision slightly and try again: | |||
| 8214 | @noindent | 8207 | @noindent |
| 8215 | Aha! It's unlikely that an irrational number would equal a fraction | 8208 | Aha! It's unlikely that an irrational number would equal a fraction |
| 8216 | this simple to within ten digits, so our original number was probably | 8209 | this simple to within ten digits, so our original number was probably |
| 8217 | @texline @tmath{\sqrt{27 \pi / 53}}. | 8210 | @texline @math{\sqrt{27 \pi / 53}}. |
| 8218 | @infoline @expr{sqrt(27 pi / 53)}. | 8211 | @infoline @expr{sqrt(27 pi / 53)}. |
| 8219 | 8212 | ||
| 8220 | Notice that we didn't need to re-round the number when we reduced the | 8213 | Notice that we didn't need to re-round the number when we reduced the |
| @@ -8475,9 +8468,9 @@ as a possible value. | |||
| 8475 | The fourth calculation, @samp{1 / (-10 .. 10)}, has the same problem. | 8468 | The fourth calculation, @samp{1 / (-10 .. 10)}, has the same problem. |
| 8476 | Zero is buried inside the interval, but it's still a possible value. | 8469 | Zero is buried inside the interval, but it's still a possible value. |
| 8477 | It's not hard to see that the actual result of @samp{1 / (-10 .. 10)} | 8470 | It's not hard to see that the actual result of @samp{1 / (-10 .. 10)} |
| 8478 | will be either greater than @i{0.1}, or less than @i{-0.1}. Thus | 8471 | will be either greater than @mathit{0.1}, or less than @mathit{-0.1}. Thus |
| 8479 | the interval goes from minus infinity to plus infinity, with a ``hole'' | 8472 | the interval goes from minus infinity to plus infinity, with a ``hole'' |
| 8480 | in it from @i{-0.1} to @i{0.1}. Calc doesn't have any way to | 8473 | in it from @mathit{-0.1} to @mathit{0.1}. Calc doesn't have any way to |
| 8481 | represent this, so it just reports @samp{[-inf .. inf]} as the answer. | 8474 | represent this, so it just reports @samp{[-inf .. inf]} as the answer. |
| 8482 | It may be disappointing to hear ``the answer lies somewhere between | 8475 | It may be disappointing to hear ``the answer lies somewhere between |
| 8483 | minus infinity and plus infinity, inclusive,'' but that's the best | 8476 | minus infinity and plus infinity, inclusive,'' but that's the best |
| @@ -8497,9 +8490,9 @@ that interval arithmetic can do in this case. | |||
| 8497 | @end smallexample | 8490 | @end smallexample |
| 8498 | 8491 | ||
| 8499 | @noindent | 8492 | @noindent |
| 8500 | In the first case the result says, ``if a number is between @i{-3} and | 8493 | In the first case the result says, ``if a number is between @mathit{-3} and |
| 8501 | 3, its square is between 0 and 9.'' The second case says, ``the product | 8494 | 3, its square is between 0 and 9.'' The second case says, ``the product |
| 8502 | of two numbers each between @i{-3} and 3 is between @i{-9} and 9.'' | 8495 | of two numbers each between @mathit{-3} and 3 is between @mathit{-9} and 9.'' |
| 8503 | 8496 | ||
| 8504 | An interval form is not a number; it is a symbol that can stand for | 8497 | An interval form is not a number; it is a symbol that can stand for |
| 8505 | many different numbers. Two identical-looking interval forms can stand | 8498 | many different numbers. Two identical-looking interval forms can stand |
| @@ -9255,7 +9248,7 @@ algebraic entry, whichever way you prefer: | |||
| 9255 | 9248 | ||
| 9256 | @noindent | 9249 | @noindent |
| 9257 | Computing | 9250 | Computing |
| 9258 | @texline @tmath{\displaystyle{\sin x \over x}}: | 9251 | @texline @math{\displaystyle{\sin x \over x}}: |
| 9259 | @infoline @expr{sin(x) / x}: | 9252 | @infoline @expr{sin(x) / x}: |
| 9260 | 9253 | ||
| 9261 | Using the stack: @kbd{C-x ( @key{RET} S @key{TAB} / C-x )}. | 9254 | Using the stack: @kbd{C-x ( @key{RET} S @key{TAB} / C-x )}. |
| @@ -9326,7 +9319,7 @@ C-x ( ' [0, 1; 1, 1] ^ ($-1) * [1, 1] @key{RET} v u @key{DEL} C-x ) | |||
| 9326 | @noindent | 9319 | @noindent |
| 9327 | This program is quite efficient because Calc knows how to raise a | 9320 | This program is quite efficient because Calc knows how to raise a |
| 9328 | matrix (or other value) to the power @expr{n} in only | 9321 | matrix (or other value) to the power @expr{n} in only |
| 9329 | @texline @tmath{\log_2 n} | 9322 | @texline @math{\log_2 n} |
| 9330 | @infoline @expr{log(n,2)} | 9323 | @infoline @expr{log(n,2)} |
| 9331 | steps. For example, this program can compute the 1000th Fibonacci | 9324 | steps. For example, this program can compute the 1000th Fibonacci |
| 9332 | number (a 209-digit integer!) in about 10 steps; even though the | 9325 | number (a 209-digit integer!) in about 10 steps; even though the |
| @@ -9380,7 +9373,7 @@ harmonic number is 4.02. | |||
| 9380 | @noindent | 9373 | @noindent |
| 9381 | The first step is to compute the derivative @expr{f'(x)} and thus | 9374 | The first step is to compute the derivative @expr{f'(x)} and thus |
| 9382 | the formula | 9375 | the formula |
| 9383 | @texline @tmath{\displaystyle{x - {f(x) \over f'(x)}}}. | 9376 | @texline @math{\displaystyle{x - {f(x) \over f'(x)}}}. |
| 9384 | @infoline @expr{x - f(x)/f'(x)}. | 9377 | @infoline @expr{x - f(x)/f'(x)}. |
| 9385 | 9378 | ||
| 9386 | (Because this definition is long, it will be repeated in concise form | 9379 | (Because this definition is long, it will be repeated in concise form |
| @@ -9497,10 +9490,10 @@ method (among others) to look for numerical solutions to any equation. | |||
| 9497 | The first step is to adjust @expr{z} to be greater than 5. A simple | 9490 | The first step is to adjust @expr{z} to be greater than 5. A simple |
| 9498 | ``for'' loop will do the job here. If @expr{z} is less than 5, we | 9491 | ``for'' loop will do the job here. If @expr{z} is less than 5, we |
| 9499 | reduce the problem using | 9492 | reduce the problem using |
| 9500 | @texline @tmath{\psi(z) = \psi(z+1) - 1/z}. | 9493 | @texline @math{\psi(z) = \psi(z+1) - 1/z}. |
| 9501 | @infoline @expr{psi(z) = psi(z+1) - 1/z}. We go | 9494 | @infoline @expr{psi(z) = psi(z+1) - 1/z}. We go |
| 9502 | on to compute | 9495 | on to compute |
| 9503 | @texline @tmath{\psi(z+1)}, | 9496 | @texline @math{\psi(z+1)}, |
| 9504 | @infoline @expr{psi(z+1)}, | 9497 | @infoline @expr{psi(z+1)}, |
| 9505 | and remember to add back a factor of @expr{-1/z} when we're done. This | 9498 | and remember to add back a factor of @expr{-1/z} when we're done. This |
| 9506 | step is repeated until @expr{z > 5}. | 9499 | step is repeated until @expr{z > 5}. |
| @@ -9541,7 +9534,7 @@ are exactly equal, not just equal to within the current precision.) | |||
| 9541 | @end smallexample | 9534 | @end smallexample |
| 9542 | 9535 | ||
| 9543 | Now we compute the initial part of the sum: | 9536 | Now we compute the initial part of the sum: |
| 9544 | @texline @tmath{\ln z - {1 \over 2z}} | 9537 | @texline @math{\ln z - {1 \over 2z}} |
| 9545 | @infoline @expr{ln(z) - 1/2z} | 9538 | @infoline @expr{ln(z) - 1/2z} |
| 9546 | minus the adjustment factor. | 9539 | minus the adjustment factor. |
| 9547 | 9540 | ||
| @@ -9584,7 +9577,7 @@ up the value of @expr{2 n}. (Calc does have a summation command, | |||
| 9584 | @end smallexample | 9577 | @end smallexample |
| 9585 | 9578 | ||
| 9586 | This is the value of | 9579 | This is the value of |
| 9587 | @texline @tmath{-\gamma}, | 9580 | @texline @math{-\gamma}, |
| 9588 | @infoline @expr{- gamma}, | 9581 | @infoline @expr{- gamma}, |
| 9589 | with a slight bit of roundoff error. To get a full 12 digits, let's use | 9582 | with a slight bit of roundoff error. To get a full 12 digits, let's use |
| 9590 | a higher precision: | 9583 | a higher precision: |
| @@ -9619,7 +9612,7 @@ C-x ) | |||
| 9619 | @noindent | 9612 | @noindent |
| 9620 | Taking the derivative of a term of the form @expr{x^n} will produce | 9613 | Taking the derivative of a term of the form @expr{x^n} will produce |
| 9621 | a term like | 9614 | a term like |
| 9622 | @texline @tmath{n x^{n-1}}. | 9615 | @texline @math{n x^{n-1}}. |
| 9623 | @infoline @expr{n x^(n-1)}. | 9616 | @infoline @expr{n x^(n-1)}. |
| 9624 | Taking the derivative of a constant | 9617 | Taking the derivative of a constant |
| 9625 | produces zero. From this it is easy to see that the @expr{n}th | 9618 | produces zero. From this it is easy to see that the @expr{n}th |
| @@ -10193,7 +10186,7 @@ The first three keystrokes ``push'' the numbers 1 and 2 onto the stack. The | |||
| 10193 | @kbd{+} key always ``pops'' the top two numbers from the stack, adds them, | 10186 | @kbd{+} key always ``pops'' the top two numbers from the stack, adds them, |
| 10194 | and pushes the result (3) back onto the stack. This number is ready for | 10187 | and pushes the result (3) back onto the stack. This number is ready for |
| 10195 | further calculations: @kbd{5 -} pushes 5 onto the stack, then pops the | 10188 | further calculations: @kbd{5 -} pushes 5 onto the stack, then pops the |
| 10196 | 3 and 5, subtracts them, and pushes the result (@i{-2}). | 10189 | 3 and 5, subtracts them, and pushes the result (@mathit{-2}). |
| 10197 | 10190 | ||
| 10198 | Note that the ``top'' of the stack actually appears at the @emph{bottom} | 10191 | Note that the ``top'' of the stack actually appears at the @emph{bottom} |
| 10199 | of the buffer. A line containing a single @samp{.} character signifies | 10192 | of the buffer. A line containing a single @samp{.} character signifies |
| @@ -10256,7 +10249,7 @@ the two numbers on the top of the stack. The @kbd{n} key changes the sign | |||
| 10256 | of the number on the top of the stack or the number currently being entered. | 10249 | of the number on the top of the stack or the number currently being entered. |
| 10257 | The @kbd{_} key begins entry of a negative number or changes the sign of | 10250 | The @kbd{_} key begins entry of a negative number or changes the sign of |
| 10258 | the number currently being entered. The following sequences all enter the | 10251 | the number currently being entered. The following sequences all enter the |
| 10259 | number @i{-5} onto the stack: @kbd{0 @key{RET} 5 -}, @kbd{5 n @key{RET}}, | 10252 | number @mathit{-5} onto the stack: @kbd{0 @key{RET} 5 -}, @kbd{5 n @key{RET}}, |
| 10260 | @kbd{5 @key{RET} n}, @kbd{_ 5 @key{RET}}, @kbd{5 _ @key{RET}}. | 10253 | @kbd{5 @key{RET} n}, @kbd{_ 5 @key{RET}}, @kbd{5 _ @key{RET}}. |
| 10261 | 10254 | ||
| 10262 | Some other keys are active during numeric entry, such as @kbd{#} for | 10255 | Some other keys are active during numeric entry, such as @kbd{#} for |
| @@ -10277,7 +10270,7 @@ During numeric entry, the only editing key available is @key{DEL}. | |||
| 10277 | Calculations can also be entered in algebraic form. This is accomplished | 10270 | Calculations can also be entered in algebraic form. This is accomplished |
| 10278 | by typing the apostrophe key, @kbd{'}, followed by the expression in | 10271 | by typing the apostrophe key, @kbd{'}, followed by the expression in |
| 10279 | standard format: @kbd{@key{'} 2+3*4 @key{RET}} computes | 10272 | standard format: @kbd{@key{'} 2+3*4 @key{RET}} computes |
| 10280 | @texline @tmath{2+(3\times4) = 14} | 10273 | @texline @math{2+(3\times4) = 14} |
| 10281 | @infoline @expr{2+(3*4) = 14} | 10274 | @infoline @expr{2+(3*4) = 14} |
| 10282 | and pushes that on the stack. If you wish you can | 10275 | and pushes that on the stack. If you wish you can |
| 10283 | ignore the RPN aspect of Calc altogether and simply enter algebraic | 10276 | ignore the RPN aspect of Calc altogether and simply enter algebraic |
| @@ -10687,7 +10680,7 @@ approximation. This value will not need to be recomputed ever again | |||
| 10687 | unless you raise the precision still further. Many operations such as | 10680 | unless you raise the precision still further. Many operations such as |
| 10688 | logarithms and sines make use of similarly cached values such as | 10681 | logarithms and sines make use of similarly cached values such as |
| 10689 | @cpiover{4} and | 10682 | @cpiover{4} and |
| 10690 | @texline @tmath{\ln 2}. | 10683 | @texline @math{\ln 2}. |
| 10691 | @infoline @expr{ln(2)}. | 10684 | @infoline @expr{ln(2)}. |
| 10692 | The visible effect of caching is that | 10685 | The visible effect of caching is that |
| 10693 | high-precision computations may seem to do extra work the first time. | 10686 | high-precision computations may seem to do extra work the first time. |
| @@ -10846,10 +10839,10 @@ A floating-point number or @dfn{float} is a number stored in scientific | |||
| 10846 | notation. The number of significant digits in the fractional part is | 10839 | notation. The number of significant digits in the fractional part is |
| 10847 | governed by the current floating precision (@pxref{Precision}). The | 10840 | governed by the current floating precision (@pxref{Precision}). The |
| 10848 | range of acceptable values is from | 10841 | range of acceptable values is from |
| 10849 | @texline @tmath{10^{-3999999}} | 10842 | @texline @math{10^{-3999999}} |
| 10850 | @infoline @expr{10^-3999999} | 10843 | @infoline @expr{10^-3999999} |
| 10851 | (inclusive) to | 10844 | (inclusive) to |
| 10852 | @texline @tmath{10^{4000000}} | 10845 | @texline @math{10^{4000000}} |
| 10853 | @infoline @expr{10^4000000} | 10846 | @infoline @expr{10^4000000} |
| 10854 | (exclusive), plus the corresponding negative values and zero. | 10847 | (exclusive), plus the corresponding negative values and zero. |
| 10855 | 10848 | ||
| @@ -10921,16 +10914,16 @@ Rectangular complex numbers can also be displayed in @samp{@var{a}+@var{b}i} | |||
| 10921 | notation; @pxref{Complex Formats}. | 10914 | notation; @pxref{Complex Formats}. |
| 10922 | 10915 | ||
| 10923 | Polar complex numbers are displayed in the form | 10916 | Polar complex numbers are displayed in the form |
| 10924 | @texline `@t{(}@var{r}@t{;}@tmath{\theta}@t{)}' | 10917 | @texline `@t{(}@var{r}@t{;}@math{\theta}@t{)}' |
| 10925 | @infoline `@t{(}@var{r}@t{;}@var{theta}@t{)}' | 10918 | @infoline `@t{(}@var{r}@t{;}@var{theta}@t{)}' |
| 10926 | where @var{r} is the nonnegative magnitude and | 10919 | where @var{r} is the nonnegative magnitude and |
| 10927 | @texline @tmath{\theta} | 10920 | @texline @math{\theta} |
| 10928 | @infoline @var{theta} | 10921 | @infoline @var{theta} |
| 10929 | is the argument or phase angle. The range of | 10922 | is the argument or phase angle. The range of |
| 10930 | @texline @tmath{\theta} | 10923 | @texline @math{\theta} |
| 10931 | @infoline @var{theta} | 10924 | @infoline @var{theta} |
| 10932 | depends on the current angular mode (@pxref{Angular Modes}); it is | 10925 | depends on the current angular mode (@pxref{Angular Modes}); it is |
| 10933 | generally between @i{-180} and @i{+180} degrees or the equivalent range | 10926 | generally between @mathit{-180} and @mathit{+180} degrees or the equivalent range |
| 10934 | in radians. | 10927 | in radians. |
| 10935 | 10928 | ||
| 10936 | Complex numbers are entered in stages using incomplete objects. | 10929 | Complex numbers are entered in stages using incomplete objects. |
| @@ -10973,7 +10966,7 @@ larger, becomes arbitrarily close to zero. So you can imagine | |||
| 10973 | that if @expr{x} got ``all the way to infinity,'' then @expr{1 / x} | 10966 | that if @expr{x} got ``all the way to infinity,'' then @expr{1 / x} |
| 10974 | would go all the way to zero. Similarly, when they say that | 10967 | would go all the way to zero. Similarly, when they say that |
| 10975 | @samp{exp(inf) = inf}, they mean that | 10968 | @samp{exp(inf) = inf}, they mean that |
| 10976 | @texline @tmath{e^x} | 10969 | @texline @math{e^x} |
| 10977 | @infoline @expr{exp(x)} | 10970 | @infoline @expr{exp(x)} |
| 10978 | grows without bound as @expr{x} grows. The symbol @samp{-inf} likewise | 10971 | grows without bound as @expr{x} grows. The symbol @samp{-inf} likewise |
| 10979 | stands for an infinitely negative real value; for example, we say that | 10972 | stands for an infinitely negative real value; for example, we say that |
| @@ -11070,7 +11063,7 @@ of its elements. | |||
| 11070 | @tindex vec | 11063 | @tindex vec |
| 11071 | Algebraic functions for building vectors include @samp{vec(a, b, c)} | 11064 | Algebraic functions for building vectors include @samp{vec(a, b, c)} |
| 11072 | to build @samp{[a, b, c]}, @samp{cvec(a, n, m)} to build an | 11065 | to build @samp{[a, b, c]}, @samp{cvec(a, n, m)} to build an |
| 11073 | @texline @tmath{n\times m} | 11066 | @texline @math{n\times m} |
| 11074 | @infoline @var{n}x@var{m} | 11067 | @infoline @var{n}x@var{m} |
| 11075 | matrix of @samp{a}s, and @samp{index(n)} to build a vector of integers | 11068 | matrix of @samp{a}s, and @samp{index(n)} to build a vector of integers |
| 11076 | from 1 to @samp{n}. | 11069 | from 1 to @samp{n}. |
| @@ -11201,7 +11194,7 @@ The @var{mins} value is an integer or integer-valued float between 0 and 59. | |||
| 11201 | The @var{secs} value is a real number between 0 (inclusive) and 60 | 11194 | The @var{secs} value is a real number between 0 (inclusive) and 60 |
| 11202 | (exclusive). A positive HMS form is interpreted as @var{hours} + | 11195 | (exclusive). A positive HMS form is interpreted as @var{hours} + |
| 11203 | @var{mins}/60 + @var{secs}/3600. A negative HMS form is interpreted | 11196 | @var{mins}/60 + @var{secs}/3600. A negative HMS form is interpreted |
| 11204 | as @i{- @var{hours}} @i{-} @var{mins}/60 @i{-} @var{secs}/3600. | 11197 | as @mathit{- @var{hours}} @mathit{-} @var{mins}/60 @mathit{-} @var{secs}/3600. |
| 11205 | Display format for HMS forms is quite flexible. @xref{HMS Formats}. | 11198 | Display format for HMS forms is quite flexible. @xref{HMS Formats}. |
| 11206 | 11199 | ||
| 11207 | HMS forms can be added and subtracted. When they are added to numbers, | 11200 | HMS forms can be added and subtracted. When they are added to numbers, |
| @@ -11295,12 +11288,12 @@ between, say, @samp{<12:00am Mon Jan 1, 1900>} and | |||
| 11295 | 11288 | ||
| 11296 | Calc uses the Julian calendar for all dates before the year 1752, | 11289 | Calc uses the Julian calendar for all dates before the year 1752, |
| 11297 | including dates BC when the Julian calendar technically had not | 11290 | including dates BC when the Julian calendar technically had not |
| 11298 | yet been invented. Thus the claim that day number @i{-10000} is | 11291 | yet been invented. Thus the claim that day number @mathit{-10000} is |
| 11299 | called ``August 16, 28 BC'' should be taken with a grain of salt. | 11292 | called ``August 16, 28 BC'' should be taken with a grain of salt. |
| 11300 | 11293 | ||
| 11301 | Please note that there is no ``year 0''; the day before | 11294 | Please note that there is no ``year 0''; the day before |
| 11302 | @samp{<Sat Jan 1, +1>} is @samp{<Fri Dec 31, -1>}. These are | 11295 | @samp{<Sat Jan 1, +1>} is @samp{<Fri Dec 31, -1>}. These are |
| 11303 | days 0 and @i{-1} respectively in Calc's internal numbering scheme. | 11296 | days 0 and @mathit{-1} respectively in Calc's internal numbering scheme. |
| 11304 | 11297 | ||
| 11305 | @cindex Julian day counting | 11298 | @cindex Julian day counting |
| 11306 | Another day counting system in common use is, confusingly, also | 11299 | Another day counting system in common use is, confusingly, also |
| @@ -11308,7 +11301,7 @@ called ``Julian.'' It was invented in 1583 by Joseph Justus | |||
| 11308 | Scaliger, who named it in honor of his father Julius Caesar | 11301 | Scaliger, who named it in honor of his father Julius Caesar |
| 11309 | Scaliger. For obscure reasons he chose to start his day | 11302 | Scaliger. For obscure reasons he chose to start his day |
| 11310 | numbering on Jan 1, 4713 BC at noon, which in Calc's scheme | 11303 | numbering on Jan 1, 4713 BC at noon, which in Calc's scheme |
| 11311 | is @i{-1721423.5} (recall that Calc starts at midnight instead | 11304 | is @mathit{-1721423.5} (recall that Calc starts at midnight instead |
| 11312 | of noon). Thus to convert a Calc date code obtained by | 11305 | of noon). Thus to convert a Calc date code obtained by |
| 11313 | unpacking a date form into a Julian day number, simply add | 11306 | unpacking a date form into a Julian day number, simply add |
| 11314 | 1721423.5. The Julian code for @samp{6:00am Jan 9, 1991} | 11307 | 1721423.5. The Julian code for @samp{6:00am Jan 9, 1991} |
| @@ -11341,7 +11334,7 @@ an integer multiple of) some value @var{M}. Arithmetic modulo @var{M} | |||
| 11341 | often arises in number theory. Modulo forms are written | 11334 | often arises in number theory. Modulo forms are written |
| 11342 | `@var{a} @t{mod} @var{M}', | 11335 | `@var{a} @t{mod} @var{M}', |
| 11343 | where @var{a} and @var{M} are real numbers or HMS forms, and | 11336 | where @var{a} and @var{M} are real numbers or HMS forms, and |
| 11344 | @texline @tmath{0 \le a < M}. | 11337 | @texline @math{0 \le a < M}. |
| 11345 | @infoline @expr{0 <= a < @var{M}}. | 11338 | @infoline @expr{0 <= a < @var{M}}. |
| 11346 | In many applications @expr{a} and @expr{M} will be | 11339 | In many applications @expr{a} and @expr{M} will be |
| 11347 | integers but this is not required. | 11340 | integers but this is not required. |
| @@ -11373,7 +11366,7 @@ division is left in symbolic form. Other operations, such as square | |||
| 11373 | roots, are not yet supported for modulo forms. (Note that, although | 11366 | roots, are not yet supported for modulo forms. (Note that, although |
| 11374 | @w{`@t{(}@var{a} @t{mod} @var{M}@t{)^.5}'} will compute a ``modulo square root'' | 11367 | @w{`@t{(}@var{a} @t{mod} @var{M}@t{)^.5}'} will compute a ``modulo square root'' |
| 11375 | in the sense of reducing | 11368 | in the sense of reducing |
| 11376 | @texline @tmath{\sqrt a} | 11369 | @texline @math{\sqrt a} |
| 11377 | @infoline @expr{sqrt(a)} | 11370 | @infoline @expr{sqrt(a)} |
| 11378 | modulo @expr{M}, this is not a useful definition from the | 11371 | modulo @expr{M}, this is not a useful definition from the |
| 11379 | number-theoretical point of view.) | 11372 | number-theoretical point of view.) |
| @@ -11423,12 +11416,12 @@ The algebraic function @samp{makemod(a, m)} builds the modulo form | |||
| 11423 | @cindex Standard deviations | 11416 | @cindex Standard deviations |
| 11424 | An @dfn{error form} is a number with an associated standard | 11417 | An @dfn{error form} is a number with an associated standard |
| 11425 | deviation, as in @samp{2.3 +/- 0.12}. The notation | 11418 | deviation, as in @samp{2.3 +/- 0.12}. The notation |
| 11426 | @texline `@var{x} @t{+/-} @tmath{\sigma}' | 11419 | @texline `@var{x} @t{+/-} @math{\sigma}' |
| 11427 | @infoline `@var{x} @t{+/-} sigma' | 11420 | @infoline `@var{x} @t{+/-} sigma' |
| 11428 | stands for an uncertain value which follows | 11421 | stands for an uncertain value which follows |
| 11429 | a normal or Gaussian distribution of mean @expr{x} and standard | 11422 | a normal or Gaussian distribution of mean @expr{x} and standard |
| 11430 | deviation or ``error'' | 11423 | deviation or ``error'' |
| 11431 | @texline @tmath{\sigma}. | 11424 | @texline @math{\sigma}. |
| 11432 | @infoline @expr{sigma}. | 11425 | @infoline @expr{sigma}. |
| 11433 | Both the mean and the error can be either numbers or | 11426 | Both the mean and the error can be either numbers or |
| 11434 | formulas. Generally these are real numbers but the mean may also be | 11427 | formulas. Generally these are real numbers but the mean may also be |
| @@ -11439,7 +11432,7 @@ regular number by the Calculator. | |||
| 11439 | All arithmetic and transcendental functions accept error forms as input. | 11432 | All arithmetic and transcendental functions accept error forms as input. |
| 11440 | Operations on the mean-value part work just like operations on regular | 11433 | Operations on the mean-value part work just like operations on regular |
| 11441 | numbers. The error part for any function @expr{f(x)} (such as | 11434 | numbers. The error part for any function @expr{f(x)} (such as |
| 11442 | @texline @tmath{\sin x} | 11435 | @texline @math{\sin x} |
| 11443 | @infoline @expr{sin(x)}) | 11436 | @infoline @expr{sin(x)}) |
| 11444 | is defined by the error of @expr{x} times the derivative of @expr{f} | 11437 | is defined by the error of @expr{x} times the derivative of @expr{f} |
| 11445 | evaluated at the mean value of @expr{x}. For a two-argument function | 11438 | evaluated at the mean value of @expr{x}. For a two-argument function |
| @@ -11470,34 +11463,34 @@ Consult a good text on error analysis for a discussion of the proper use | |||
| 11470 | of standard deviations. Actual errors often are neither Gaussian-distributed | 11463 | of standard deviations. Actual errors often are neither Gaussian-distributed |
| 11471 | nor uncorrelated, and the above formulas are valid only when errors | 11464 | nor uncorrelated, and the above formulas are valid only when errors |
| 11472 | are small. As an example, the error arising from | 11465 | are small. As an example, the error arising from |
| 11473 | @texline `@t{sin(}@var{x} @t{+/-} @tmath{\sigma}@t{)}' | 11466 | @texline `@t{sin(}@var{x} @t{+/-} @math{\sigma}@t{)}' |
| 11474 | @infoline `@t{sin(}@var{x} @t{+/-} @var{sigma}@t{)}' | 11467 | @infoline `@t{sin(}@var{x} @t{+/-} @var{sigma}@t{)}' |
| 11475 | is | 11468 | is |
| 11476 | @texline `@tmath{\sigma} @t{abs(cos(}@var{x}@t{))}'. | 11469 | @texline `@math{\sigma} @t{abs(cos(}@var{x}@t{))}'. |
| 11477 | @infoline `@var{sigma} @t{abs(cos(}@var{x}@t{))}'. | 11470 | @infoline `@var{sigma} @t{abs(cos(}@var{x}@t{))}'. |
| 11478 | When @expr{x} is close to zero, | 11471 | When @expr{x} is close to zero, |
| 11479 | @texline @tmath{\cos x} | 11472 | @texline @math{\cos x} |
| 11480 | @infoline @expr{cos(x)} | 11473 | @infoline @expr{cos(x)} |
| 11481 | is close to one so the error in the sine is close to | 11474 | is close to one so the error in the sine is close to |
| 11482 | @texline @tmath{\sigma}; | 11475 | @texline @math{\sigma}; |
| 11483 | @infoline @expr{sigma}; | 11476 | @infoline @expr{sigma}; |
| 11484 | this makes sense, since | 11477 | this makes sense, since |
| 11485 | @texline @tmath{\sin x} | 11478 | @texline @math{\sin x} |
| 11486 | @infoline @expr{sin(x)} | 11479 | @infoline @expr{sin(x)} |
| 11487 | is approximately @expr{x} near zero, so a given error in @expr{x} will | 11480 | is approximately @expr{x} near zero, so a given error in @expr{x} will |
| 11488 | produce about the same error in the sine. Likewise, near 90 degrees | 11481 | produce about the same error in the sine. Likewise, near 90 degrees |
| 11489 | @texline @tmath{\cos x} | 11482 | @texline @math{\cos x} |
| 11490 | @infoline @expr{cos(x)} | 11483 | @infoline @expr{cos(x)} |
| 11491 | is nearly zero and so the computed error is | 11484 | is nearly zero and so the computed error is |
| 11492 | small: The sine curve is nearly flat in that region, so an error in @expr{x} | 11485 | small: The sine curve is nearly flat in that region, so an error in @expr{x} |
| 11493 | has relatively little effect on the value of | 11486 | has relatively little effect on the value of |
| 11494 | @texline @tmath{\sin x}. | 11487 | @texline @math{\sin x}. |
| 11495 | @infoline @expr{sin(x)}. | 11488 | @infoline @expr{sin(x)}. |
| 11496 | However, consider @samp{sin(90 +/- 1000)}. The cosine of 90 is zero, so | 11489 | However, consider @samp{sin(90 +/- 1000)}. The cosine of 90 is zero, so |
| 11497 | Calc will report zero error! We get an obviously wrong result because | 11490 | Calc will report zero error! We get an obviously wrong result because |
| 11498 | we have violated the small-error approximation underlying the error | 11491 | we have violated the small-error approximation underlying the error |
| 11499 | analysis. If the error in @expr{x} had been small, the error in | 11492 | analysis. If the error in @expr{x} had been small, the error in |
| 11500 | @texline @tmath{\sin x} | 11493 | @texline @math{\sin x} |
| 11501 | @infoline @expr{sin(x)} | 11494 | @infoline @expr{sin(x)} |
| 11502 | would indeed have been negligible. | 11495 | would indeed have been negligible. |
| 11503 | 11496 | ||
| @@ -11606,11 +11599,11 @@ contain zero inside them Calc is forced to give the result, | |||
| 11606 | While it may seem that intervals and error forms are similar, they are | 11599 | While it may seem that intervals and error forms are similar, they are |
| 11607 | based on entirely different concepts of inexact quantities. An error | 11600 | based on entirely different concepts of inexact quantities. An error |
| 11608 | form | 11601 | form |
| 11609 | @texline `@var{x} @t{+/-} @tmath{\sigma}' | 11602 | @texline `@var{x} @t{+/-} @math{\sigma}' |
| 11610 | @infoline `@var{x} @t{+/-} @var{sigma}' | 11603 | @infoline `@var{x} @t{+/-} @var{sigma}' |
| 11611 | means a variable is random, and its value could | 11604 | means a variable is random, and its value could |
| 11612 | be anything but is ``probably'' within one | 11605 | be anything but is ``probably'' within one |
| 11613 | @texline @tmath{\sigma} | 11606 | @texline @math{\sigma} |
| 11614 | @infoline @var{sigma} | 11607 | @infoline @var{sigma} |
| 11615 | of the mean value @expr{x}. An interval | 11608 | of the mean value @expr{x}. An interval |
| 11616 | `@t{[}@var{a} @t{..@:} @var{b}@t{]}' means a | 11609 | `@t{[}@var{a} @t{..@:} @var{b}@t{]}' means a |
| @@ -11844,7 +11837,7 @@ the C-style ``if'' operator @samp{a?b:c} [@code{if}]; | |||
| 11844 | 11837 | ||
| 11845 | Note that, unlike in usual computer notation, multiplication binds more | 11838 | Note that, unlike in usual computer notation, multiplication binds more |
| 11846 | strongly than division: @samp{a*b/c*d} is equivalent to | 11839 | strongly than division: @samp{a*b/c*d} is equivalent to |
| 11847 | @texline @tmath{a b \over c d}. | 11840 | @texline @math{a b \over c d}. |
| 11848 | @infoline @expr{(a*b)/(c*d)}. | 11841 | @infoline @expr{(a*b)/(c*d)}. |
| 11849 | 11842 | ||
| 11850 | @cindex Multiplication, implicit | 11843 | @cindex Multiplication, implicit |
| @@ -12042,11 +12035,11 @@ intervening stack elements toward the top. @kbd{M-@key{TAB}} moves the | |||
| 12042 | element at level @var{n} up to the top. (Compare with @key{LFD}, | 12035 | element at level @var{n} up to the top. (Compare with @key{LFD}, |
| 12043 | which copies instead of moving the element in level @var{n}.) | 12036 | which copies instead of moving the element in level @var{n}.) |
| 12044 | 12037 | ||
| 12045 | With a negative argument @i{-@var{n}}, @key{TAB} rotates the stack | 12038 | With a negative argument @mathit{-@var{n}}, @key{TAB} rotates the stack |
| 12046 | to move the object in level @var{n} to the deepest place in the | 12039 | to move the object in level @var{n} to the deepest place in the |
| 12047 | stack, and the object in level @i{@var{n}+1} to the top. @kbd{M-@key{TAB}} | 12040 | stack, and the object in level @mathit{@var{n}+1} to the top. @kbd{M-@key{TAB}} |
| 12048 | rotates the deepest stack element to be in level @i{n}, also | 12041 | rotates the deepest stack element to be in level @mathit{n}, also |
| 12049 | putting the top stack element in level @i{@var{n}+1}. | 12042 | putting the top stack element in level @mathit{@var{n}+1}. |
| 12050 | 12043 | ||
| 12051 | @xref{Selecting Subformulas}, for a way to apply these commands to | 12044 | @xref{Selecting Subformulas}, for a way to apply these commands to |
| 12052 | any portion of a vector or formula on the stack. | 12045 | any portion of a vector or formula on the stack. |
| @@ -12341,8 +12334,8 @@ inside it, @kbd{m F} will not automatically load the new file. This | |||
| 12341 | is because you are presumably switching to your @file{~/.emacs} file, | 12334 | is because you are presumably switching to your @file{~/.emacs} file, |
| 12342 | which may contain other things you don't want to reread. You can give | 12335 | which may contain other things you don't want to reread. You can give |
| 12343 | a numeric prefix argument of 1 to @kbd{m F} to force it to read the | 12336 | a numeric prefix argument of 1 to @kbd{m F} to force it to read the |
| 12344 | file no matter what its name. Conversely, an argument of @i{-1} tells | 12337 | file no matter what its name. Conversely, an argument of @mathit{-1} tells |
| 12345 | @kbd{m F} @emph{not} to read the new file. An argument of 2 or @i{-2} | 12338 | @kbd{m F} @emph{not} to read the new file. An argument of 2 or @mathit{-2} |
| 12346 | tells @kbd{m F} not to reset the modes to their defaults beforehand, | 12339 | tells @kbd{m F} not to reset the modes to their defaults beforehand, |
| 12347 | which is useful if you intend your new file to have a variant of the | 12340 | which is useful if you intend your new file to have a variant of the |
| 12348 | modes present in the file you were using before. | 12341 | modes present in the file you were using before. |
| @@ -12447,7 +12440,7 @@ Hyperbolic Flag, which transforms @code{calc-sin} into @code{calc-sinh}. | |||
| 12447 | If both of these flags are set at once, the effect will be | 12440 | If both of these flags are set at once, the effect will be |
| 12448 | @code{calc-arcsinh}. (The Hyperbolic flag is also used by some | 12441 | @code{calc-arcsinh}. (The Hyperbolic flag is also used by some |
| 12449 | non-trigonometric commands; for example @kbd{H L} computes a base-10, | 12442 | non-trigonometric commands; for example @kbd{H L} computes a base-10, |
| 12450 | instead of base-@i{e}, logarithm.) | 12443 | instead of base-@mathit{e}, logarithm.) |
| 12451 | 12444 | ||
| 12452 | Command names like @code{calc-arcsin} are provided for completeness, and | 12445 | Command names like @code{calc-arcsin} are provided for completeness, and |
| 12453 | may be executed with @kbd{x} or @kbd{M-x}. Their effect is simply to | 12446 | may be executed with @kbd{x} or @kbd{M-x}. Their effect is simply to |
| @@ -12591,7 +12584,7 @@ i.e., @kbd{C-u 0 m i}, turns on a ``positive infinite mode'' in | |||
| 12591 | which zero is treated as positive instead of being directionless. | 12584 | which zero is treated as positive instead of being directionless. |
| 12592 | Thus, @samp{1 / 0 = inf} and @samp{-1 / 0 = -inf} in this mode. | 12585 | Thus, @samp{1 / 0 = inf} and @samp{-1 / 0 = -inf} in this mode. |
| 12593 | Note that zero never actually has a sign in Calc; there are no | 12586 | Note that zero never actually has a sign in Calc; there are no |
| 12594 | separate representations for @i{+0} and @i{-0}. Positive | 12587 | separate representations for @mathit{+0} and @mathit{-0}. Positive |
| 12595 | infinite mode merely changes the interpretation given to the | 12588 | infinite mode merely changes the interpretation given to the |
| 12596 | single symbol, @samp{0}. One consequence of this is that, while | 12589 | single symbol, @samp{0}. One consequence of this is that, while |
| 12597 | you might expect @samp{1 / -0 = -inf}, actually @samp{1 / -0} | 12590 | you might expect @samp{1 / -0 = -inf}, actually @samp{1 / -0} |
| @@ -12982,7 +12975,7 @@ Numbers. (Real or complex.) | |||
| 12982 | Calc uses this information to determine when certain simplifications | 12975 | Calc uses this information to determine when certain simplifications |
| 12983 | of formulas are safe. For example, @samp{(x^y)^z} cannot be | 12976 | of formulas are safe. For example, @samp{(x^y)^z} cannot be |
| 12984 | simplified to @samp{x^(y z)} in general; for example, | 12977 | simplified to @samp{x^(y z)} in general; for example, |
| 12985 | @samp{((-3)^2)^1:2} is 3, but @samp{(-3)^(2*1:2) = (-3)^1} is @i{-3}. | 12978 | @samp{((-3)^2)^1:2} is 3, but @samp{(-3)^(2*1:2) = (-3)^1} is @mathit{-3}. |
| 12986 | However, this simplification @emph{is} safe if @code{z} is known | 12979 | However, this simplification @emph{is} safe if @code{z} is known |
| 12987 | to be an integer, or if @code{x} is known to be a nonnegative | 12980 | to be an integer, or if @code{x} is known to be a nonnegative |
| 12988 | real number. If you have given declarations that allow Calc to | 12981 | real number. If you have given declarations that allow Calc to |
| @@ -13095,7 +13088,7 @@ The value is a constant with respect to other variables. | |||
| 13095 | @end table | 13088 | @end table |
| 13096 | 13089 | ||
| 13097 | Calc does not check the declarations for a variable when you store | 13090 | Calc does not check the declarations for a variable when you store |
| 13098 | a value in it. However, storing @i{-3.5} in a variable that has | 13091 | a value in it. However, storing @mathit{-3.5} in a variable that has |
| 13099 | been declared @code{pos}, @code{int}, or @code{matrix} may have | 13092 | been declared @code{pos}, @code{int}, or @code{matrix} may have |
| 13100 | unexpected effects; Calc may evaluate @samp{sqrt(x^2)} to @expr{3.5} | 13093 | unexpected effects; Calc may evaluate @samp{sqrt(x^2)} to @expr{3.5} |
| 13101 | if it substitutes the value first, or to @expr{-3.5} if @code{x} | 13094 | if it substitutes the value first, or to @expr{-3.5} if @code{x} |
| @@ -13330,7 +13323,7 @@ command causes integers to be padded out with leading zeros according to the | |||
| 13330 | current binary word size. (@xref{Binary Functions}, for a discussion of | 13323 | current binary word size. (@xref{Binary Functions}, for a discussion of |
| 13331 | word size.) If the absolute value of the word size is @expr{w}, all integers | 13324 | word size.) If the absolute value of the word size is @expr{w}, all integers |
| 13332 | are displayed with at least enough digits to represent | 13325 | are displayed with at least enough digits to represent |
| 13333 | @texline @tmath{2^w-1} | 13326 | @texline @math{2^w-1} |
| 13334 | @infoline @expr{(2^w)-1} | 13327 | @infoline @expr{(2^w)-1} |
| 13335 | in the current radix. (Larger integers will still be displayed in their | 13328 | in the current radix. (Larger integers will still be displayed in their |
| 13336 | entirety.) | 13329 | entirety.) |
| @@ -14231,10 +14224,10 @@ special names (like @code{\sin}) will use curly braces instead of | |||
| 14231 | parentheses for very simple arguments. During input, curly braces and | 14224 | parentheses for very simple arguments. During input, curly braces and |
| 14232 | parentheses work equally well for grouping, but when the document is | 14225 | parentheses work equally well for grouping, but when the document is |
| 14233 | formatted the curly braces will be invisible. Thus the printed result is | 14226 | formatted the curly braces will be invisible. Thus the printed result is |
| 14234 | @texline @tmath{\sin{2 x}} | 14227 | @texline @math{\sin{2 x}} |
| 14235 | @infoline @expr{sin 2x} | 14228 | @infoline @expr{sin 2x} |
| 14236 | but | 14229 | but |
| 14237 | @texline @tmath{\sin(2 + x)}. | 14230 | @texline @math{\sin(2 + x)}. |
| 14238 | @infoline @expr{sin(2 + x)}. | 14231 | @infoline @expr{sin(2 + x)}. |
| 14239 | 14232 | ||
| 14240 | Function and variable names not treated specially by @TeX{} are simply | 14233 | Function and variable names not treated specially by @TeX{} are simply |
| @@ -15728,19 +15721,19 @@ Polar mode. Value is 0 (rectangular) or 1 (polar); default is 0. | |||
| 15728 | Command is @kbd{m p}. | 15721 | Command is @kbd{m p}. |
| 15729 | 15722 | ||
| 15730 | @item | 15723 | @item |
| 15731 | Matrix/scalar mode. Default value is @i{-1}. Value is 0 for scalar | 15724 | Matrix/scalar mode. Default value is @mathit{-1}. Value is 0 for scalar |
| 15732 | mode, @i{-2} for matrix mode, or @var{N} for | 15725 | mode, @mathit{-2} for matrix mode, or @var{N} for |
| 15733 | @texline @tmath{N\times N} | 15726 | @texline @math{N\times N} |
| 15734 | @infoline @var{N}x@var{N} | 15727 | @infoline @var{N}x@var{N} |
| 15735 | matrix mode. Command is @kbd{m v}. | 15728 | matrix mode. Command is @kbd{m v}. |
| 15736 | 15729 | ||
| 15737 | @item | 15730 | @item |
| 15738 | Simplification mode. Default is 1. Value is @i{-1} for off (@kbd{m O}), | 15731 | Simplification mode. Default is 1. Value is @mathit{-1} for off (@kbd{m O}), |
| 15739 | 0 for @kbd{m N}, 2 for @kbd{m B}, 3 for @kbd{m A}, 4 for @kbd{m E}, | 15732 | 0 for @kbd{m N}, 2 for @kbd{m B}, 3 for @kbd{m A}, 4 for @kbd{m E}, |
| 15740 | or 5 for @w{@kbd{m U}}. The @kbd{m D} command accepts these prefixes. | 15733 | or 5 for @w{@kbd{m U}}. The @kbd{m D} command accepts these prefixes. |
| 15741 | 15734 | ||
| 15742 | @item | 15735 | @item |
| 15743 | Infinite mode. Default is @i{-1} (off). Value is 1 if the mode is on, | 15736 | Infinite mode. Default is @mathit{-1} (off). Value is 1 if the mode is on, |
| 15744 | or 0 if the mode is on with positive zeros. Command is @kbd{m i}. | 15737 | or 0 if the mode is on with positive zeros. Command is @kbd{m i}. |
| 15745 | @end enumerate | 15738 | @end enumerate |
| 15746 | 15739 | ||
| @@ -16081,7 +16074,7 @@ infinite in different directions the result is @code{nan}. | |||
| 16081 | @tindex - | 16074 | @tindex - |
| 16082 | The @kbd{-} (@code{calc-minus}) command subtracts two values. The top | 16075 | The @kbd{-} (@code{calc-minus}) command subtracts two values. The top |
| 16083 | number on the stack is subtracted from the one behind it, so that the | 16076 | number on the stack is subtracted from the one behind it, so that the |
| 16084 | computation @kbd{5 @key{RET} 2 -} produces 3, not @i{-3}. All options | 16077 | computation @kbd{5 @key{RET} 2 -} produces 3, not @mathit{-3}. All options |
| 16085 | available for @kbd{+} are available for @kbd{-} as well. | 16078 | available for @kbd{+} are available for @kbd{-} as well. |
| 16086 | 16079 | ||
| 16087 | @kindex * | 16080 | @kindex * |
| @@ -16225,7 +16218,7 @@ absolute value squared of a number, vector or matrix, or error form. | |||
| 16225 | @pindex calc-sign | 16218 | @pindex calc-sign |
| 16226 | @tindex sign | 16219 | @tindex sign |
| 16227 | The @kbd{f s} (@code{calc-sign}) [@code{sign}] command returns 1 if its | 16220 | The @kbd{f s} (@code{calc-sign}) [@code{sign}] command returns 1 if its |
| 16228 | argument is positive, @i{-1} if its argument is negative, or 0 if its | 16221 | argument is positive, @mathit{-1} if its argument is negative, or 0 if its |
| 16229 | argument is zero. In algebraic form, you can also write @samp{sign(a,x)} | 16222 | argument is zero. In algebraic form, you can also write @samp{sign(a,x)} |
| 16230 | which evaluates to @samp{x * sign(a)}, i.e., either @samp{x}, @samp{-x}, or | 16223 | which evaluates to @samp{x * sign(a)}, i.e., either @samp{x}, @samp{-x}, or |
| 16231 | zero depending on the sign of @samp{a}. | 16224 | zero depending on the sign of @samp{a}. |
| @@ -16288,7 +16281,7 @@ The @kbd{f M} (@code{calc-mant-part}) [@code{mant}] function extracts | |||
| 16288 | the ``mantissa'' part @expr{m} of its floating-point argument; @kbd{f X} | 16281 | the ``mantissa'' part @expr{m} of its floating-point argument; @kbd{f X} |
| 16289 | (@code{calc-xpon-part}) [@code{xpon}] extracts the ``exponent'' part | 16282 | (@code{calc-xpon-part}) [@code{xpon}] extracts the ``exponent'' part |
| 16290 | @expr{e}. The original number is equal to | 16283 | @expr{e}. The original number is equal to |
| 16291 | @texline @tmath{m \times 10^e}, | 16284 | @texline @math{m \times 10^e}, |
| 16292 | @infoline @expr{m * 10^e}, | 16285 | @infoline @expr{m * 10^e}, |
| 16293 | where @expr{m} is in the interval @samp{[1.0 ..@: 10.0)} except that | 16286 | where @expr{m} is in the interval @samp{[1.0 ..@: 10.0)} except that |
| 16294 | @expr{m=e=0} if the original number is zero. For integers | 16287 | @expr{m=e=0} if the original number is zero. For integers |
| @@ -16321,7 +16314,7 @@ For example, incrementing @samp{12.3456} when the current precision | |||
| 16321 | is 6 digits yields @samp{12.3457}. If the current precision had been | 16314 | is 6 digits yields @samp{12.3457}. If the current precision had been |
| 16322 | 8 digits, the result would have been @samp{12.345601}. Incrementing | 16315 | 8 digits, the result would have been @samp{12.345601}. Incrementing |
| 16323 | @samp{0.0} produces | 16316 | @samp{0.0} produces |
| 16324 | @texline @tmath{10^{-p}}, | 16317 | @texline @math{10^{-p}}, |
| 16325 | @infoline @expr{10^-p}, | 16318 | @infoline @expr{10^-p}, |
| 16326 | where @expr{p} is the current | 16319 | where @expr{p} is the current |
| 16327 | precision. These operations are defined only on integers and floats. | 16320 | precision. These operations are defined only on integers and floats. |
| @@ -16362,7 +16355,7 @@ expressed as an integer-valued floating-point number. | |||
| 16362 | The @kbd{F} (@code{calc-floor}) [@code{floor} or @code{ffloor}] command | 16355 | The @kbd{F} (@code{calc-floor}) [@code{floor} or @code{ffloor}] command |
| 16363 | truncates a real number to the next lower integer, i.e., toward minus | 16356 | truncates a real number to the next lower integer, i.e., toward minus |
| 16364 | infinity. Thus @kbd{3.6 F} produces 3, but @kbd{_3.6 F} produces | 16357 | infinity. Thus @kbd{3.6 F} produces 3, but @kbd{_3.6 F} produces |
| 16365 | @i{-4}. | 16358 | @mathit{-4}. |
| 16366 | 16359 | ||
| 16367 | @kindex I F | 16360 | @kindex I F |
| 16368 | @pindex calc-ceiling | 16361 | @pindex calc-ceiling |
| @@ -16374,7 +16367,7 @@ infinity. Thus @kbd{3.6 F} produces 3, but @kbd{_3.6 F} produces | |||
| 16374 | @kindex H I F | 16367 | @kindex H I F |
| 16375 | The @kbd{I F} (@code{calc-ceiling}) [@code{ceil} or @code{fceil}] | 16368 | The @kbd{I F} (@code{calc-ceiling}) [@code{ceil} or @code{fceil}] |
| 16376 | command truncates toward positive infinity. Thus @kbd{3.6 I F} produces | 16369 | command truncates toward positive infinity. Thus @kbd{3.6 I F} produces |
| 16377 | 4, and @kbd{_3.6 I F} produces @i{-3}. | 16370 | 4, and @kbd{_3.6 I F} produces @mathit{-3}. |
| 16378 | 16371 | ||
| 16379 | @kindex R | 16372 | @kindex R |
| 16380 | @pindex calc-round | 16373 | @pindex calc-round |
| @@ -16388,7 +16381,7 @@ The @kbd{R} (@code{calc-round}) [@code{round} or @code{fround}] command | |||
| 16388 | rounds to the nearest integer. When the fractional part is .5 exactly, | 16381 | rounds to the nearest integer. When the fractional part is .5 exactly, |
| 16389 | this command rounds away from zero. (All other rounding in the | 16382 | this command rounds away from zero. (All other rounding in the |
| 16390 | Calculator uses this convention as well.) Thus @kbd{3.5 R} produces 4 | 16383 | Calculator uses this convention as well.) Thus @kbd{3.5 R} produces 4 |
| 16391 | but @kbd{3.4 R} produces 3; @kbd{_3.5 R} produces @i{-4}. | 16384 | but @kbd{3.4 R} produces 3; @kbd{_3.5 R} produces @mathit{-4}. |
| 16392 | 16385 | ||
| 16393 | @kindex I R | 16386 | @kindex I R |
| 16394 | @pindex calc-trunc | 16387 | @pindex calc-trunc |
| @@ -16401,7 +16394,7 @@ but @kbd{3.4 R} produces 3; @kbd{_3.5 R} produces @i{-4}. | |||
| 16401 | The @kbd{I R} (@code{calc-trunc}) [@code{trunc} or @code{ftrunc}] | 16394 | The @kbd{I R} (@code{calc-trunc}) [@code{trunc} or @code{ftrunc}] |
| 16402 | command truncates toward zero. In other words, it ``chops off'' | 16395 | command truncates toward zero. In other words, it ``chops off'' |
| 16403 | everything after the decimal point. Thus @kbd{3.6 I R} produces 3 and | 16396 | everything after the decimal point. Thus @kbd{3.6 I R} produces 3 and |
| 16404 | @kbd{_3.6 I R} produces @i{-3}. | 16397 | @kbd{_3.6 I R} produces @mathit{-3}. |
| 16405 | 16398 | ||
| 16406 | These functions may not be applied meaningfully to error forms, but they | 16399 | These functions may not be applied meaningfully to error forms, but they |
| 16407 | do work for intervals. As a convenience, applying @code{floor} to a | 16400 | do work for intervals. As a convenience, applying @code{floor} to a |
| @@ -16479,10 +16472,10 @@ this command replaces each element by its complex conjugate. | |||
| 16479 | The @kbd{G} (@code{calc-argument}) [@code{arg}] command computes the | 16472 | The @kbd{G} (@code{calc-argument}) [@code{arg}] command computes the |
| 16480 | ``argument'' or polar angle of a complex number. For a number in polar | 16473 | ``argument'' or polar angle of a complex number. For a number in polar |
| 16481 | notation, this is simply the second component of the pair | 16474 | notation, this is simply the second component of the pair |
| 16482 | @texline `@t{(}@var{r}@t{;}@tmath{\theta}@t{)}'. | 16475 | @texline `@t{(}@var{r}@t{;}@math{\theta}@t{)}'. |
| 16483 | @infoline `@t{(}@var{r}@t{;}@var{theta}@t{)}'. | 16476 | @infoline `@t{(}@var{r}@t{;}@var{theta}@t{)}'. |
| 16484 | The result is expressed according to the current angular mode and will | 16477 | The result is expressed according to the current angular mode and will |
| 16485 | be in the range @i{-180} degrees (exclusive) to @i{+180} degrees | 16478 | be in the range @mathit{-180} degrees (exclusive) to @mathit{+180} degrees |
| 16486 | (inclusive), or the equivalent range in radians. | 16479 | (inclusive), or the equivalent range in radians. |
| 16487 | 16480 | ||
| 16488 | @pindex calc-imaginary | 16481 | @pindex calc-imaginary |
| @@ -16513,8 +16506,8 @@ or matrix argument, these functions operate element-wise. | |||
| 16513 | @pindex calc-pack | 16506 | @pindex calc-pack |
| 16514 | The @kbd{v p} (@code{calc-pack}) command can pack the top two numbers on | 16507 | The @kbd{v p} (@code{calc-pack}) command can pack the top two numbers on |
| 16515 | the stack into a composite object such as a complex number. With | 16508 | the stack into a composite object such as a complex number. With |
| 16516 | a prefix argument of @i{-1}, it produces a rectangular complex number; | 16509 | a prefix argument of @mathit{-1}, it produces a rectangular complex number; |
| 16517 | with an argument of @i{-2}, it produces a polar complex number. | 16510 | with an argument of @mathit{-2}, it produces a polar complex number. |
| 16518 | (Also, @pxref{Building Vectors}.) | 16511 | (Also, @pxref{Building Vectors}.) |
| 16519 | 16512 | ||
| 16520 | @ignore | 16513 | @ignore |
| @@ -16638,7 +16631,7 @@ already a polar complex number, it uses @code{rect} instead. The | |||
| 16638 | The @kbd{c c} (@code{calc-clean}) [@code{pclean}] command ``cleans'' the | 16631 | The @kbd{c c} (@code{calc-clean}) [@code{pclean}] command ``cleans'' the |
| 16639 | number on the top of the stack. Floating point numbers are re-rounded | 16632 | number on the top of the stack. Floating point numbers are re-rounded |
| 16640 | according to the current precision. Polar numbers whose angular | 16633 | according to the current precision. Polar numbers whose angular |
| 16641 | components have strayed from the @i{-180} to @i{+180} degree range | 16634 | components have strayed from the @mathit{-180} to @mathit{+180} degree range |
| 16642 | are normalized. (Note that results will be undesirable if the current | 16635 | are normalized. (Note that results will be undesirable if the current |
| 16643 | angular mode is different from the one under which the number was | 16636 | angular mode is different from the one under which the number was |
| 16644 | produced!) Integers and fractions are generally unaffected by this | 16637 | produced!) Integers and fractions are generally unaffected by this |
| @@ -16894,8 +16887,8 @@ of the input date form are lost. With a numeric prefix argument | |||
| 16894 | @var{n} in the range from 1 to 366, @kbd{t Y} computes the | 16887 | @var{n} in the range from 1 to 366, @kbd{t Y} computes the |
| 16895 | @var{n}th day of the year (366 is treated as 365 in non-leap | 16888 | @var{n}th day of the year (366 is treated as 365 in non-leap |
| 16896 | years). A prefix argument of 0 computes the last day of the | 16889 | years). A prefix argument of 0 computes the last day of the |
| 16897 | year (December 31). A negative prefix argument from @i{-1} to | 16890 | year (December 31). A negative prefix argument from @mathit{-1} to |
| 16898 | @i{-12} computes the first day of the @var{n}th month of the year. | 16891 | @mathit{-12} computes the first day of the @var{n}th month of the year. |
| 16899 | 16892 | ||
| 16900 | @kindex t W | 16893 | @kindex t W |
| 16901 | @pindex calc-new-week | 16894 | @pindex calc-new-week |
| @@ -17264,7 +17257,7 @@ The Lisp variable @code{math-daylight-savings-hook} holds the | |||
| 17264 | name of a function that is used to compute the daylight savings | 17257 | name of a function that is used to compute the daylight savings |
| 17265 | adjustment for a given date. The default is | 17258 | adjustment for a given date. The default is |
| 17266 | @code{math-std-daylight-savings}, which computes an adjustment | 17259 | @code{math-std-daylight-savings}, which computes an adjustment |
| 17267 | (either 0 or @i{-1}) using the North American rules given above. | 17260 | (either 0 or @mathit{-1}) using the North American rules given above. |
| 17268 | 17261 | ||
| 17269 | The daylight savings hook function is called with four arguments: | 17262 | The daylight savings hook function is called with four arguments: |
| 17270 | The date, as a floating-point number in standard Calc format; | 17263 | The date, as a floating-point number in standard Calc format; |
| @@ -17312,7 +17305,7 @@ daylight savings hook: | |||
| 17312 | @noindent | 17305 | @noindent |
| 17313 | The @code{bump} parameter is equal to zero when Calc is converting | 17306 | The @code{bump} parameter is equal to zero when Calc is converting |
| 17314 | from a date form in a generalized time zone into a GMT date value. | 17307 | from a date form in a generalized time zone into a GMT date value. |
| 17315 | It is @i{-1} when Calc is converting in the other direction. The | 17308 | It is @mathit{-1} when Calc is converting in the other direction. The |
| 17316 | adjustments shown above ensure that the conversion behaves correctly | 17309 | adjustments shown above ensure that the conversion behaves correctly |
| 17317 | and reasonably around the 2 a.m.@: transition in each direction. | 17310 | and reasonably around the 2 a.m.@: transition in each direction. |
| 17318 | 17311 | ||
| @@ -17939,10 +17932,10 @@ particular, negative arguments are converted to positive integers modulo | |||
| 17939 | 17932 | ||
| 17940 | If the word size is negative, binary operations produce 2's complement | 17933 | If the word size is negative, binary operations produce 2's complement |
| 17941 | integers from | 17934 | integers from |
| 17942 | @texline @tmath{-2^{-w-1}} | 17935 | @texline @math{-2^{-w-1}} |
| 17943 | @infoline @expr{-(2^(-w-1))} | 17936 | @infoline @expr{-(2^(-w-1))} |
| 17944 | to | 17937 | to |
| 17945 | @texline @tmath{2^{-w-1}-1} | 17938 | @texline @math{2^{-w-1}-1} |
| 17946 | @infoline @expr{2^(-w-1)-1} | 17939 | @infoline @expr{2^(-w-1)-1} |
| 17947 | inclusive. Either mode accepts inputs in any range; the sign of | 17940 | inclusive. Either mode accepts inputs in any range; the sign of |
| 17948 | @expr{w} affects only the results produced. | 17941 | @expr{w} affects only the results produced. |
| @@ -17958,7 +17951,7 @@ addition do not use the current word size, since integer addition | |||
| 17958 | generally is not ``binary.'' (However, @pxref{Simplification Modes}, | 17951 | generally is not ``binary.'' (However, @pxref{Simplification Modes}, |
| 17959 | @code{calc-bin-simplify-mode}.) For example, with a word size of 8 | 17952 | @code{calc-bin-simplify-mode}.) For example, with a word size of 8 |
| 17960 | bits @kbd{b c} converts a number to the range 0 to 255; with a word | 17953 | bits @kbd{b c} converts a number to the range 0 to 255; with a word |
| 17961 | size of @i{-8} @kbd{b c} converts to the range @i{-128} to 127. | 17954 | size of @mathit{-8} @kbd{b c} converts to the range @mathit{-128} to 127. |
| 17962 | 17955 | ||
| 17963 | @kindex b w | 17956 | @kindex b w |
| 17964 | @pindex calc-word-size | 17957 | @pindex calc-word-size |
| @@ -17974,7 +17967,7 @@ When the binary operations are written in symbolic form, they take an | |||
| 17974 | optional second (or third) word-size parameter. When a formula like | 17967 | optional second (or third) word-size parameter. When a formula like |
| 17975 | @samp{and(a,b)} is finally evaluated, the word size current at that time | 17968 | @samp{and(a,b)} is finally evaluated, the word size current at that time |
| 17976 | will be used, but when @samp{and(a,b,-8)} is evaluated, a word size of | 17969 | will be used, but when @samp{and(a,b,-8)} is evaluated, a word size of |
| 17977 | @i{-8} will always be used. A symbolic binary function will be left | 17970 | @mathit{-8} will always be used. A symbolic binary function will be left |
| 17978 | in symbolic form unless the all of its argument(s) are integers or | 17971 | in symbolic form unless the all of its argument(s) are integers or |
| 17979 | integer-valued floats. | 17972 | integer-valued floats. |
| 17980 | 17973 | ||
| @@ -18126,11 +18119,11 @@ One miscellaneous command is shift-@kbd{P} (@code{calc-pi}), which pushes | |||
| 18126 | the value of @cpi{} (at the current precision) onto the stack. With the | 18119 | the value of @cpi{} (at the current precision) onto the stack. With the |
| 18127 | Hyperbolic flag, it pushes the value @expr{e}, the base of natural logarithms. | 18120 | Hyperbolic flag, it pushes the value @expr{e}, the base of natural logarithms. |
| 18128 | With the Inverse flag, it pushes Euler's constant | 18121 | With the Inverse flag, it pushes Euler's constant |
| 18129 | @texline @tmath{\gamma} | 18122 | @texline @math{\gamma} |
| 18130 | @infoline @expr{gamma} | 18123 | @infoline @expr{gamma} |
| 18131 | (about 0.5772). With both Inverse and Hyperbolic, it | 18124 | (about 0.5772). With both Inverse and Hyperbolic, it |
| 18132 | pushes the ``golden ratio'' | 18125 | pushes the ``golden ratio'' |
| 18133 | @texline @tmath{\phi} | 18126 | @texline @math{\phi} |
| 18134 | @infoline @expr{phi} | 18127 | @infoline @expr{phi} |
| 18135 | (about 1.618). (At present, Euler's constant is not available | 18128 | (about 1.618). (At present, Euler's constant is not available |
| 18136 | to unlimited precision; Calc knows only the first 100 digits.) | 18129 | to unlimited precision; Calc knows only the first 100 digits.) |
| @@ -18210,7 +18203,7 @@ The @kbd{H L} (@code{calc-log10}) [@code{log10}] command computes the common | |||
| 18210 | it raises ten to a given power.) Note that the common logarithm of a | 18203 | it raises ten to a given power.) Note that the common logarithm of a |
| 18211 | complex number is computed by taking the natural logarithm and dividing | 18204 | complex number is computed by taking the natural logarithm and dividing |
| 18212 | by | 18205 | by |
| 18213 | @texline @tmath{\ln10}. | 18206 | @texline @math{\ln10}. |
| 18214 | @infoline @expr{ln(10)}. | 18207 | @infoline @expr{ln(10)}. |
| 18215 | 18208 | ||
| 18216 | @kindex B | 18209 | @kindex B |
| @@ -18220,7 +18213,7 @@ by | |||
| 18220 | @tindex alog | 18213 | @tindex alog |
| 18221 | The @kbd{B} (@code{calc-log}) [@code{log}] command computes a logarithm | 18214 | The @kbd{B} (@code{calc-log}) [@code{log}] command computes a logarithm |
| 18222 | to any base. For example, @kbd{1024 @key{RET} 2 B} produces 10, since | 18215 | to any base. For example, @kbd{1024 @key{RET} 2 B} produces 10, since |
| 18223 | @texline @tmath{2^{10} = 1024}. | 18216 | @texline @math{2^{10} = 1024}. |
| 18224 | @infoline @expr{2^10 = 1024}. | 18217 | @infoline @expr{2^10 = 1024}. |
| 18225 | In certain cases like @samp{log(3,9)}, the result | 18218 | In certain cases like @samp{log(3,9)}, the result |
| 18226 | will be either @expr{1:2} or @expr{0.5} depending on the current Fraction | 18219 | will be either @expr{1:2} or @expr{0.5} depending on the current Fraction |
| @@ -18242,11 +18235,11 @@ integer arithmetic is used; otherwise, this is equivalent to | |||
| 18242 | @pindex calc-expm1 | 18235 | @pindex calc-expm1 |
| 18243 | @tindex expm1 | 18236 | @tindex expm1 |
| 18244 | The @kbd{f E} (@code{calc-expm1}) [@code{expm1}] command computes | 18237 | The @kbd{f E} (@code{calc-expm1}) [@code{expm1}] command computes |
| 18245 | @texline @tmath{e^x - 1}, | 18238 | @texline @math{e^x - 1}, |
| 18246 | @infoline @expr{exp(x)-1}, | 18239 | @infoline @expr{exp(x)-1}, |
| 18247 | but using an algorithm that produces a more accurate | 18240 | but using an algorithm that produces a more accurate |
| 18248 | answer when the result is close to zero, i.e., when | 18241 | answer when the result is close to zero, i.e., when |
| 18249 | @texline @tmath{e^x} | 18242 | @texline @math{e^x} |
| 18250 | @infoline @expr{exp(x)} | 18243 | @infoline @expr{exp(x)} |
| 18251 | is close to one. | 18244 | is close to one. |
| 18252 | 18245 | ||
| @@ -18254,7 +18247,7 @@ is close to one. | |||
| 18254 | @pindex calc-lnp1 | 18247 | @pindex calc-lnp1 |
| 18255 | @tindex lnp1 | 18248 | @tindex lnp1 |
| 18256 | The @kbd{f L} (@code{calc-lnp1}) [@code{lnp1}] command computes | 18249 | The @kbd{f L} (@code{calc-lnp1}) [@code{lnp1}] command computes |
| 18257 | @texline @tmath{\ln(x+1)}, | 18250 | @texline @math{\ln(x+1)}, |
| 18258 | @infoline @expr{ln(x+1)}, | 18251 | @infoline @expr{ln(x+1)}, |
| 18259 | producing a more accurate answer when @expr{x} is close to zero. | 18252 | producing a more accurate answer when @expr{x} is close to zero. |
| 18260 | 18253 | ||
| @@ -18388,10 +18381,10 @@ variants of these functions. | |||
| 18388 | @tindex arctan2 | 18381 | @tindex arctan2 |
| 18389 | The @kbd{f T} (@code{calc-arctan2}) [@code{arctan2}] command takes two | 18382 | The @kbd{f T} (@code{calc-arctan2}) [@code{arctan2}] command takes two |
| 18390 | numbers from the stack and computes the arc tangent of their ratio. The | 18383 | numbers from the stack and computes the arc tangent of their ratio. The |
| 18391 | result is in the full range from @i{-180} (exclusive) to @i{+180} | 18384 | result is in the full range from @mathit{-180} (exclusive) to @mathit{+180} |
| 18392 | (inclusive) degrees, or the analogous range in radians. A similar | 18385 | (inclusive) degrees, or the analogous range in radians. A similar |
| 18393 | result would be obtained with @kbd{/} followed by @kbd{I T}, but the | 18386 | result would be obtained with @kbd{/} followed by @kbd{I T}, but the |
| 18394 | value would only be in the range from @i{-90} to @i{+90} degrees | 18387 | value would only be in the range from @mathit{-90} to @mathit{+90} degrees |
| 18395 | since the division loses information about the signs of the two | 18388 | since the division loses information about the signs of the two |
| 18396 | components, and an error might result from an explicit division by zero | 18389 | components, and an error might result from an explicit division by zero |
| 18397 | which @code{arctan2} would avoid. By (arbitrary) definition, | 18390 | which @code{arctan2} would avoid. By (arbitrary) definition, |
| @@ -18440,7 +18433,7 @@ gamma function. For positive integer arguments, this is related to the | |||
| 18440 | factorial function: @samp{gamma(n+1) = fact(n)}. For general complex | 18433 | factorial function: @samp{gamma(n+1) = fact(n)}. For general complex |
| 18441 | arguments the gamma function can be defined by the following definite | 18434 | arguments the gamma function can be defined by the following definite |
| 18442 | integral: | 18435 | integral: |
| 18443 | @texline @tmath{\Gamma(a) = \int_0^\infty t^{a-1} e^t dt}. | 18436 | @texline @math{\Gamma(a) = \int_0^\infty t^{a-1} e^t dt}. |
| 18444 | @infoline @expr{gamma(a) = integ(t^(a-1) exp(t), t, 0, inf)}. | 18437 | @infoline @expr{gamma(a) = integ(t^(a-1) exp(t), t, 0, inf)}. |
| 18445 | (The actual implementation uses far more efficient computational methods.) | 18438 | (The actual implementation uses far more efficient computational methods.) |
| 18446 | 18439 | ||
| @@ -18474,7 +18467,7 @@ integral: | |||
| 18474 | The @kbd{f G} (@code{calc-inc-gamma}) [@code{gammaP}] command computes | 18467 | The @kbd{f G} (@code{calc-inc-gamma}) [@code{gammaP}] command computes |
| 18475 | the incomplete gamma function, denoted @samp{P(a,x)}. This is defined by | 18468 | the incomplete gamma function, denoted @samp{P(a,x)}. This is defined by |
| 18476 | the integral, | 18469 | the integral, |
| 18477 | @texline @tmath{P(a,x) = \left( \int_0^x t^{a-1} e^t dt \right) / \Gamma(a)}. | 18470 | @texline @math{P(a,x) = \left( \int_0^x t^{a-1} e^t dt \right) / \Gamma(a)}. |
| 18478 | @infoline @expr{gammaP(a,x) = integ(t^(a-1) exp(t), t, 0, x) / gamma(a)}. | 18471 | @infoline @expr{gammaP(a,x) = integ(t^(a-1) exp(t), t, 0, x) / gamma(a)}. |
| 18479 | This implies that @samp{gammaP(a,inf) = 1} for any @expr{a} (see the | 18472 | This implies that @samp{gammaP(a,inf) = 1} for any @expr{a} (see the |
| 18480 | definition of the normal gamma function). | 18473 | definition of the normal gamma function). |
| @@ -18507,10 +18500,10 @@ You can obtain these using the \kbd{H f G} [\code{gammag}] and | |||
| 18507 | @tindex beta | 18500 | @tindex beta |
| 18508 | The @kbd{f b} (@code{calc-beta}) [@code{beta}] command computes the | 18501 | The @kbd{f b} (@code{calc-beta}) [@code{beta}] command computes the |
| 18509 | Euler beta function, which is defined in terms of the gamma function as | 18502 | Euler beta function, which is defined in terms of the gamma function as |
| 18510 | @texline @tmath{B(a,b) = \Gamma(a) \Gamma(b) / \Gamma(a+b)}, | 18503 | @texline @math{B(a,b) = \Gamma(a) \Gamma(b) / \Gamma(a+b)}, |
| 18511 | @infoline @expr{beta(a,b) = gamma(a) gamma(b) / gamma(a+b)}, | 18504 | @infoline @expr{beta(a,b) = gamma(a) gamma(b) / gamma(a+b)}, |
| 18512 | or by | 18505 | or by |
| 18513 | @texline @tmath{B(a,b) = \int_0^1 t^{a-1} (1-t)^{b-1} dt}. | 18506 | @texline @math{B(a,b) = \int_0^1 t^{a-1} (1-t)^{b-1} dt}. |
| 18514 | @infoline @expr{beta(a,b) = integ(t^(a-1) (1-t)^(b-1), t, 0, 1)}. | 18507 | @infoline @expr{beta(a,b) = integ(t^(a-1) (1-t)^(b-1), t, 0, 1)}. |
| 18515 | 18508 | ||
| 18516 | @kindex f B | 18509 | @kindex f B |
| @@ -18520,7 +18513,7 @@ or by | |||
| 18520 | @tindex betaB | 18513 | @tindex betaB |
| 18521 | The @kbd{f B} (@code{calc-inc-beta}) [@code{betaI}] command computes | 18514 | The @kbd{f B} (@code{calc-inc-beta}) [@code{betaI}] command computes |
| 18522 | the incomplete beta function @expr{I(x,a,b)}. It is defined by | 18515 | the incomplete beta function @expr{I(x,a,b)}. It is defined by |
| 18523 | @texline @tmath{I(x,a,b) = \left( \int_0^x t^{a-1} (1-t)^{b-1} dt \right) / B(a,b)}. | 18516 | @texline @math{I(x,a,b) = \left( \int_0^x t^{a-1} (1-t)^{b-1} dt \right) / B(a,b)}. |
| 18524 | @infoline @expr{betaI(x,a,b) = integ(t^(a-1) (1-t)^(b-1), t, 0, x) / beta(a,b)}. | 18517 | @infoline @expr{betaI(x,a,b) = integ(t^(a-1) (1-t)^(b-1), t, 0, x) / beta(a,b)}. |
| 18525 | Once again, the @kbd{H} (hyperbolic) prefix gives the corresponding | 18518 | Once again, the @kbd{H} (hyperbolic) prefix gives the corresponding |
| 18526 | un-normalized version [@code{betaB}]. | 18519 | un-normalized version [@code{betaB}]. |
| @@ -18532,11 +18525,11 @@ un-normalized version [@code{betaB}]. | |||
| 18532 | @tindex erfc | 18525 | @tindex erfc |
| 18533 | The @kbd{f e} (@code{calc-erf}) [@code{erf}] command computes the | 18526 | The @kbd{f e} (@code{calc-erf}) [@code{erf}] command computes the |
| 18534 | error function | 18527 | error function |
| 18535 | @texline @tmath{\hbox{erf}(x) = {2 \over \sqrt{\pi}} \int_0^x e^{-t^2} dt}. | 18528 | @texline @math{\hbox{erf}(x) = {2 \over \sqrt{\pi}} \int_0^x e^{-t^2} dt}. |
| 18536 | @infoline @expr{erf(x) = 2 integ(exp(-(t^2)), t, 0, x) / sqrt(pi)}. | 18529 | @infoline @expr{erf(x) = 2 integ(exp(-(t^2)), t, 0, x) / sqrt(pi)}. |
| 18537 | The complementary error function @kbd{I f e} (@code{calc-erfc}) [@code{erfc}] | 18530 | The complementary error function @kbd{I f e} (@code{calc-erfc}) [@code{erfc}] |
| 18538 | is the corresponding integral from @samp{x} to infinity; the sum | 18531 | is the corresponding integral from @samp{x} to infinity; the sum |
| 18539 | @texline @tmath{\hbox{erf}(x) + \hbox{erfc}(x) = 1}. | 18532 | @texline @math{\hbox{erf}(x) + \hbox{erfc}(x) = 1}. |
| 18540 | @infoline @expr{erf(x) + erfc(x) = 1}. | 18533 | @infoline @expr{erf(x) + erfc(x) = 1}. |
| 18541 | 18534 | ||
| 18542 | @kindex f j | 18535 | @kindex f j |
| @@ -18612,17 +18605,17 @@ occurrence of @code{eps} may stand for a different small value. | |||
| 18612 | 18605 | ||
| 18613 | For @samp{z1^z2}: This is defined by @samp{exp(ln(z1)*z2)}. | 18606 | For @samp{z1^z2}: This is defined by @samp{exp(ln(z1)*z2)}. |
| 18614 | One interesting consequence of this is that @samp{(-8)^1:3} does | 18607 | One interesting consequence of this is that @samp{(-8)^1:3} does |
| 18615 | not evaluate to @i{-2} as you might expect, but to the complex | 18608 | not evaluate to @mathit{-2} as you might expect, but to the complex |
| 18616 | number @expr{(1., 1.732)}. Both of these are valid cube roots | 18609 | number @expr{(1., 1.732)}. Both of these are valid cube roots |
| 18617 | of @i{-8} (as is @expr{(1., -1.732)}); Calc chooses a perhaps | 18610 | of @mathit{-8} (as is @expr{(1., -1.732)}); Calc chooses a perhaps |
| 18618 | less-obvious root for the sake of mathematical consistency. | 18611 | less-obvious root for the sake of mathematical consistency. |
| 18619 | 18612 | ||
| 18620 | For @samp{arcsin(z)}: This is defined by @samp{-i*ln(i*z + sqrt(1-z^2))}. | 18613 | For @samp{arcsin(z)}: This is defined by @samp{-i*ln(i*z + sqrt(1-z^2))}. |
| 18621 | The branch cuts are on the real axis, less than @i{-1} and greater than 1. | 18614 | The branch cuts are on the real axis, less than @mathit{-1} and greater than 1. |
| 18622 | 18615 | ||
| 18623 | For @samp{arccos(z)}: This is defined by @samp{-i*ln(z + i*sqrt(1-z^2))}, | 18616 | For @samp{arccos(z)}: This is defined by @samp{-i*ln(z + i*sqrt(1-z^2))}, |
| 18624 | or equivalently by @samp{pi/2 - arcsin(z)}. The branch cuts are on | 18617 | or equivalently by @samp{pi/2 - arcsin(z)}. The branch cuts are on |
| 18625 | the real axis, less than @i{-1} and greater than 1. | 18618 | the real axis, less than @mathit{-1} and greater than 1. |
| 18626 | 18619 | ||
| 18627 | For @samp{arctan(z)}: This is defined by | 18620 | For @samp{arctan(z)}: This is defined by |
| 18628 | @samp{(ln(1+i*z) - ln(1-i*z)) / (2*i)}. The branch cuts are on the | 18621 | @samp{(ln(1+i*z) - ln(1-i*z)) / (2*i)}. The branch cuts are on the |
| @@ -18637,7 +18630,7 @@ For @samp{arccosh(z)}: This is defined by | |||
| 18637 | real axis less than 1. | 18630 | real axis less than 1. |
| 18638 | 18631 | ||
| 18639 | For @samp{arctanh(z)}: This is defined by @samp{(ln(1+z) - ln(1-z)) / 2}. | 18632 | For @samp{arctanh(z)}: This is defined by @samp{(ln(1+z) - ln(1-z)) / 2}. |
| 18640 | The branch cuts are on the real axis, less than @i{-1} and greater than 1. | 18633 | The branch cuts are on the real axis, less than @mathit{-1} and greater than 1. |
| 18641 | 18634 | ||
| 18642 | The following tables for @code{arcsin}, @code{arccos}, and | 18635 | The following tables for @code{arcsin}, @code{arccos}, and |
| 18643 | @code{arctan} assume the current angular mode is radians. The | 18636 | @code{arctan} assume the current angular mode is radians. The |
| @@ -18710,7 +18703,7 @@ random numbers of various sorts. | |||
| 18710 | 18703 | ||
| 18711 | Given a positive numeric prefix argument @expr{M}, it produces a random | 18704 | Given a positive numeric prefix argument @expr{M}, it produces a random |
| 18712 | integer @expr{N} in the range | 18705 | integer @expr{N} in the range |
| 18713 | @texline @tmath{0 \le N < M}. | 18706 | @texline @math{0 \le N < M}. |
| 18714 | @infoline @expr{0 <= N < M}. | 18707 | @infoline @expr{0 <= N < M}. |
| 18715 | Each of the @expr{M} values appears with equal probability. | 18708 | Each of the @expr{M} values appears with equal probability. |
| 18716 | 18709 | ||
| @@ -18720,15 +18713,15 @@ the result is a random integer less than @expr{M}. However, note that | |||
| 18720 | while numeric prefix arguments are limited to six digits or so, an @expr{M} | 18713 | while numeric prefix arguments are limited to six digits or so, an @expr{M} |
| 18721 | taken from the stack can be arbitrarily large. If @expr{M} is negative, | 18714 | taken from the stack can be arbitrarily large. If @expr{M} is negative, |
| 18722 | the result is a random integer in the range | 18715 | the result is a random integer in the range |
| 18723 | @texline @tmath{M < N \le 0}. | 18716 | @texline @math{M < N \le 0}. |
| 18724 | @infoline @expr{M < N <= 0}. | 18717 | @infoline @expr{M < N <= 0}. |
| 18725 | 18718 | ||
| 18726 | If the value on the stack is a floating-point number @expr{M}, the result | 18719 | If the value on the stack is a floating-point number @expr{M}, the result |
| 18727 | is a random floating-point number @expr{N} in the range | 18720 | is a random floating-point number @expr{N} in the range |
| 18728 | @texline @tmath{0 \le N < M} | 18721 | @texline @math{0 \le N < M} |
| 18729 | @infoline @expr{0 <= N < M} | 18722 | @infoline @expr{0 <= N < M} |
| 18730 | or | 18723 | or |
| 18731 | @texline @tmath{M < N \le 0}, | 18724 | @texline @math{M < N \le 0}, |
| 18732 | @infoline @expr{M < N <= 0}, | 18725 | @infoline @expr{M < N <= 0}, |
| 18733 | according to the sign of @expr{M}. | 18726 | according to the sign of @expr{M}. |
| 18734 | 18727 | ||
| @@ -18738,14 +18731,14 @@ of one. The algorithm used generates random numbers in pairs; thus, | |||
| 18738 | every other call to this function will be especially fast. | 18731 | every other call to this function will be especially fast. |
| 18739 | 18732 | ||
| 18740 | If @expr{M} is an error form | 18733 | If @expr{M} is an error form |
| 18741 | @texline @tmath{m} @code{+/-} @tmath{\sigma} | 18734 | @texline @math{m} @code{+/-} @math{\sigma} |
| 18742 | @infoline @samp{m +/- s} | 18735 | @infoline @samp{m +/- s} |
| 18743 | where @var{m} and | 18736 | where @var{m} and |
| 18744 | @texline @tmath{\sigma} | 18737 | @texline @math{\sigma} |
| 18745 | @infoline @var{s} | 18738 | @infoline @var{s} |
| 18746 | are both real numbers, the result uses a Gaussian distribution with mean | 18739 | are both real numbers, the result uses a Gaussian distribution with mean |
| 18747 | @var{m} and standard deviation | 18740 | @var{m} and standard deviation |
| 18748 | @texline @tmath{\sigma}. | 18741 | @texline @math{\sigma}. |
| 18749 | @var{s}. | 18742 | @var{s}. |
| 18750 | 18743 | ||
| 18751 | If @expr{M} is an interval form, the lower and upper bounds specify the | 18744 | If @expr{M} is an interval form, the lower and upper bounds specify the |
| @@ -18858,7 +18851,7 @@ generators that are typically used to implement @code{random}. | |||
| 18858 | If @code{RandSeed} contains an integer, Calc uses this integer to | 18851 | If @code{RandSeed} contains an integer, Calc uses this integer to |
| 18859 | seed an ``additive congruential'' method (Knuth's algorithm 3.2.2A, | 18852 | seed an ``additive congruential'' method (Knuth's algorithm 3.2.2A, |
| 18860 | computing | 18853 | computing |
| 18861 | @texline @tmath{X_{n-55} - X_{n-24}}. | 18854 | @texline @math{X_{n-55} - X_{n-24}}. |
| 18862 | @infoline @expr{X_n-55 - X_n-24}). | 18855 | @infoline @expr{X_n-55 - X_n-24}). |
| 18863 | This method expands the seed | 18856 | This method expands the seed |
| 18864 | value into a large table which is maintained internally; the variable | 18857 | value into a large table which is maintained internally; the variable |
| @@ -18894,20 +18887,20 @@ value. | |||
| 18894 | 18887 | ||
| 18895 | To create a random floating-point number with precision @var{p}, Calc | 18888 | To create a random floating-point number with precision @var{p}, Calc |
| 18896 | simply creates a random @var{p}-digit integer and multiplies by | 18889 | simply creates a random @var{p}-digit integer and multiplies by |
| 18897 | @texline @tmath{10^{-p}}. | 18890 | @texline @math{10^{-p}}. |
| 18898 | @infoline @expr{10^-p}. | 18891 | @infoline @expr{10^-p}. |
| 18899 | The resulting random numbers should be very clean, but note | 18892 | The resulting random numbers should be very clean, but note |
| 18900 | that relatively small numbers will have few significant random digits. | 18893 | that relatively small numbers will have few significant random digits. |
| 18901 | In other words, with a precision of 12, you will occasionally get | 18894 | In other words, with a precision of 12, you will occasionally get |
| 18902 | numbers on the order of | 18895 | numbers on the order of |
| 18903 | @texline @tmath{10^{-9}} | 18896 | @texline @math{10^{-9}} |
| 18904 | @infoline @expr{10^-9} | 18897 | @infoline @expr{10^-9} |
| 18905 | or | 18898 | or |
| 18906 | @texline @tmath{10^{-10}}, | 18899 | @texline @math{10^{-10}}, |
| 18907 | @infoline @expr{10^-10}, | 18900 | @infoline @expr{10^-10}, |
| 18908 | but those numbers will only have two or three random digits since they | 18901 | but those numbers will only have two or three random digits since they |
| 18909 | correspond to small integers times | 18902 | correspond to small integers times |
| 18910 | @texline @tmath{10^{-12}}. | 18903 | @texline @math{10^{-12}}. |
| 18911 | @infoline @expr{10^-12}. | 18904 | @infoline @expr{10^-12}. |
| 18912 | 18905 | ||
| 18913 | To create a random integer in the interval @samp{[0 .. @var{m})}, Calc | 18906 | To create a random integer in the interval @samp{[0 .. @var{m})}, Calc |
| @@ -18958,7 +18951,7 @@ numbers. | |||
| 18958 | The @kbd{k E} (@code{calc-extended-gcd}) [@code{egcd}] command computes | 18951 | The @kbd{k E} (@code{calc-extended-gcd}) [@code{egcd}] command computes |
| 18959 | the GCD of two integers @expr{x} and @expr{y} and returns a vector | 18952 | the GCD of two integers @expr{x} and @expr{y} and returns a vector |
| 18960 | @expr{[g, a, b]} where | 18953 | @expr{[g, a, b]} where |
| 18961 | @texline @tmath{g = \gcd(x,y) = a x + b y}. | 18954 | @texline @math{g = \gcd(x,y) = a x + b y}. |
| 18962 | @infoline @expr{g = gcd(x,y) = a x + b y}. | 18955 | @infoline @expr{g = gcd(x,y) = a x + b y}. |
| 18963 | 18956 | ||
| 18964 | @kindex ! | 18957 | @kindex ! |
| @@ -19002,7 +18995,7 @@ on the top of the stack and @expr{N} is second-to-top. If both arguments | |||
| 19002 | are integers, the result is an exact integer. Otherwise, the result is a | 18995 | are integers, the result is an exact integer. Otherwise, the result is a |
| 19003 | floating-point approximation. The binomial coefficient is defined for all | 18996 | floating-point approximation. The binomial coefficient is defined for all |
| 19004 | real numbers by | 18997 | real numbers by |
| 19005 | @texline @tmath{N! \over M! (N-M)!\,}. | 18998 | @texline @math{N! \over M! (N-M)!\,}. |
| 19006 | @infoline @expr{N! / M! (N-M)!}. | 18999 | @infoline @expr{N! / M! (N-M)!}. |
| 19007 | 19000 | ||
| 19008 | @kindex H k c | 19001 | @kindex H k c |
| @@ -19045,11 +19038,11 @@ functions. | |||
| 19045 | @tindex stir2 | 19038 | @tindex stir2 |
| 19046 | The @kbd{k s} (@code{calc-stirling-number}) [@code{stir1}] command | 19039 | The @kbd{k s} (@code{calc-stirling-number}) [@code{stir1}] command |
| 19047 | computes a Stirling number of the first | 19040 | computes a Stirling number of the first |
| 19048 | @texline kind@tie{}@tmath{n \brack m}, | 19041 | @texline kind@tie{}@math{n \brack m}, |
| 19049 | @infoline kind, | 19042 | @infoline kind, |
| 19050 | given two integers @expr{n} and @expr{m} on the stack. The @kbd{H k s} | 19043 | given two integers @expr{n} and @expr{m} on the stack. The @kbd{H k s} |
| 19051 | [@code{stir2}] command computes a Stirling number of the second | 19044 | [@code{stir2}] command computes a Stirling number of the second |
| 19052 | @texline kind@tie{}@tmath{n \brace m}. | 19045 | @texline kind@tie{}@math{n \brace m}. |
| 19053 | @infoline kind. | 19046 | @infoline kind. |
| 19054 | These are the number of @expr{m}-cycle permutations of @expr{n} objects, | 19047 | These are the number of @expr{m}-cycle permutations of @expr{n} objects, |
| 19055 | and the number of ways to partition @expr{n} objects into @expr{m} | 19048 | and the number of ways to partition @expr{n} objects into @expr{m} |
| @@ -19093,8 +19086,8 @@ result is a vector of the prime factors in increasing order. For larger | |||
| 19093 | inputs, prime factors above 5000 may not be found, in which case the | 19086 | inputs, prime factors above 5000 may not be found, in which case the |
| 19094 | last number in the vector will be an unfactored integer greater than 25 | 19087 | last number in the vector will be an unfactored integer greater than 25 |
| 19095 | million (with a warning message). For negative integers, the first | 19088 | million (with a warning message). For negative integers, the first |
| 19096 | element of the list will be @i{-1}. For inputs @i{-1}, @i{0}, and | 19089 | element of the list will be @mathit{-1}. For inputs @mathit{-1}, @mathit{0}, and |
| 19097 | @i{1}, the result is a list of the same number. | 19090 | @mathit{1}, the result is a list of the same number. |
| 19098 | 19091 | ||
| 19099 | @kindex k n | 19092 | @kindex k n |
| 19100 | @pindex calc-next-prime | 19093 | @pindex calc-next-prime |
| @@ -19128,7 +19121,7 @@ analogously finds the next prime less than a given number. | |||
| 19128 | @tindex totient | 19121 | @tindex totient |
| 19129 | The @kbd{k t} (@code{calc-totient}) [@code{totient}] command computes the | 19122 | The @kbd{k t} (@code{calc-totient}) [@code{totient}] command computes the |
| 19130 | Euler ``totient'' | 19123 | Euler ``totient'' |
| 19131 | @texline function@tie{}@tmath{\phi(n)}, | 19124 | @texline function@tie{}@math{\phi(n)}, |
| 19132 | @infoline function, | 19125 | @infoline function, |
| 19133 | the number of integers less than @expr{n} which | 19126 | the number of integers less than @expr{n} which |
| 19134 | are relatively prime to @expr{n}. | 19127 | are relatively prime to @expr{n}. |
| @@ -19137,7 +19130,7 @@ are relatively prime to @expr{n}. | |||
| 19137 | @pindex calc-moebius | 19130 | @pindex calc-moebius |
| 19138 | @tindex moebius | 19131 | @tindex moebius |
| 19139 | The @kbd{k m} (@code{calc-moebius}) [@code{moebius}] command computes the | 19132 | The @kbd{k m} (@code{calc-moebius}) [@code{moebius}] command computes the |
| 19140 | @texline M@"obius @tmath{\mu} | 19133 | @texline M@"obius @math{\mu} |
| 19141 | @infoline Moebius ``mu'' | 19134 | @infoline Moebius ``mu'' |
| 19142 | function. If the input number is a product of @expr{k} | 19135 | function. If the input number is a product of @expr{k} |
| 19143 | distinct factors, this is @expr{(-1)^k}. If the input number has any | 19136 | distinct factors, this is @expr{(-1)^k}. If the input number has any |
| @@ -19201,7 +19194,7 @@ recover the original arguments but substitute a new value for @expr{x}.) | |||
| 19201 | @end ignore | 19194 | @end ignore |
| 19202 | @tindex ltpc | 19195 | @tindex ltpc |
| 19203 | The @samp{utpc(x,v)} function uses the chi-square distribution with | 19196 | The @samp{utpc(x,v)} function uses the chi-square distribution with |
| 19204 | @texline @tmath{\nu} | 19197 | @texline @math{\nu} |
| 19205 | @infoline @expr{v} | 19198 | @infoline @expr{v} |
| 19206 | degrees of freedom. It is the probability that a model is | 19199 | degrees of freedom. It is the probability that a model is |
| 19207 | correct if its chi-square statistic is @expr{x}. | 19200 | correct if its chi-square statistic is @expr{x}. |
| @@ -19219,10 +19212,10 @@ correct if its chi-square statistic is @expr{x}. | |||
| 19219 | @tindex ltpf | 19212 | @tindex ltpf |
| 19220 | The @samp{utpf(F,v1,v2)} function uses the F distribution, used in | 19213 | The @samp{utpf(F,v1,v2)} function uses the F distribution, used in |
| 19221 | various statistical tests. The parameters | 19214 | various statistical tests. The parameters |
| 19222 | @texline @tmath{\nu_1} | 19215 | @texline @math{\nu_1} |
| 19223 | @infoline @expr{v1} | 19216 | @infoline @expr{v1} |
| 19224 | and | 19217 | and |
| 19225 | @texline @tmath{\nu_2} | 19218 | @texline @math{\nu_2} |
| 19226 | @infoline @expr{v2} | 19219 | @infoline @expr{v2} |
| 19227 | are the degrees of freedom in the numerator and denominator, | 19220 | are the degrees of freedom in the numerator and denominator, |
| 19228 | respectively, used in computing the statistic @expr{F}. | 19221 | respectively, used in computing the statistic @expr{F}. |
| @@ -19240,7 +19233,7 @@ respectively, used in computing the statistic @expr{F}. | |||
| 19240 | @tindex ltpn | 19233 | @tindex ltpn |
| 19241 | The @samp{utpn(x,m,s)} function uses a normal (Gaussian) distribution | 19234 | The @samp{utpn(x,m,s)} function uses a normal (Gaussian) distribution |
| 19242 | with mean @expr{m} and standard deviation | 19235 | with mean @expr{m} and standard deviation |
| 19243 | @texline @tmath{\sigma}. | 19236 | @texline @math{\sigma}. |
| 19244 | @infoline @expr{s}. | 19237 | @infoline @expr{s}. |
| 19245 | It is the probability that such a normal-distributed random variable | 19238 | It is the probability that such a normal-distributed random variable |
| 19246 | would exceed @expr{x}. | 19239 | would exceed @expr{x}. |
| @@ -19273,18 +19266,18 @@ Poisson random events will occur. | |||
| 19273 | @tindex ltpt | 19266 | @tindex ltpt |
| 19274 | The @samp{utpt(t,v)} function uses the Student's ``t'' distribution | 19267 | The @samp{utpt(t,v)} function uses the Student's ``t'' distribution |
| 19275 | with | 19268 | with |
| 19276 | @texline @tmath{\nu} | 19269 | @texline @math{\nu} |
| 19277 | @infoline @expr{v} | 19270 | @infoline @expr{v} |
| 19278 | degrees of freedom. It is the probability that a | 19271 | degrees of freedom. It is the probability that a |
| 19279 | t-distributed random variable will be greater than @expr{t}. | 19272 | t-distributed random variable will be greater than @expr{t}. |
| 19280 | (Note: This computes the distribution function | 19273 | (Note: This computes the distribution function |
| 19281 | @texline @tmath{A(t|\nu)} | 19274 | @texline @math{A(t|\nu)} |
| 19282 | @infoline @expr{A(t|v)} | 19275 | @infoline @expr{A(t|v)} |
| 19283 | where | 19276 | where |
| 19284 | @texline @tmath{A(0|\nu) = 1} | 19277 | @texline @math{A(0|\nu) = 1} |
| 19285 | @infoline @expr{A(0|v) = 1} | 19278 | @infoline @expr{A(0|v) = 1} |
| 19286 | and | 19279 | and |
| 19287 | @texline @tmath{A(\infty|\nu) \to 0}. | 19280 | @texline @math{A(\infty|\nu) \to 0}. |
| 19288 | @infoline @expr{A(inf|v) -> 0}. | 19281 | @infoline @expr{A(inf|v) -> 0}. |
| 19289 | The @code{UTPT} operation on the HP-48 uses a different definition which | 19282 | The @code{UTPT} operation on the HP-48 uses a different definition which |
| 19290 | returns half of Calc's value: @samp{UTPT(t,v) = .5*utpt(t,v)}.) | 19283 | returns half of Calc's value: @samp{UTPT(t,v) = .5*utpt(t,v)}.) |
| @@ -19404,8 +19397,8 @@ integer, is the exponent. The result is the mantissa | |||
| 19404 | times ten to the power of the exponent. | 19397 | times ten to the power of the exponent. |
| 19405 | 19398 | ||
| 19406 | @item -12 | 19399 | @item -12 |
| 19407 | This is treated the same as @i{-11} by the @kbd{v p} command. | 19400 | This is treated the same as @mathit{-11} by the @kbd{v p} command. |
| 19408 | When unpacking, @i{-12} specifies that a floating-point mantissa | 19401 | When unpacking, @mathit{-12} specifies that a floating-point mantissa |
| 19409 | is desired. | 19402 | is desired. |
| 19410 | 19403 | ||
| 19411 | @item -13 | 19404 | @item -13 |
| @@ -19444,7 +19437,7 @@ returned in the form @samp{[@w{[a, b, c]}, [d, e, f]]}. | |||
| 19444 | If any elements of the vector are negative, other kinds of | 19437 | If any elements of the vector are negative, other kinds of |
| 19445 | packing are done at that level as described above. For | 19438 | packing are done at that level as described above. For |
| 19446 | example, @samp{[2, 3, -4]} takes 12 objects and creates a | 19439 | example, @samp{[2, 3, -4]} takes 12 objects and creates a |
| 19447 | @texline @tmath{2\times3} | 19440 | @texline @math{2\times3} |
| 19448 | @infoline 2x3 | 19441 | @infoline 2x3 |
| 19449 | matrix of error forms: @samp{[[a +/- b, c +/- d ... ]]}. | 19442 | matrix of error forms: @samp{[[a +/- b, c +/- d ... ]]}. |
| 19450 | Also, @samp{[-4, -10]} will convert four integers into an | 19443 | Also, @samp{[-4, -10]} will convert four integers into an |
| @@ -19482,18 +19475,18 @@ the result of @kbd{C-u -4 v u} will be the two vectors | |||
| 19482 | @samp{[a, c^2, d]} and @w{@samp{[b, 0, 7]}}. | 19475 | @samp{[a, c^2, d]} and @w{@samp{[b, 0, 7]}}. |
| 19483 | 19476 | ||
| 19484 | Note that the prefix argument can have an effect even when the input is | 19477 | Note that the prefix argument can have an effect even when the input is |
| 19485 | not a vector. For example, if the input is the number @i{-5}, then | 19478 | not a vector. For example, if the input is the number @mathit{-5}, then |
| 19486 | @kbd{c-u -1 v u} yields @i{-5} and 0 (the components of @i{-5} | 19479 | @kbd{c-u -1 v u} yields @mathit{-5} and 0 (the components of @mathit{-5} |
| 19487 | when viewed as a rectangular complex number); @kbd{C-u -2 v u} yields 5 | 19480 | when viewed as a rectangular complex number); @kbd{C-u -2 v u} yields 5 |
| 19488 | and 180 (assuming degrees mode); and @kbd{C-u -10 v u} yields @i{-5} | 19481 | and 180 (assuming degrees mode); and @kbd{C-u -10 v u} yields @mathit{-5} |
| 19489 | and 1 (the numerator and denominator of @i{-5}, viewed as a rational | 19482 | and 1 (the numerator and denominator of @mathit{-5}, viewed as a rational |
| 19490 | number). Plain @kbd{v u} with this input would complain that the input | 19483 | number). Plain @kbd{v u} with this input would complain that the input |
| 19491 | is not a composite object. | 19484 | is not a composite object. |
| 19492 | 19485 | ||
| 19493 | Unpacking mode @i{-11} converts a float into an integer mantissa and | 19486 | Unpacking mode @mathit{-11} converts a float into an integer mantissa and |
| 19494 | an integer exponent, where the mantissa is not divisible by 10 | 19487 | an integer exponent, where the mantissa is not divisible by 10 |
| 19495 | (except that 0.0 is represented by a mantissa and exponent of 0). | 19488 | (except that 0.0 is represented by a mantissa and exponent of 0). |
| 19496 | Unpacking mode @i{-12} converts a float into a floating-point mantissa | 19489 | Unpacking mode @mathit{-12} converts a float into a floating-point mantissa |
| 19497 | and integer exponent, where the mantissa (for non-zero numbers) | 19490 | and integer exponent, where the mantissa (for non-zero numbers) |
| 19498 | is guaranteed to lie in the range [1 .. 10). In both cases, | 19491 | is guaranteed to lie in the range [1 .. 10). In both cases, |
| 19499 | the mantissa is shifted left or right (and the exponent adjusted | 19492 | the mantissa is shifted left or right (and the exponent adjusted |
| @@ -19593,7 +19586,7 @@ the stack is a scalar, it is used for each element on the diagonal, and | |||
| 19593 | the prefix argument is required. | 19586 | the prefix argument is required. |
| 19594 | 19587 | ||
| 19595 | To build a constant square matrix, e.g., a | 19588 | To build a constant square matrix, e.g., a |
| 19596 | @texline @tmath{3\times3} | 19589 | @texline @math{3\times3} |
| 19597 | @infoline 3x3 | 19590 | @infoline 3x3 |
| 19598 | matrix filled with ones, use @kbd{0 M-3 v d 1 +}, i.e., build a zero | 19591 | matrix filled with ones, use @kbd{0 M-3 v d 1 +}, i.e., build a zero |
| 19599 | matrix first and then add a constant value to that matrix. (Another | 19592 | matrix first and then add a constant value to that matrix. (Another |
| @@ -19626,7 +19619,7 @@ The @kbd{v x} (@code{calc-index}) [@code{index}] function builds a vector | |||
| 19626 | of consecutive integers from 1 to @var{n}, where @var{n} is the numeric | 19619 | of consecutive integers from 1 to @var{n}, where @var{n} is the numeric |
| 19627 | prefix argument. If you do not provide a prefix argument, you will be | 19620 | prefix argument. If you do not provide a prefix argument, you will be |
| 19628 | prompted to enter a suitable number. If @var{n} is negative, the result | 19621 | prompted to enter a suitable number. If @var{n} is negative, the result |
| 19629 | is a vector of negative integers from @var{n} to @i{-1}. | 19622 | is a vector of negative integers from @var{n} to @mathit{-1}. |
| 19630 | 19623 | ||
| 19631 | With a prefix argument of just @kbd{C-u}, the @kbd{v x} command takes | 19624 | With a prefix argument of just @kbd{C-u}, the @kbd{v x} command takes |
| 19632 | three values from the stack: @var{n}, @var{start}, and @var{incr} (with | 19625 | three values from the stack: @var{n}, @var{start}, and @var{incr} (with |
| @@ -19819,7 +19812,7 @@ With the Hyperbolic flag, @kbd{H v l} [@code{mdims}] computes a vector | |||
| 19819 | of the dimensions of a vector, matrix, or higher-order object. For | 19812 | of the dimensions of a vector, matrix, or higher-order object. For |
| 19820 | example, @samp{mdims([[a,b,c],[d,e,f]])} returns @samp{[2, 3]} since | 19813 | example, @samp{mdims([[a,b,c],[d,e,f]])} returns @samp{[2, 3]} since |
| 19821 | its argument is a | 19814 | its argument is a |
| 19822 | @texline @tmath{2\times3} | 19815 | @texline @math{2\times3} |
| 19823 | @infoline 2x3 | 19816 | @infoline 2x3 |
| 19824 | matrix. | 19817 | matrix. |
| 19825 | 19818 | ||
| @@ -19851,13 +19844,13 @@ in the vector, the last row will be short and the result will not be | |||
| 19851 | suitable for use as a matrix. For example, with the matrix | 19844 | suitable for use as a matrix. For example, with the matrix |
| 19852 | @samp{[[1, 2], @w{[3, 4]}]} on the stack, @kbd{v a 4} produces | 19845 | @samp{[[1, 2], @w{[3, 4]}]} on the stack, @kbd{v a 4} produces |
| 19853 | @samp{[[1, 2, 3, 4]]} (a | 19846 | @samp{[[1, 2, 3, 4]]} (a |
| 19854 | @texline @tmath{1\times4} | 19847 | @texline @math{1\times4} |
| 19855 | @infoline 1x4 | 19848 | @infoline 1x4 |
| 19856 | matrix), @kbd{v a 1} produces @samp{[[1], [2], [3], [4]]} (a | 19849 | matrix), @kbd{v a 1} produces @samp{[[1], [2], [3], [4]]} (a |
| 19857 | @texline @tmath{4\times1} | 19850 | @texline @math{4\times1} |
| 19858 | @infoline 4x1 | 19851 | @infoline 4x1 |
| 19859 | matrix), @kbd{v a 2} produces @samp{[[1, 2], [3, 4]]} (the original | 19852 | matrix), @kbd{v a 2} produces @samp{[[1, 2], [3, 4]]} (the original |
| 19860 | @texline @tmath{2\times2} | 19853 | @texline @math{2\times2} |
| 19861 | @infoline 2x2 | 19854 | @infoline 2x2 |
| 19862 | matrix), @w{@kbd{v a 3}} produces @samp{[[1, 2, 3], [4]]} (not a | 19855 | matrix), @w{@kbd{v a 3}} produces @samp{[[1, 2, 3], [4]]} (not a |
| 19863 | matrix), and @kbd{v a 0} produces the flattened list | 19856 | matrix), and @kbd{v a 0} produces the flattened list |
| @@ -20177,10 +20170,10 @@ sets are disjoint, i.e., if they share no common elements, the result | |||
| 20177 | will be the empty vector @samp{[]}. Note that the characters @kbd{V} | 20170 | will be the empty vector @samp{[]}. Note that the characters @kbd{V} |
| 20178 | and @kbd{^} were chosen to be close to the conventional mathematical | 20171 | and @kbd{^} were chosen to be close to the conventional mathematical |
| 20179 | notation for set | 20172 | notation for set |
| 20180 | @texline union@tie{}(@tmath{A \cup B}) | 20173 | @texline union@tie{}(@math{A \cup B}) |
| 20181 | @infoline union | 20174 | @infoline union |
| 20182 | and | 20175 | and |
| 20183 | @texline intersection@tie{}(@tmath{A \cap B}). | 20176 | @texline intersection@tie{}(@math{A \cap B}). |
| 20184 | @infoline intersection. | 20177 | @infoline intersection. |
| 20185 | 20178 | ||
| 20186 | @kindex V - | 20179 | @kindex V - |
| @@ -20289,7 +20282,7 @@ not include any negative numbers. The input is interpreted as a | |||
| 20289 | set of integers in the sense of @kbd{V F} (@code{vfloor}). Beware | 20282 | set of integers in the sense of @kbd{V F} (@code{vfloor}). Beware |
| 20290 | that a simple input like @samp{[100]} can result in a huge integer | 20283 | that a simple input like @samp{[100]} can result in a huge integer |
| 20291 | representation | 20284 | representation |
| 20292 | @texline (@tmath{2^{100}}, a 31-digit integer, in this case). | 20285 | @texline (@math{2^{100}}, a 31-digit integer, in this case). |
| 20293 | @infoline (@expr{2^100}, a 31-digit integer, in this case). | 20286 | @infoline (@expr{2^100}, a 31-digit integer, in this case). |
| 20294 | 20287 | ||
| 20295 | @node Statistical Operations, Reducing and Mapping, Set Operations, Matrix Functions | 20288 | @node Statistical Operations, Reducing and Mapping, Set Operations, Matrix Functions |
| @@ -20401,10 +20394,10 @@ plus or minus infinity. | |||
| 20401 | The @kbd{u M} (@code{calc-vector-mean}) [@code{vmean}] command | 20394 | The @kbd{u M} (@code{calc-vector-mean}) [@code{vmean}] command |
| 20402 | computes the average (arithmetic mean) of the data values. | 20395 | computes the average (arithmetic mean) of the data values. |
| 20403 | If the inputs are error forms | 20396 | If the inputs are error forms |
| 20404 | @texline @tmath{x \pm \sigma}, | 20397 | @texline @math{x \pm \sigma}, |
| 20405 | @infoline @samp{x +/- s}, | 20398 | @infoline @samp{x +/- s}, |
| 20406 | this is the weighted mean of the @expr{x} values with weights | 20399 | this is the weighted mean of the @expr{x} values with weights |
| 20407 | @texline @tmath{1 /\sigma^2}. | 20400 | @texline @math{1 /\sigma^2}. |
| 20408 | @infoline @expr{1 / s^2}. | 20401 | @infoline @expr{1 / s^2}. |
| 20409 | @tex | 20402 | @tex |
| 20410 | \turnoffactive | 20403 | \turnoffactive |
| @@ -20416,7 +20409,7 @@ values divided by the count of the values. | |||
| 20416 | 20409 | ||
| 20417 | Note that a plain number can be considered an error form with | 20410 | Note that a plain number can be considered an error form with |
| 20418 | error | 20411 | error |
| 20419 | @texline @tmath{\sigma = 0}. | 20412 | @texline @math{\sigma = 0}. |
| 20420 | @infoline @expr{s = 0}. | 20413 | @infoline @expr{s = 0}. |
| 20421 | If the input to @kbd{u M} is a mixture of | 20414 | If the input to @kbd{u M} is a mixture of |
| 20422 | plain numbers and error forms, the result is the mean of the | 20415 | plain numbers and error forms, the result is the mean of the |
| @@ -20525,7 +20518,7 @@ for a vector of numbers simply by using the @kbd{A} command. | |||
| 20525 | @cindex Sample statistics | 20518 | @cindex Sample statistics |
| 20526 | The @kbd{u S} (@code{calc-vector-sdev}) [@code{vsdev}] command | 20519 | The @kbd{u S} (@code{calc-vector-sdev}) [@code{vsdev}] command |
| 20527 | computes the standard | 20520 | computes the standard |
| 20528 | @texline deviation@tie{}@tmath{\sigma} | 20521 | @texline deviation@tie{}@math{\sigma} |
| 20529 | @infoline deviation | 20522 | @infoline deviation |
| 20530 | of the data values. If the values are error forms, the errors are used | 20523 | of the data values. If the values are error forms, the errors are used |
| 20531 | as weights just as for @kbd{u M}. This is the @emph{sample} standard | 20524 | as weights just as for @kbd{u M}. This is the @emph{sample} standard |
| @@ -20541,7 +20534,7 @@ This function also applies to distributions. The standard deviation | |||
| 20541 | of a single error form is simply the error part. The standard deviation | 20534 | of a single error form is simply the error part. The standard deviation |
| 20542 | of a continuous interval happens to equal the difference between the | 20535 | of a continuous interval happens to equal the difference between the |
| 20543 | limits, divided by | 20536 | limits, divided by |
| 20544 | @texline @tmath{\sqrt{12}}. | 20537 | @texline @math{\sqrt{12}}. |
| 20545 | @infoline @expr{sqrt(12)}. | 20538 | @infoline @expr{sqrt(12)}. |
| 20546 | The standard deviation of an integer interval is the same as the | 20539 | The standard deviation of an integer interval is the same as the |
| 20547 | standard deviation of a vector of those integers. | 20540 | standard deviation of a vector of those integers. |
| @@ -20579,7 +20572,7 @@ The @kbd{H u S} (@code{calc-vector-variance}) [@code{vvar}] and | |||
| 20579 | @kbd{H I u S} (@code{calc-vector-pop-variance}) [@code{vpvar}] | 20572 | @kbd{H I u S} (@code{calc-vector-pop-variance}) [@code{vpvar}] |
| 20580 | commands compute the variance of the data values. The variance | 20573 | commands compute the variance of the data values. The variance |
| 20581 | is the | 20574 | is the |
| 20582 | @texline square@tie{}@tmath{\sigma^2} | 20575 | @texline square@tie{}@math{\sigma^2} |
| 20583 | @infoline square | 20576 | @infoline square |
| 20584 | of the standard deviation, i.e., the sum of the | 20577 | of the standard deviation, i.e., the sum of the |
| 20585 | squares of the deviations of the data values from the mean. | 20578 | squares of the deviations of the data values from the mean. |
| @@ -20603,7 +20596,7 @@ vectors of equal size. The vectors are each flattened in the same | |||
| 20603 | way as by the single-variable statistical functions. Given a numeric | 20596 | way as by the single-variable statistical functions. Given a numeric |
| 20604 | prefix argument of 1, these functions instead take one object from | 20597 | prefix argument of 1, these functions instead take one object from |
| 20605 | the stack, which must be an | 20598 | the stack, which must be an |
| 20606 | @texline @tmath{N\times2} | 20599 | @texline @math{N\times2} |
| 20607 | @infoline Nx2 | 20600 | @infoline Nx2 |
| 20608 | matrix of data values. Once again, variable names can be used in place | 20601 | matrix of data values. Once again, variable names can be used in place |
| 20609 | of actual vectors and matrices. | 20602 | of actual vectors and matrices. |
| @@ -20861,7 +20854,7 @@ If any argument to @kbd{V M} is a matrix, the operator is normally mapped | |||
| 20861 | across all elements of the matrix. For example, given the matrix | 20854 | across all elements of the matrix. For example, given the matrix |
| 20862 | @expr{[[1, -2, 3], [-4, 5, -6]]}, @kbd{V M A} takes six absolute values to | 20855 | @expr{[[1, -2, 3], [-4, 5, -6]]}, @kbd{V M A} takes six absolute values to |
| 20863 | produce another | 20856 | produce another |
| 20864 | @texline @tmath{3\times2} | 20857 | @texline @math{3\times2} |
| 20865 | @infoline 3x2 | 20858 | @infoline 3x2 |
| 20866 | matrix, @expr{[[1, 2, 3], [4, 5, 6]]}. | 20859 | matrix, @expr{[[1, 2, 3], [4, 5, 6]]}. |
| 20867 | 20860 | ||
| @@ -22014,7 +22007,7 @@ as if in algebraic simplification mode. This is equivalent to typing | |||
| 22014 | @kbd{a s}; @pxref{Simplifying Formulas}. If you give a numeric prefix | 22007 | @kbd{a s}; @pxref{Simplifying Formulas}. If you give a numeric prefix |
| 22015 | of 3 or more, it uses extended simplification mode (@kbd{a e}). | 22008 | of 3 or more, it uses extended simplification mode (@kbd{a e}). |
| 22016 | 22009 | ||
| 22017 | If you give a negative prefix argument @i{-1}, @i{-2}, or @i{-3}, | 22010 | If you give a negative prefix argument @mathit{-1}, @mathit{-2}, or @mathit{-3}, |
| 22018 | it simplifies in the corresponding mode but only works on the top-level | 22011 | it simplifies in the corresponding mode but only works on the top-level |
| 22019 | function call of the formula. For example, @samp{(2 + 3) * (2 + 3)} will | 22012 | function call of the formula. For example, @samp{(2 + 3) * (2 + 3)} will |
| 22020 | simplify to @samp{(2 + 3)^2}, without simplifying the sub-formulas | 22013 | simplify to @samp{(2 + 3)^2}, without simplifying the sub-formulas |
| @@ -22286,7 +22279,7 @@ simplifications.) | |||
| 22286 | 22279 | ||
| 22287 | The distributive law is used to simplify sums in some cases: | 22280 | The distributive law is used to simplify sums in some cases: |
| 22288 | @expr{a x + b x} to @expr{(a + b) x}, where @expr{a} represents | 22281 | @expr{a x + b x} to @expr{(a + b) x}, where @expr{a} represents |
| 22289 | a number or an implicit 1 or @i{-1} (as in @expr{x} or @expr{-x}) | 22282 | a number or an implicit 1 or @mathit{-1} (as in @expr{x} or @expr{-x}) |
| 22290 | and similarly for @expr{b}. Use the @kbd{a c}, @w{@kbd{a f}}, or | 22283 | and similarly for @expr{b}. Use the @kbd{a c}, @w{@kbd{a f}}, or |
| 22291 | @kbd{j M} commands to merge sums with non-numeric coefficients | 22284 | @kbd{j M} commands to merge sums with non-numeric coefficients |
| 22292 | using the distributive law. | 22285 | using the distributive law. |
| @@ -22330,7 +22323,7 @@ rewritten to @expr{a (c - b)}. | |||
| 22330 | 22323 | ||
| 22331 | The distributive law of products and powers is used for adjacent | 22324 | The distributive law of products and powers is used for adjacent |
| 22332 | terms of the product: @expr{x^a x^b} goes to | 22325 | terms of the product: @expr{x^a x^b} goes to |
| 22333 | @texline @tmath{x^{a+b}} | 22326 | @texline @math{x^{a+b}} |
| 22334 | @infoline @expr{x^(a+b)} | 22327 | @infoline @expr{x^(a+b)} |
| 22335 | where @expr{a} is a number, or an implicit 1 (as in @expr{x}), | 22328 | where @expr{a} is a number, or an implicit 1 (as in @expr{x}), |
| 22336 | or the implicit one-half of @expr{@t{sqrt}(x)}, and similarly for | 22329 | or the implicit one-half of @expr{@t{sqrt}(x)}, and similarly for |
| @@ -22341,7 +22334,7 @@ If the sum of the powers is zero, the product is simplified to | |||
| 22341 | 22334 | ||
| 22342 | The product of a negative power times anything but another negative | 22335 | The product of a negative power times anything but another negative |
| 22343 | power is changed to use division: | 22336 | power is changed to use division: |
| 22344 | @texline @tmath{x^{-2} y} | 22337 | @texline @math{x^{-2} y} |
| 22345 | @infoline @expr{x^(-2) y} | 22338 | @infoline @expr{x^(-2) y} |
| 22346 | goes to @expr{y / x^2} unless matrix mode is | 22339 | goes to @expr{y / x^2} unless matrix mode is |
| 22347 | in effect and neither @expr{x} nor @expr{y} are scalar (in which | 22340 | in effect and neither @expr{x} nor @expr{y} are scalar (in which |
| @@ -22365,11 +22358,11 @@ infinite quantity, as directed by the current infinite mode. | |||
| 22365 | @xref{Infinite Mode}. | 22358 | @xref{Infinite Mode}. |
| 22366 | 22359 | ||
| 22367 | The expression | 22360 | The expression |
| 22368 | @texline @tmath{a / b^{-c}} | 22361 | @texline @math{a / b^{-c}} |
| 22369 | @infoline @expr{a / b^(-c)} | 22362 | @infoline @expr{a / b^(-c)} |
| 22370 | is changed to @expr{a b^c}, where @expr{-c} is any negative-looking | 22363 | is changed to @expr{a b^c}, where @expr{-c} is any negative-looking |
| 22371 | power. Also, @expr{1 / b^c} is changed to | 22364 | power. Also, @expr{1 / b^c} is changed to |
| 22372 | @texline @tmath{b^{-c}} | 22365 | @texline @math{b^{-c}} |
| 22373 | @infoline @expr{b^(-c)} | 22366 | @infoline @expr{b^(-c)} |
| 22374 | for any power @expr{c}. | 22367 | for any power @expr{c}. |
| 22375 | 22368 | ||
| @@ -22410,22 +22403,22 @@ Powers of products or quotients @expr{(a b)^c}, @expr{(a/b)^c} | |||
| 22410 | are distributed to @expr{a^c b^c}, @expr{a^c / b^c} only if @expr{c} | 22403 | are distributed to @expr{a^c b^c}, @expr{a^c / b^c} only if @expr{c} |
| 22411 | is an integer, or if either @expr{a} or @expr{b} are nonnegative | 22404 | is an integer, or if either @expr{a} or @expr{b} are nonnegative |
| 22412 | real numbers. Powers of powers @expr{(a^b)^c} are simplified to | 22405 | real numbers. Powers of powers @expr{(a^b)^c} are simplified to |
| 22413 | @texline @tmath{a^{b c}} | 22406 | @texline @math{a^{b c}} |
| 22414 | @infoline @expr{a^(b c)} | 22407 | @infoline @expr{a^(b c)} |
| 22415 | only when @expr{c} is an integer and @expr{b c} also | 22408 | only when @expr{c} is an integer and @expr{b c} also |
| 22416 | evaluates to an integer. Without these restrictions these simplifications | 22409 | evaluates to an integer. Without these restrictions these simplifications |
| 22417 | would not be safe because of problems with principal values. | 22410 | would not be safe because of problems with principal values. |
| 22418 | (In other words, | 22411 | (In other words, |
| 22419 | @texline @tmath{((-3)^{1/2})^2} | 22412 | @texline @math{((-3)^{1/2})^2} |
| 22420 | @infoline @expr{((-3)^1:2)^2} | 22413 | @infoline @expr{((-3)^1:2)^2} |
| 22421 | is safe to simplify, but | 22414 | is safe to simplify, but |
| 22422 | @texline @tmath{((-3)^2)^{1/2}} | 22415 | @texline @math{((-3)^2)^{1/2}} |
| 22423 | @infoline @expr{((-3)^2)^1:2} | 22416 | @infoline @expr{((-3)^2)^1:2} |
| 22424 | is not.) @xref{Declarations}, for ways to inform Calc that your | 22417 | is not.) @xref{Declarations}, for ways to inform Calc that your |
| 22425 | variables satisfy these requirements. | 22418 | variables satisfy these requirements. |
| 22426 | 22419 | ||
| 22427 | As a special case of this rule, @expr{@t{sqrt}(x)^n} is simplified to | 22420 | As a special case of this rule, @expr{@t{sqrt}(x)^n} is simplified to |
| 22428 | @texline @tmath{x^{n/2}} | 22421 | @texline @math{x^{n/2}} |
| 22429 | @infoline @expr{x^(n/2)} | 22422 | @infoline @expr{x^(n/2)} |
| 22430 | only for even integers @expr{n}. | 22423 | only for even integers @expr{n}. |
| 22431 | 22424 | ||
| @@ -22438,15 +22431,15 @@ even integer, or to @expr{-(a^b)} if @expr{b} is an odd integer, | |||
| 22438 | for any negative-looking expression @expr{-a}. | 22431 | for any negative-looking expression @expr{-a}. |
| 22439 | 22432 | ||
| 22440 | Square roots @expr{@t{sqrt}(x)} generally act like one-half powers | 22433 | Square roots @expr{@t{sqrt}(x)} generally act like one-half powers |
| 22441 | @texline @tmath{x^{1:2}} | 22434 | @texline @math{x^{1:2}} |
| 22442 | @infoline @expr{x^1:2} | 22435 | @infoline @expr{x^1:2} |
| 22443 | for the purposes of the above-listed simplifications. | 22436 | for the purposes of the above-listed simplifications. |
| 22444 | 22437 | ||
| 22445 | Also, note that | 22438 | Also, note that |
| 22446 | @texline @tmath{1 / x^{1:2}} | 22439 | @texline @math{1 / x^{1:2}} |
| 22447 | @infoline @expr{1 / x^1:2} | 22440 | @infoline @expr{1 / x^1:2} |
| 22448 | is changed to | 22441 | is changed to |
| 22449 | @texline @tmath{x^{-1:2}}, | 22442 | @texline @math{x^{-1:2}}, |
| 22450 | @infoline @expr{x^(-1:2)}, | 22443 | @infoline @expr{x^(-1:2)}, |
| 22451 | but @expr{1 / @t{sqrt}(x)} is left alone. | 22444 | but @expr{1 / @t{sqrt}(x)} is left alone. |
| 22452 | 22445 | ||
| @@ -22589,7 +22582,7 @@ Thus @expr{(x + y) (y + x)} will be simplified to @expr{(x + y)^2}. | |||
| 22589 | A subtle point is that @expr{(x - y) (y - x)} will @emph{not} | 22582 | A subtle point is that @expr{(x - y) (y - x)} will @emph{not} |
| 22590 | be simplified to @expr{-(x - y)^2}; Calc does not notice that | 22583 | be simplified to @expr{-(x - y)^2}; Calc does not notice that |
| 22591 | one term can be written as a constant times the other, even if | 22584 | one term can be written as a constant times the other, even if |
| 22592 | that constant is @i{-1}. | 22585 | that constant is @mathit{-1}. |
| 22593 | 22586 | ||
| 22594 | A fraction times any expression, @expr{(a:b) x}, is changed to | 22587 | A fraction times any expression, @expr{(a:b) x}, is changed to |
| 22595 | a quotient involving integers: @expr{a x / b}. This is not | 22588 | a quotient involving integers: @expr{a x / b}. This is not |
| @@ -22632,7 +22625,7 @@ Square roots of integer or rational arguments are simplified in | |||
| 22632 | several ways. (Note that these will be left unevaluated only in | 22625 | several ways. (Note that these will be left unevaluated only in |
| 22633 | Symbolic mode.) First, square integer or rational factors are | 22626 | Symbolic mode.) First, square integer or rational factors are |
| 22634 | pulled out so that @expr{@t{sqrt}(8)} is rewritten as | 22627 | pulled out so that @expr{@t{sqrt}(8)} is rewritten as |
| 22635 | @texline @tmath{$2\,\t{sqrt}(2)$}. | 22628 | @texline @math{2\,\t{sqrt}(2)}. |
| 22636 | @infoline @expr{2 sqrt(2)}. | 22629 | @infoline @expr{2 sqrt(2)}. |
| 22637 | Conceptually speaking this implies factoring the argument into primes | 22630 | Conceptually speaking this implies factoring the argument into primes |
| 22638 | and moving pairs of primes out of the square root, but for reasons of | 22631 | and moving pairs of primes out of the square root, but for reasons of |
| @@ -22694,23 +22687,23 @@ functions are known, except for negative arguments of @code{arcsin}, | |||
| 22694 | @code{arctan}, @code{arcsinh}, and @code{arctanh}. Note that | 22687 | @code{arctan}, @code{arcsinh}, and @code{arctanh}. Note that |
| 22695 | @expr{@t{arcsin}(@t{sin}(x))} can @emph{not} safely change to | 22688 | @expr{@t{arcsin}(@t{sin}(x))} can @emph{not} safely change to |
| 22696 | @expr{x}, since this only correct within an integer multiple of | 22689 | @expr{x}, since this only correct within an integer multiple of |
| 22697 | @texline @tmath{2 \pi} | 22690 | @texline @math{2 \pi} |
| 22698 | @infoline @expr{2 pi} | 22691 | @infoline @expr{2 pi} |
| 22699 | radians or 360 degrees. However, @expr{@t{arcsinh}(@t{sinh}(x))} is | 22692 | radians or 360 degrees. However, @expr{@t{arcsinh}(@t{sinh}(x))} is |
| 22700 | simplified to @expr{x} if @expr{x} is known to be real. | 22693 | simplified to @expr{x} if @expr{x} is known to be real. |
| 22701 | 22694 | ||
| 22702 | Several simplifications that apply to logarithms and exponentials | 22695 | Several simplifications that apply to logarithms and exponentials |
| 22703 | are that @expr{@t{exp}(@t{ln}(x))}, | 22696 | are that @expr{@t{exp}(@t{ln}(x))}, |
| 22704 | @texline @t{e}@tmath{^{\ln(x)}}, | 22697 | @texline @t{e}@math{^{\ln(x)}}, |
| 22705 | @infoline @expr{e^@t{ln}(x)}, | 22698 | @infoline @expr{e^@t{ln}(x)}, |
| 22706 | and | 22699 | and |
| 22707 | @texline @tmath{10^{{\rm log10}(x)}} | 22700 | @texline @math{10^{{\rm log10}(x)}} |
| 22708 | @infoline @expr{10^@t{log10}(x)} | 22701 | @infoline @expr{10^@t{log10}(x)} |
| 22709 | all reduce to @expr{x}. Also, @expr{@t{ln}(@t{exp}(x))}, etc., can | 22702 | all reduce to @expr{x}. Also, @expr{@t{ln}(@t{exp}(x))}, etc., can |
| 22710 | reduce to @expr{x} if @expr{x} is provably real. The form | 22703 | reduce to @expr{x} if @expr{x} is provably real. The form |
| 22711 | @expr{@t{exp}(x)^y} is simplified to @expr{@t{exp}(x y)}. If @expr{x} | 22704 | @expr{@t{exp}(x)^y} is simplified to @expr{@t{exp}(x y)}. If @expr{x} |
| 22712 | is a suitable multiple of | 22705 | is a suitable multiple of |
| 22713 | @texline @tmath{\pi i} | 22706 | @texline @math{\pi i} |
| 22714 | @infoline @expr{pi i} | 22707 | @infoline @expr{pi i} |
| 22715 | (as described above for the trigonometric functions), then | 22708 | (as described above for the trigonometric functions), then |
| 22716 | @expr{@t{exp}(x)} or @expr{e^x} will be expanded. Finally, | 22709 | @expr{@t{exp}(x)} or @expr{e^x} will be expanded. Finally, |
| @@ -22795,18 +22788,18 @@ are folded down to the 360-degree range that the inverse trigonometric | |||
| 22795 | functions always produce. | 22788 | functions always produce. |
| 22796 | 22789 | ||
| 22797 | Powers of powers @expr{(x^a)^b} are simplified to | 22790 | Powers of powers @expr{(x^a)^b} are simplified to |
| 22798 | @texline @tmath{x^{a b}} | 22791 | @texline @math{x^{a b}} |
| 22799 | @infoline @expr{x^(a b)} | 22792 | @infoline @expr{x^(a b)} |
| 22800 | for all @expr{a} and @expr{b}. These results will be valid only | 22793 | for all @expr{a} and @expr{b}. These results will be valid only |
| 22801 | in a restricted range of @expr{x}; for example, in | 22794 | in a restricted range of @expr{x}; for example, in |
| 22802 | @texline @tmath{(x^2)^{1:2}} | 22795 | @texline @math{(x^2)^{1:2}} |
| 22803 | @infoline @expr{(x^2)^1:2} | 22796 | @infoline @expr{(x^2)^1:2} |
| 22804 | the powers cancel to get @expr{x}, which is valid for positive values | 22797 | the powers cancel to get @expr{x}, which is valid for positive values |
| 22805 | of @expr{x} but not for negative or complex values. | 22798 | of @expr{x} but not for negative or complex values. |
| 22806 | 22799 | ||
| 22807 | Similarly, @expr{@t{sqrt}(x^a)} and @expr{@t{sqrt}(x)^a} are both | 22800 | Similarly, @expr{@t{sqrt}(x^a)} and @expr{@t{sqrt}(x)^a} are both |
| 22808 | simplified (possibly unsafely) to | 22801 | simplified (possibly unsafely) to |
| 22809 | @texline @tmath{x^{a/2}}. | 22802 | @texline @math{x^{a/2}}. |
| 22810 | @infoline @expr{x^(a/2)}. | 22803 | @infoline @expr{x^(a/2)}. |
| 22811 | 22804 | ||
| 22812 | Forms like @expr{@t{sqrt}(1 - sin(x)^2)} are simplified to, e.g., | 22805 | Forms like @expr{@t{sqrt}(1 - sin(x)^2)} are simplified to, e.g., |
| @@ -22882,7 +22875,7 @@ number for an answer, then the quotient simplifies to that number. | |||
| 22882 | For powers and square roots, the ``unsafe'' simplifications | 22875 | For powers and square roots, the ``unsafe'' simplifications |
| 22883 | @expr{(a b)^c} to @expr{a^c b^c}, @expr{(a/b)^c} to @expr{a^c / b^c}, | 22876 | @expr{(a b)^c} to @expr{a^c b^c}, @expr{(a/b)^c} to @expr{a^c / b^c}, |
| 22884 | and @expr{(a^b)^c} to | 22877 | and @expr{(a^b)^c} to |
| 22885 | @texline @tmath{a^{b c}} | 22878 | @texline @math{a^{b c}} |
| 22886 | @infoline @expr{a^(b c)} | 22879 | @infoline @expr{a^(b c)} |
| 22887 | are done if the powers are real numbers. (These are safe in the context | 22880 | are done if the powers are real numbers. (These are safe in the context |
| 22888 | of units because all numbers involved can reasonably be assumed to be | 22881 | of units because all numbers involved can reasonably be assumed to be |
| @@ -22897,10 +22890,10 @@ is simplified by noting that @expr{1.5 = 3:2}, that @samp{acre} | |||
| 22897 | is defined in terms of @samp{m^2}, and that the 2 in the power of | 22890 | is defined in terms of @samp{m^2}, and that the 2 in the power of |
| 22898 | @code{m} is a multiple of 2 in @expr{3:2}. Thus, @code{acre^1.5} is | 22891 | @code{m} is a multiple of 2 in @expr{3:2}. Thus, @code{acre^1.5} is |
| 22899 | replaced by approximately | 22892 | replaced by approximately |
| 22900 | @texline @tmath{(4046 m^2)^{1.5}} | 22893 | @texline @math{(4046 m^2)^{1.5}} |
| 22901 | @infoline @expr{(4046 m^2)^1.5}, | 22894 | @infoline @expr{(4046 m^2)^1.5}, |
| 22902 | which is then changed to | 22895 | which is then changed to |
| 22903 | @texline @tmath{4046^{1.5} \, (m^2)^{1.5}}, | 22896 | @texline @math{4046^{1.5} \, (m^2)^{1.5}}, |
| 22904 | @infoline @expr{4046^1.5 (m^2)^1.5}, | 22897 | @infoline @expr{4046^1.5 (m^2)^1.5}, |
| 22905 | then to @expr{257440 m^3}. | 22898 | then to @expr{257440 m^3}. |
| 22906 | 22899 | ||
| @@ -23190,7 +23183,7 @@ answer! | |||
| 23190 | If you use the @code{deriv} function directly in an algebraic formula, | 23183 | If you use the @code{deriv} function directly in an algebraic formula, |
| 23191 | you can write @samp{deriv(f,x,x0)} which represents the derivative | 23184 | you can write @samp{deriv(f,x,x0)} which represents the derivative |
| 23192 | of @expr{f} with respect to @expr{x}, evaluated at the point | 23185 | of @expr{f} with respect to @expr{x}, evaluated at the point |
| 23193 | @texline @tmath{x=x_0}. | 23186 | @texline @math{x=x_0}. |
| 23194 | @infoline @expr{x=x0}. | 23187 | @infoline @expr{x=x0}. |
| 23195 | 23188 | ||
| 23196 | If the formula being differentiated contains functions which Calc does | 23189 | If the formula being differentiated contains functions which Calc does |
| @@ -23230,7 +23223,7 @@ all integrable functions, but it is able to integrate several large | |||
| 23230 | classes of formulas. In particular, any polynomial or rational function | 23223 | classes of formulas. In particular, any polynomial or rational function |
| 23231 | (a polynomial divided by a polynomial) is acceptable. (Rational functions | 23224 | (a polynomial divided by a polynomial) is acceptable. (Rational functions |
| 23232 | don't have to be in explicit quotient form, however; | 23225 | don't have to be in explicit quotient form, however; |
| 23233 | @texline @tmath{x/(1+x^{-2})} | 23226 | @texline @math{x/(1+x^{-2})} |
| 23234 | @infoline @expr{x/(1+x^-2)} | 23227 | @infoline @expr{x/(1+x^-2)} |
| 23235 | is not strictly a quotient of polynomials, but it is equivalent to | 23228 | is not strictly a quotient of polynomials, but it is equivalent to |
| 23236 | @expr{x^3/(x^2+1)}, which is.) Also, square roots of terms involving | 23229 | @expr{x^3/(x^2+1)}, which is.) Also, square roots of terms involving |
| @@ -23256,7 +23249,7 @@ integral $\int_a^b f(x) \, dx$. | |||
| 23256 | Please note that the current implementation of Calc's integrator sometimes | 23249 | Please note that the current implementation of Calc's integrator sometimes |
| 23257 | produces results that are significantly more complex than they need to | 23250 | produces results that are significantly more complex than they need to |
| 23258 | be. For example, the integral Calc finds for | 23251 | be. For example, the integral Calc finds for |
| 23259 | @texline @tmath{1/(x+\sqrt{x^2+1})} | 23252 | @texline @math{1/(x+\sqrt{x^2+1})} |
| 23260 | @infoline @expr{1/(x+sqrt(x^2+1))} | 23253 | @infoline @expr{1/(x+sqrt(x^2+1))} |
| 23261 | is several times more complicated than the answer Mathematica | 23254 | is several times more complicated than the answer Mathematica |
| 23262 | returns for the same input, although the two forms are numerically | 23255 | returns for the same input, although the two forms are numerically |
| @@ -23264,11 +23257,11 @@ equivalent. Also, any indefinite integral should be considered to have | |||
| 23264 | an arbitrary constant of integration added to it, although Calc does not | 23257 | an arbitrary constant of integration added to it, although Calc does not |
| 23265 | write an explicit constant of integration in its result. For example, | 23258 | write an explicit constant of integration in its result. For example, |
| 23266 | Calc's solution for | 23259 | Calc's solution for |
| 23267 | @texline @tmath{1/(1+\tan x)} | 23260 | @texline @math{1/(1+\tan x)} |
| 23268 | @infoline @expr{1/(1+tan(x))} | 23261 | @infoline @expr{1/(1+tan(x))} |
| 23269 | differs from the solution given in the @emph{CRC Math Tables} by a | 23262 | differs from the solution given in the @emph{CRC Math Tables} by a |
| 23270 | constant factor of | 23263 | constant factor of |
| 23271 | @texline @tmath{\pi i / 2} | 23264 | @texline @math{\pi i / 2} |
| 23272 | @infoline @expr{pi i / 2}, | 23265 | @infoline @expr{pi i / 2}, |
| 23273 | due to a different choice of constant of integration. | 23266 | due to a different choice of constant of integration. |
| 23274 | 23267 | ||
| @@ -23328,7 +23321,7 @@ in your @code{IntegRules}. | |||
| 23328 | As a more serious example, the expression @samp{exp(x)/x} cannot be | 23321 | As a more serious example, the expression @samp{exp(x)/x} cannot be |
| 23329 | integrated in terms of the standard functions, so the ``exponential | 23322 | integrated in terms of the standard functions, so the ``exponential |
| 23330 | integral'' function | 23323 | integral'' function |
| 23331 | @texline @tmath{{\rm Ei}(x)} | 23324 | @texline @math{{\rm Ei}(x)} |
| 23332 | @infoline @expr{Ei(x)} | 23325 | @infoline @expr{Ei(x)} |
| 23333 | was invented to describe it. | 23326 | was invented to describe it. |
| 23334 | We can get Calc to do this integral in terms of a made-up @code{Ei} | 23327 | We can get Calc to do this integral in terms of a made-up @code{Ei} |
| @@ -23501,16 +23494,16 @@ form @expr{X = 0}. | |||
| 23501 | This command also works for inequalities, as in @expr{y < 3x + 6}. | 23494 | This command also works for inequalities, as in @expr{y < 3x + 6}. |
| 23502 | Some inequalities cannot be solved where the analogous equation could | 23495 | Some inequalities cannot be solved where the analogous equation could |
| 23503 | be; for example, solving | 23496 | be; for example, solving |
| 23504 | @texline @tmath{a < b \, c} | 23497 | @texline @math{a < b \, c} |
| 23505 | @infoline @expr{a < b c} | 23498 | @infoline @expr{a < b c} |
| 23506 | for @expr{b} is impossible | 23499 | for @expr{b} is impossible |
| 23507 | without knowing the sign of @expr{c}. In this case, @kbd{a S} will | 23500 | without knowing the sign of @expr{c}. In this case, @kbd{a S} will |
| 23508 | produce the result | 23501 | produce the result |
| 23509 | @texline @tmath{b \mathbin{\hbox{\code{!=}}} a/c} | 23502 | @texline @math{b \mathbin{\hbox{\code{!=}}} a/c} |
| 23510 | @infoline @expr{b != a/c} | 23503 | @infoline @expr{b != a/c} |
| 23511 | (using the not-equal-to operator) to signify that the direction of the | 23504 | (using the not-equal-to operator) to signify that the direction of the |
| 23512 | inequality is now unknown. The inequality | 23505 | inequality is now unknown. The inequality |
| 23513 | @texline @tmath{a \le b \, c} | 23506 | @texline @math{a \le b \, c} |
| 23514 | @infoline @expr{a <= b c} | 23507 | @infoline @expr{a <= b c} |
| 23515 | is not even partially solved. @xref{Declarations}, for a way to tell | 23508 | is not even partially solved. @xref{Declarations}, for a way to tell |
| 23516 | Calc that the signs of the variables in a formula are in fact known. | 23509 | Calc that the signs of the variables in a formula are in fact known. |
| @@ -23537,7 +23530,7 @@ Some equations have more than one solution. The Hyperbolic flag | |||
| 23537 | general family of solutions. It will invent variables @code{n1}, | 23530 | general family of solutions. It will invent variables @code{n1}, |
| 23538 | @code{n2}, @dots{}, which represent independent arbitrary integers, and | 23531 | @code{n2}, @dots{}, which represent independent arbitrary integers, and |
| 23539 | @code{s1}, @code{s2}, @dots{}, which represent independent arbitrary | 23532 | @code{s1}, @code{s2}, @dots{}, which represent independent arbitrary |
| 23540 | signs (either @i{+1} or @i{-1}). If you don't use the Hyperbolic | 23533 | signs (either @mathit{+1} or @mathit{-1}). If you don't use the Hyperbolic |
| 23541 | flag, Calc will use zero in place of all arbitrary integers, and plus | 23534 | flag, Calc will use zero in place of all arbitrary integers, and plus |
| 23542 | one in place of all arbitrary signs. Note that variables like @code{n1} | 23535 | one in place of all arbitrary signs. Note that variables like @code{n1} |
| 23543 | and @code{s1} are not given any special interpretation in Calc except by | 23536 | and @code{s1} are not given any special interpretation in Calc except by |
| @@ -23970,11 +23963,11 @@ with the minimum value itself. | |||
| 23970 | 23963 | ||
| 23971 | Note that this command looks for a @emph{local} minimum. Many functions | 23964 | Note that this command looks for a @emph{local} minimum. Many functions |
| 23972 | have more than one minimum; some, like | 23965 | have more than one minimum; some, like |
| 23973 | @texline @tmath{x \sin x}, | 23966 | @texline @math{x \sin x}, |
| 23974 | @infoline @expr{x sin(x)}, | 23967 | @infoline @expr{x sin(x)}, |
| 23975 | have infinitely many. In fact, there is no easy way to define the | 23968 | have infinitely many. In fact, there is no easy way to define the |
| 23976 | ``global'' minimum of | 23969 | ``global'' minimum of |
| 23977 | @texline @tmath{x \sin x} | 23970 | @texline @math{x \sin x} |
| 23978 | @infoline @expr{x sin(x)} | 23971 | @infoline @expr{x sin(x)} |
| 23979 | but Calc can still locate any particular local minimum | 23972 | but Calc can still locate any particular local minimum |
| 23980 | for you. Calc basically goes downhill from the initial guess until it | 23973 | for you. Calc basically goes downhill from the initial guess until it |
| @@ -24097,7 +24090,7 @@ the @dfn{parameters} of the model. | |||
| 24097 | The @kbd{a F} command takes the data set to be fitted from the stack. | 24090 | The @kbd{a F} command takes the data set to be fitted from the stack. |
| 24098 | By default, it expects the data in the form of a matrix. For example, | 24091 | By default, it expects the data in the form of a matrix. For example, |
| 24099 | for a linear or polynomial fit, this would be a | 24092 | for a linear or polynomial fit, this would be a |
| 24100 | @texline @tmath{2\times N} | 24093 | @texline @math{2\times N} |
| 24101 | @infoline 2xN | 24094 | @infoline 2xN |
| 24102 | matrix where the first row is a list of @expr{x} values and the second | 24095 | matrix where the first row is a list of @expr{x} values and the second |
| 24103 | row has the corresponding @expr{y} values. For the multilinear fit | 24096 | row has the corresponding @expr{y} values. For the multilinear fit |
| @@ -24105,10 +24098,10 @@ shown above, the matrix would have four rows (@expr{x_1}, @expr{x_2}, | |||
| 24105 | @expr{x_3}, and @expr{y}, respectively). | 24098 | @expr{x_3}, and @expr{y}, respectively). |
| 24106 | 24099 | ||
| 24107 | If you happen to have an | 24100 | If you happen to have an |
| 24108 | @texline @tmath{N\times2} | 24101 | @texline @math{N\times2} |
| 24109 | @infoline Nx2 | 24102 | @infoline Nx2 |
| 24110 | matrix instead of a | 24103 | matrix instead of a |
| 24111 | @texline @tmath{2\times N} | 24104 | @texline @math{2\times N} |
| 24112 | @infoline 2xN | 24105 | @infoline 2xN |
| 24113 | matrix, just press @kbd{v t} first to transpose the matrix. | 24106 | matrix, just press @kbd{v t} first to transpose the matrix. |
| 24114 | 24107 | ||
| @@ -24206,11 +24199,11 @@ which is clearly zero if @expr{a + b x} exactly fits all data points, | |||
| 24206 | and increases as various @expr{a + b x_i} values fail to match the | 24199 | and increases as various @expr{a + b x_i} values fail to match the |
| 24207 | corresponding @expr{y_i} values. There are several reasons why the | 24200 | corresponding @expr{y_i} values. There are several reasons why the |
| 24208 | summand is squared, one of them being to ensure that | 24201 | summand is squared, one of them being to ensure that |
| 24209 | @texline @tmath{\chi^2 \ge 0}. | 24202 | @texline @math{\chi^2 \ge 0}. |
| 24210 | @infoline @expr{chi^2 >= 0}. | 24203 | @infoline @expr{chi^2 >= 0}. |
| 24211 | Least-squares fitting simply chooses the values of @expr{a} and @expr{b} | 24204 | Least-squares fitting simply chooses the values of @expr{a} and @expr{b} |
| 24212 | for which the error | 24205 | for which the error |
| 24213 | @texline @tmath{\chi^2} | 24206 | @texline @math{\chi^2} |
| 24214 | @infoline @expr{chi^2} | 24207 | @infoline @expr{chi^2} |
| 24215 | is as small as possible. | 24208 | is as small as possible. |
| 24216 | 24209 | ||
| @@ -24266,7 +24259,7 @@ line slightly to improve the fit. | |||
| 24266 | 24259 | ||
| 24267 | An important result from the theory of polynomial fitting is that it | 24260 | An important result from the theory of polynomial fitting is that it |
| 24268 | is always possible to fit @var{n} data points exactly using a polynomial | 24261 | is always possible to fit @var{n} data points exactly using a polynomial |
| 24269 | of degree @i{@var{n}-1}, sometimes called an @dfn{interpolating polynomial}. | 24262 | of degree @mathit{@var{n}-1}, sometimes called an @dfn{interpolating polynomial}. |
| 24270 | Using the modified (14) data matrix, a model number of 4 gives | 24263 | Using the modified (14) data matrix, a model number of 4 gives |
| 24271 | a polynomial that exactly matches all five data points: | 24264 | a polynomial that exactly matches all five data points: |
| 24272 | 24265 | ||
| @@ -24371,10 +24364,10 @@ contain error forms. The data values must either all include errors | |||
| 24371 | or all be plain numbers. Error forms can go anywhere but generally | 24364 | or all be plain numbers. Error forms can go anywhere but generally |
| 24372 | go on the numbers in the last row of the data matrix. If the last | 24365 | go on the numbers in the last row of the data matrix. If the last |
| 24373 | row contains error forms | 24366 | row contains error forms |
| 24374 | @texline `@var{y_i}@w{ @t{+/-} }@tmath{\sigma_i}', | 24367 | @texline `@var{y_i}@w{ @t{+/-} }@math{\sigma_i}', |
| 24375 | @infoline `@var{y_i}@w{ @t{+/-} }@var{sigma_i}', | 24368 | @infoline `@var{y_i}@w{ @t{+/-} }@var{sigma_i}', |
| 24376 | then the | 24369 | then the |
| 24377 | @texline @tmath{\chi^2} | 24370 | @texline @math{\chi^2} |
| 24378 | @infoline @expr{chi^2} | 24371 | @infoline @expr{chi^2} |
| 24379 | statistic is now, | 24372 | statistic is now, |
| 24380 | 24373 | ||
| @@ -24397,7 +24390,7 @@ the fitting operation. | |||
| 24397 | If there are error forms on other rows of the data matrix, all the | 24390 | If there are error forms on other rows of the data matrix, all the |
| 24398 | errors for a given data point are combined; the square root of the | 24391 | errors for a given data point are combined; the square root of the |
| 24399 | sum of the squares of the errors forms the | 24392 | sum of the squares of the errors forms the |
| 24400 | @texline @tmath{\sigma_i} | 24393 | @texline @math{\sigma_i} |
| 24401 | @infoline @expr{sigma_i} | 24394 | @infoline @expr{sigma_i} |
| 24402 | used for the data point. | 24395 | used for the data point. |
| 24403 | 24396 | ||
| @@ -24407,14 +24400,14 @@ probably use @kbd{H a F} so that the output also contains error | |||
| 24407 | estimates. | 24400 | estimates. |
| 24408 | 24401 | ||
| 24409 | If the input contains error forms but all the | 24402 | If the input contains error forms but all the |
| 24410 | @texline @tmath{\sigma_i} | 24403 | @texline @math{\sigma_i} |
| 24411 | @infoline @expr{sigma_i} | 24404 | @infoline @expr{sigma_i} |
| 24412 | values are the same, it is easy to see that the resulting fitted model | 24405 | values are the same, it is easy to see that the resulting fitted model |
| 24413 | will be the same as if the input did not have error forms at all | 24406 | will be the same as if the input did not have error forms at all |
| 24414 | @texline (@tmath{\chi^2} | 24407 | @texline (@math{\chi^2} |
| 24415 | @infoline (@expr{chi^2} | 24408 | @infoline (@expr{chi^2} |
| 24416 | is simply scaled uniformly by | 24409 | is simply scaled uniformly by |
| 24417 | @texline @tmath{1 / \sigma^2}, | 24410 | @texline @math{1 / \sigma^2}, |
| 24418 | @infoline @expr{1 / sigma^2}, | 24411 | @infoline @expr{1 / sigma^2}, |
| 24419 | which doesn't affect where it has a minimum). But there @emph{will} be | 24412 | which doesn't affect where it has a minimum). But there @emph{will} be |
| 24420 | a difference in the estimated errors of the coefficients reported by | 24413 | a difference in the estimated errors of the coefficients reported by |
| @@ -24449,20 +24442,20 @@ will have length @expr{M = d+1} with the constant term first. | |||
| 24449 | @item | 24442 | @item |
| 24450 | The covariance matrix @expr{C} computed from the fit. This is | 24443 | The covariance matrix @expr{C} computed from the fit. This is |
| 24451 | an @var{m}x@var{m} symmetric matrix; the diagonal elements | 24444 | an @var{m}x@var{m} symmetric matrix; the diagonal elements |
| 24452 | @texline @tmath{C_{jj}} | 24445 | @texline @math{C_{jj}} |
| 24453 | @infoline @expr{C_j_j} | 24446 | @infoline @expr{C_j_j} |
| 24454 | are the variances | 24447 | are the variances |
| 24455 | @texline @tmath{\sigma_j^2} | 24448 | @texline @math{\sigma_j^2} |
| 24456 | @infoline @expr{sigma_j^2} | 24449 | @infoline @expr{sigma_j^2} |
| 24457 | of the parameters. The other elements are covariances | 24450 | of the parameters. The other elements are covariances |
| 24458 | @texline @tmath{\sigma_{ij}^2} | 24451 | @texline @math{\sigma_{ij}^2} |
| 24459 | @infoline @expr{sigma_i_j^2} | 24452 | @infoline @expr{sigma_i_j^2} |
| 24460 | that describe the correlation between pairs of parameters. (A related | 24453 | that describe the correlation between pairs of parameters. (A related |
| 24461 | set of numbers, the @dfn{linear correlation coefficients} | 24454 | set of numbers, the @dfn{linear correlation coefficients} |
| 24462 | @texline @tmath{r_{ij}}, | 24455 | @texline @math{r_{ij}}, |
| 24463 | @infoline @expr{r_i_j}, | 24456 | @infoline @expr{r_i_j}, |
| 24464 | are defined as | 24457 | are defined as |
| 24465 | @texline @tmath{\sigma_{ij}^2 / \sigma_i \, \sigma_j}.) | 24458 | @texline @math{\sigma_{ij}^2 / \sigma_i \, \sigma_j}.) |
| 24466 | @infoline @expr{sigma_i_j^2 / sigma_i sigma_j}.) | 24459 | @infoline @expr{sigma_i_j^2 / sigma_i sigma_j}.) |
| 24467 | 24460 | ||
| 24468 | @item | 24461 | @item |
| @@ -24473,11 +24466,11 @@ polynomial and multilinear fits described so far. | |||
| 24473 | 24466 | ||
| 24474 | @item | 24467 | @item |
| 24475 | The value of | 24468 | The value of |
| 24476 | @texline @tmath{\chi^2} | 24469 | @texline @math{\chi^2} |
| 24477 | @infoline @expr{chi^2} | 24470 | @infoline @expr{chi^2} |
| 24478 | for the fit, calculated by the formulas shown above. This gives a | 24471 | for the fit, calculated by the formulas shown above. This gives a |
| 24479 | measure of the quality of the fit; statisticians consider | 24472 | measure of the quality of the fit; statisticians consider |
| 24480 | @texline @tmath{\chi^2 \approx N - M} | 24473 | @texline @math{\chi^2 \approx N - M} |
| 24481 | @infoline @expr{chi^2 = N - M} | 24474 | @infoline @expr{chi^2 = N - M} |
| 24482 | to indicate a moderately good fit (where again @expr{N} is the number of | 24475 | to indicate a moderately good fit (where again @expr{N} is the number of |
| 24483 | data points and @expr{M} is the number of parameters). | 24476 | data points and @expr{M} is the number of parameters). |
| @@ -24486,13 +24479,13 @@ data points and @expr{M} is the number of parameters). | |||
| 24486 | A measure of goodness of fit expressed as a probability @expr{Q}. | 24479 | A measure of goodness of fit expressed as a probability @expr{Q}. |
| 24487 | This is computed from the @code{utpc} probability distribution | 24480 | This is computed from the @code{utpc} probability distribution |
| 24488 | function using | 24481 | function using |
| 24489 | @texline @tmath{\chi^2} | 24482 | @texline @math{\chi^2} |
| 24490 | @infoline @expr{chi^2} | 24483 | @infoline @expr{chi^2} |
| 24491 | with @expr{N - M} degrees of freedom. A | 24484 | with @expr{N - M} degrees of freedom. A |
| 24492 | value of 0.5 implies a good fit; some texts recommend that often | 24485 | value of 0.5 implies a good fit; some texts recommend that often |
| 24493 | @expr{Q = 0.1} or even 0.001 can signify an acceptable fit. In | 24486 | @expr{Q = 0.1} or even 0.001 can signify an acceptable fit. In |
| 24494 | particular, | 24487 | particular, |
| 24495 | @texline @tmath{\chi^2} | 24488 | @texline @math{\chi^2} |
| 24496 | @infoline @expr{chi^2} | 24489 | @infoline @expr{chi^2} |
| 24497 | statistics assume the errors in your inputs | 24490 | statistics assume the errors in your inputs |
| 24498 | follow a normal (Gaussian) distribution; if they don't, you may | 24491 | follow a normal (Gaussian) distribution; if they don't, you may |
| @@ -24501,7 +24494,7 @@ have to accept smaller values of @expr{Q}. | |||
| 24501 | The @expr{Q} value is computed only if the input included error | 24494 | The @expr{Q} value is computed only if the input included error |
| 24502 | estimates. Otherwise, Calc will report the symbol @code{nan} | 24495 | estimates. Otherwise, Calc will report the symbol @code{nan} |
| 24503 | for @expr{Q}. The reason is that in this case the | 24496 | for @expr{Q}. The reason is that in this case the |
| 24504 | @texline @tmath{\chi^2} | 24497 | @texline @math{\chi^2} |
| 24505 | @infoline @expr{chi^2} | 24498 | @infoline @expr{chi^2} |
| 24506 | value has effectively been used to estimate the original errors | 24499 | value has effectively been used to estimate the original errors |
| 24507 | in the input, and thus there is no redundant information left | 24500 | in the input, and thus there is no redundant information left |
| @@ -24520,31 +24513,31 @@ Here is a complete list of the standard models recognized by @kbd{a F}: | |||
| 24520 | 24513 | ||
| 24521 | @table @kbd | 24514 | @table @kbd |
| 24522 | @item 1 | 24515 | @item 1 |
| 24523 | Linear or multilinear. @i{a + b x + c y + d z}. | 24516 | Linear or multilinear. @mathit{a + b x + c y + d z}. |
| 24524 | @item 2-9 | 24517 | @item 2-9 |
| 24525 | Polynomials. @i{a + b x + c x^2 + d x^3}. | 24518 | Polynomials. @mathit{a + b x + c x^2 + d x^3}. |
| 24526 | @item e | 24519 | @item e |
| 24527 | Exponential. @i{a} @t{exp}@i{(b x)} @t{exp}@i{(c y)}. | 24520 | Exponential. @mathit{a} @t{exp}@mathit{(b x)} @t{exp}@mathit{(c y)}. |
| 24528 | @item E | 24521 | @item E |
| 24529 | Base-10 exponential. @i{a} @t{10^}@i{(b x)} @t{10^}@i{(c y)}. | 24522 | Base-10 exponential. @mathit{a} @t{10^}@mathit{(b x)} @t{10^}@mathit{(c y)}. |
| 24530 | @item x | 24523 | @item x |
| 24531 | Exponential (alternate notation). @t{exp}@i{(a + b x + c y)}. | 24524 | Exponential (alternate notation). @t{exp}@mathit{(a + b x + c y)}. |
| 24532 | @item X | 24525 | @item X |
| 24533 | Base-10 exponential (alternate). @t{10^}@i{(a + b x + c y)}. | 24526 | Base-10 exponential (alternate). @t{10^}@mathit{(a + b x + c y)}. |
| 24534 | @item l | 24527 | @item l |
| 24535 | Logarithmic. @i{a + b} @t{ln}@i{(x) + c} @t{ln}@i{(y)}. | 24528 | Logarithmic. @mathit{a + b} @t{ln}@mathit{(x) + c} @t{ln}@mathit{(y)}. |
| 24536 | @item L | 24529 | @item L |
| 24537 | Base-10 logarithmic. @i{a + b} @t{log10}@i{(x) + c} @t{log10}@i{(y)}. | 24530 | Base-10 logarithmic. @mathit{a + b} @t{log10}@mathit{(x) + c} @t{log10}@mathit{(y)}. |
| 24538 | @item ^ | 24531 | @item ^ |
| 24539 | General exponential. @i{a b^x c^y}. | 24532 | General exponential. @mathit{a b^x c^y}. |
| 24540 | @item p | 24533 | @item p |
| 24541 | Power law. @i{a x^b y^c}. | 24534 | Power law. @mathit{a x^b y^c}. |
| 24542 | @item q | 24535 | @item q |
| 24543 | Quadratic. @i{a + b (x-c)^2 + d (x-e)^2}. | 24536 | Quadratic. @mathit{a + b (x-c)^2 + d (x-e)^2}. |
| 24544 | @item g | 24537 | @item g |
| 24545 | Gaussian. | 24538 | Gaussian. |
| 24546 | @texline @tmath{{a \over b \sqrt{2 \pi}} \exp\left( -{1 \over 2} \left( x - c \over b \right)^2 \right)}. | 24539 | @texline @math{{a \over b \sqrt{2 \pi}} \exp\left( -{1 \over 2} \left( x - c \over b \right)^2 \right)}. |
| 24547 | @infoline @i{(a / b sqrt(2 pi)) exp(-0.5*((x-c)/b)^2)}. | 24540 | @infoline @mathit{(a / b sqrt(2 pi)) exp(-0.5*((x-c)/b)^2)}. |
| 24548 | @end table | 24541 | @end table |
| 24549 | 24542 | ||
| 24550 | All of these models are used in the usual way; just press the appropriate | 24543 | All of these models are used in the usual way; just press the appropriate |
| @@ -24656,18 +24649,18 @@ Calc uses the principal values of inverse functions like @code{ln} | |||
| 24656 | and @code{arcsin} when doing fits. For example, when you enter | 24649 | and @code{arcsin} when doing fits. For example, when you enter |
| 24657 | the model @samp{y = sin(a t + b)} Calc actually uses the easier | 24650 | the model @samp{y = sin(a t + b)} Calc actually uses the easier |
| 24658 | form @samp{arcsin(y) = a t + b}. The @code{arcsin} function always | 24651 | form @samp{arcsin(y) = a t + b}. The @code{arcsin} function always |
| 24659 | returns results in the range from @i{-90} to 90 degrees (or the | 24652 | returns results in the range from @mathit{-90} to 90 degrees (or the |
| 24660 | equivalent range in radians). Suppose you had data that you | 24653 | equivalent range in radians). Suppose you had data that you |
| 24661 | believed to represent roughly three oscillations of a sine wave, | 24654 | believed to represent roughly three oscillations of a sine wave, |
| 24662 | so that the argument of the sine might go from zero to | 24655 | so that the argument of the sine might go from zero to |
| 24663 | @texline @tmath{3\times360} | 24656 | @texline @math{3\times360} |
| 24664 | @infoline @i{3*360} | 24657 | @infoline @mathit{3*360} |
| 24665 | degrees. | 24658 | degrees. |
| 24666 | The above model would appear to be a good way to determine the | 24659 | The above model would appear to be a good way to determine the |
| 24667 | true frequency and phase of the sine wave, but in practice it | 24660 | true frequency and phase of the sine wave, but in practice it |
| 24668 | would fail utterly. The righthand side of the actual model | 24661 | would fail utterly. The righthand side of the actual model |
| 24669 | @samp{arcsin(y) = a t + b} will grow smoothly with @expr{t}, but | 24662 | @samp{arcsin(y) = a t + b} will grow smoothly with @expr{t}, but |
| 24670 | the lefthand side will bounce back and forth between @i{-90} and 90. | 24663 | the lefthand side will bounce back and forth between @mathit{-90} and 90. |
| 24671 | No values of @expr{a} and @expr{b} can make the two sides match, | 24664 | No values of @expr{a} and @expr{b} can make the two sides match, |
| 24672 | even approximately. | 24665 | even approximately. |
| 24673 | 24666 | ||
| @@ -24722,16 +24715,16 @@ ln(y) = ln(a) + b ln(x) | |||
| 24722 | 24715 | ||
| 24723 | @noindent | 24716 | @noindent |
| 24724 | which matches the desired form with | 24717 | which matches the desired form with |
| 24725 | @texline @tmath{Y = \ln(y)}, | 24718 | @texline @math{Y = \ln(y)}, |
| 24726 | @infoline @expr{Y = ln(y)}, | 24719 | @infoline @expr{Y = ln(y)}, |
| 24727 | @texline @tmath{A = \ln(a)}, | 24720 | @texline @math{A = \ln(a)}, |
| 24728 | @infoline @expr{A = ln(a)}, | 24721 | @infoline @expr{A = ln(a)}, |
| 24729 | @expr{F = 1}, @expr{B = b}, and | 24722 | @expr{F = 1}, @expr{B = b}, and |
| 24730 | @texline @tmath{G = \ln(x)}. | 24723 | @texline @math{G = \ln(x)}. |
| 24731 | @infoline @expr{G = ln(x)}. | 24724 | @infoline @expr{G = ln(x)}. |
| 24732 | Calc thus computes the logarithms of your @expr{y} and @expr{x} values, | 24725 | Calc thus computes the logarithms of your @expr{y} and @expr{x} values, |
| 24733 | does a linear fit for @expr{A} and @expr{B}, then solves to get | 24726 | does a linear fit for @expr{A} and @expr{B}, then solves to get |
| 24734 | @texline @tmath{a = \exp(A)} | 24727 | @texline @math{a = \exp(A)} |
| 24735 | @infoline @expr{a = exp(A)} | 24728 | @infoline @expr{a = exp(A)} |
| 24736 | and @expr{b = B}. | 24729 | and @expr{b = B}. |
| 24737 | 24730 | ||
| @@ -24745,7 +24738,7 @@ y = a + b c^2 - 2 b c x + b x^2 | |||
| 24745 | 24738 | ||
| 24746 | @noindent | 24739 | @noindent |
| 24747 | which matches with @expr{Y = y}, @expr{A = a + b c^2}, @expr{F = 1}, | 24740 | which matches with @expr{Y = y}, @expr{A = a + b c^2}, @expr{F = 1}, |
| 24748 | @expr{B = -2 b c}, @expr{G = x} (the @i{-2} factor could just as easily | 24741 | @expr{B = -2 b c}, @expr{G = x} (the @mathit{-2} factor could just as easily |
| 24749 | have been put into @expr{G} instead of @expr{B}), @expr{C = b}, and | 24742 | have been put into @expr{G} instead of @expr{B}), @expr{C = b}, and |
| 24750 | @expr{H = x^2}. | 24743 | @expr{H = x^2}. |
| 24751 | 24744 | ||
| @@ -24777,7 +24770,7 @@ from the list of parameters when you answer the variables prompt. | |||
| 24777 | A last desperate step would be to use the general-purpose | 24770 | A last desperate step would be to use the general-purpose |
| 24778 | @code{minimize} function rather than @code{fit}. After all, both | 24771 | @code{minimize} function rather than @code{fit}. After all, both |
| 24779 | functions solve the problem of minimizing an expression (the | 24772 | functions solve the problem of minimizing an expression (the |
| 24780 | @texline @tmath{\chi^2} | 24773 | @texline @math{\chi^2} |
| 24781 | @infoline @expr{chi^2} | 24774 | @infoline @expr{chi^2} |
| 24782 | sum) by adjusting certain parameters in the expression. The @kbd{a F} | 24775 | sum) by adjusting certain parameters in the expression. The @kbd{a F} |
| 24783 | command is able to use a vastly more efficient algorithm due to its | 24776 | command is able to use a vastly more efficient algorithm due to its |
| @@ -24788,7 +24781,7 @@ A compromise would be to pick out a few parameters without which the | |||
| 24788 | fit is linearizable, and use @code{minimize} on a call to @code{fit} | 24781 | fit is linearizable, and use @code{minimize} on a call to @code{fit} |
| 24789 | which efficiently takes care of the rest of the parameters. The thing | 24782 | which efficiently takes care of the rest of the parameters. The thing |
| 24790 | to be minimized would be the value of | 24783 | to be minimized would be the value of |
| 24791 | @texline @tmath{\chi^2} | 24784 | @texline @math{\chi^2} |
| 24792 | @infoline @expr{chi^2} | 24785 | @infoline @expr{chi^2} |
| 24793 | returned as the fifth result of the @code{xfit} function: | 24786 | returned as the fifth result of the @code{xfit} function: |
| 24794 | 24787 | ||
| @@ -24848,11 +24841,11 @@ and @expr{y} to be plain numbers, and makes @expr{z} into an error | |||
| 24848 | form with this combined error. The @expr{Y(x,y,z)} part of the | 24841 | form with this combined error. The @expr{Y(x,y,z)} part of the |
| 24849 | linearized model is evaluated, and the result should be an error | 24842 | linearized model is evaluated, and the result should be an error |
| 24850 | form. The error part of that result is used for | 24843 | form. The error part of that result is used for |
| 24851 | @texline @tmath{\sigma_i} | 24844 | @texline @math{\sigma_i} |
| 24852 | @infoline @expr{sigma_i} | 24845 | @infoline @expr{sigma_i} |
| 24853 | for the data point. If for some reason @expr{Y(x,y,z)} does not return | 24846 | for the data point. If for some reason @expr{Y(x,y,z)} does not return |
| 24854 | an error form, the combined error from @expr{z} is used directly for | 24847 | an error form, the combined error from @expr{z} is used directly for |
| 24855 | @texline @tmath{\sigma_i}. | 24848 | @texline @math{\sigma_i}. |
| 24856 | @infoline @expr{sigma_i}. | 24849 | @infoline @expr{sigma_i}. |
| 24857 | Finally, @expr{z} is also stripped of its error | 24850 | Finally, @expr{z} is also stripped of its error |
| 24858 | for use in computing @expr{F(x,y,z)}, @expr{G(x,y,z)} and so on; | 24851 | for use in computing @expr{F(x,y,z)}, @expr{G(x,y,z)} and so on; |
| @@ -24864,7 +24857,7 @@ the most reasonable thing in the typical case that @expr{Y(x,y,z)} | |||
| 24864 | depends only on the dependent variable @expr{z}, and in fact is | 24857 | depends only on the dependent variable @expr{z}, and in fact is |
| 24865 | often simply equal to @expr{z}. For common cases like polynomials | 24858 | often simply equal to @expr{z}. For common cases like polynomials |
| 24866 | and multilinear models, the combined error is simply used as the | 24859 | and multilinear models, the combined error is simply used as the |
| 24867 | @texline @tmath{\sigma} | 24860 | @texline @math{\sigma} |
| 24868 | @infoline @expr{sigma} | 24861 | @infoline @expr{sigma} |
| 24869 | for the data point with no further ado.) | 24862 | for the data point with no further ado.) |
| 24870 | 24863 | ||
| @@ -25218,7 +25211,7 @@ If the lower limit is greater than the upper limit (assuming a | |||
| 25218 | positive step size), the result is generally zero. However, | 25211 | positive step size), the result is generally zero. However, |
| 25219 | Calc only guarantees a zero result when the upper limit is | 25212 | Calc only guarantees a zero result when the upper limit is |
| 25220 | exactly one step less than the lower limit, i.e., if the number | 25213 | exactly one step less than the lower limit, i.e., if the number |
| 25221 | of iterations is @i{-1}. Thus @samp{sum(f(k), k, n, n-1)} is zero | 25214 | of iterations is @mathit{-1}. Thus @samp{sum(f(k), k, n, n-1)} is zero |
| 25222 | but the sum from @samp{n} to @samp{n-2} may report a nonzero value | 25215 | but the sum from @samp{n} to @samp{n-2} may report a nonzero value |
| 25223 | if Calc used a closed form solution. | 25216 | if Calc used a closed form solution. |
| 25224 | 25217 | ||
| @@ -25244,7 +25237,7 @@ formula works out to the indeterminate form @expr{0 / 0}, which | |||
| 25244 | Calc will not assume is zero. Better would be to use | 25237 | Calc will not assume is zero. Better would be to use |
| 25245 | @samp{(k != k_0) ? 1/(k-k_0) : 0}; the @samp{? :} operator does | 25238 | @samp{(k != k_0) ? 1/(k-k_0) : 0}; the @samp{? :} operator does |
| 25246 | an ``if-then-else'' test: This expression says, ``if | 25239 | an ``if-then-else'' test: This expression says, ``if |
| 25247 | @texline @tmath{k \ne k_0}, | 25240 | @texline @math{k \ne k_0}, |
| 25248 | @infoline @expr{k != k_0}, | 25241 | @infoline @expr{k != k_0}, |
| 25249 | then @expr{1/(k-k_0)}, else zero.'' Now the formula @expr{1/(k-k_0)} | 25242 | then @expr{1/(k-k_0)}, else zero.'' Now the formula @expr{1/(k-k_0)} |
| 25250 | will not even be evaluated by Calc when @expr{k = k_0}. | 25243 | will not even be evaluated by Calc when @expr{k = k_0}. |
| @@ -26259,16 +26252,16 @@ then the rule set @samp{[f(0) := 0, import(linearF)]} will apply | |||
| 26259 | all three rules. It is possible to modify the imported rules | 26252 | all three rules. It is possible to modify the imported rules |
| 26260 | slightly: @samp{import(x, v1, x1, v2, x2, @dots{})} imports | 26253 | slightly: @samp{import(x, v1, x1, v2, x2, @dots{})} imports |
| 26261 | the rule set @expr{x} with all occurrences of | 26254 | the rule set @expr{x} with all occurrences of |
| 26262 | @texline @tmath{v_1}, | 26255 | @texline @math{v_1}, |
| 26263 | @infoline @expr{v1}, | 26256 | @infoline @expr{v1}, |
| 26264 | as either a variable name or a function name, replaced with | 26257 | as either a variable name or a function name, replaced with |
| 26265 | @texline @tmath{x_1} | 26258 | @texline @math{x_1} |
| 26266 | @infoline @expr{x1} | 26259 | @infoline @expr{x1} |
| 26267 | and so on. (If | 26260 | and so on. (If |
| 26268 | @texline @tmath{v_1} | 26261 | @texline @math{v_1} |
| 26269 | @infoline @expr{v1} | 26262 | @infoline @expr{v1} |
| 26270 | is used as a function name, then | 26263 | is used as a function name, then |
| 26271 | @texline @tmath{x_1} | 26264 | @texline @math{x_1} |
| 26272 | @infoline @expr{x1} | 26265 | @infoline @expr{x1} |
| 26273 | must be either a function name itself or a @w{@samp{< >}} nameless | 26266 | must be either a function name itself or a @w{@samp{< >}} nameless |
| 26274 | function; @pxref{Specifying Operators}.) For example, @samp{[g(0) := 0, | 26267 | function; @pxref{Specifying Operators}.) For example, @samp{[g(0) := 0, |
| @@ -27734,7 +27727,7 @@ in its normal terms, and @kbd{u b} expresses the definition in base | |||
| 27734 | units. | 27727 | units. |
| 27735 | 27728 | ||
| 27736 | Two units, @code{pi} and @code{fsc} (the fine structure constant, | 27729 | Two units, @code{pi} and @code{fsc} (the fine structure constant, |
| 27737 | approximately @i{1/137}) are dimensionless. The units simplification | 27730 | approximately @mathit{1/137}) are dimensionless. The units simplification |
| 27738 | commands simply treat these names as equivalent to their corresponding | 27731 | commands simply treat these names as equivalent to their corresponding |
| 27739 | values. However you can, for example, use @kbd{u c} to convert a pure | 27732 | values. However you can, for example, use @kbd{u c} to convert a pure |
| 27740 | number into multiples of the fine structure constant, or @kbd{u b} to | 27733 | number into multiples of the fine structure constant, or @kbd{u b} to |
| @@ -27951,10 +27944,10 @@ All the arithmetic stores accept the Inverse prefix to reverse the | |||
| 27951 | order of the operands. If @expr{v} represents the contents of the | 27944 | order of the operands. If @expr{v} represents the contents of the |
| 27952 | variable, and @expr{a} is the value drawn from the stack, then regular | 27945 | variable, and @expr{a} is the value drawn from the stack, then regular |
| 27953 | @w{@kbd{s -}} assigns | 27946 | @w{@kbd{s -}} assigns |
| 27954 | @texline @tmath{v \coloneq v - a}, | 27947 | @texline @math{v \coloneq v - a}, |
| 27955 | @infoline @expr{v := v - a}, | 27948 | @infoline @expr{v := v - a}, |
| 27956 | but @kbd{I s -} assigns | 27949 | but @kbd{I s -} assigns |
| 27957 | @texline @tmath{v \coloneq a - v}. | 27950 | @texline @math{v \coloneq a - v}. |
| 27958 | @infoline @expr{v := a - v}. | 27951 | @infoline @expr{v := a - v}. |
| 27959 | While @kbd{I s *} might seem pointless, it is | 27952 | While @kbd{I s *} might seem pointless, it is |
| 27960 | useful if matrix multiplication is involved. Actually, all the | 27953 | useful if matrix multiplication is involved. Actually, all the |
| @@ -28541,7 +28534,7 @@ the same length); either or both may instead be interval forms. The | |||
| 28541 | ``z'' value must be a matrix with the same number of rows as elements | 28534 | ``z'' value must be a matrix with the same number of rows as elements |
| 28542 | in ``x'', and the same number of columns as elements in ``y''. The | 28535 | in ``x'', and the same number of columns as elements in ``y''. The |
| 28543 | result is a surface plot where | 28536 | result is a surface plot where |
| 28544 | @texline @tmath{z_{ij}} | 28537 | @texline @math{z_{ij}} |
| 28545 | @infoline @expr{z_ij} | 28538 | @infoline @expr{z_ij} |
| 28546 | is the height of the point | 28539 | is the height of the point |
| 28547 | at coordinate @expr{(x_i, y_j)} on the surface. The 3D graph will | 28540 | at coordinate @expr{(x_i, y_j)} on the surface. The 3D graph will |
| @@ -28652,7 +28645,7 @@ values covered by all the curves ought to be roughly the same if | |||
| 28652 | they are to look nice on the same graph.) | 28645 | they are to look nice on the same graph.) |
| 28653 | 28646 | ||
| 28654 | For example, to plot | 28647 | For example, to plot |
| 28655 | @texline @tmath{\sin n x} | 28648 | @texline @math{\sin n x} |
| 28656 | @infoline @expr{sin(n x)} | 28649 | @infoline @expr{sin(n x)} |
| 28657 | for integers @expr{n} | 28650 | for integers @expr{n} |
| 28658 | from 1 to 5, you could use @kbd{v x} to create a vector of integers | 28651 | from 1 to 5, you could use @kbd{v x} to create a vector of integers |
| @@ -28903,7 +28896,7 @@ values, but if you store a vector of integers in one of these variables, | |||
| 28903 | the @kbd{g a} and @kbd{g f} commands will use those style numbers | 28896 | the @kbd{g a} and @kbd{g f} commands will use those style numbers |
| 28904 | instead of the defaults for new curves that are added to the graph. | 28897 | instead of the defaults for new curves that are added to the graph. |
| 28905 | An entry should be a positive integer for a specific style, or 0 to let | 28898 | An entry should be a positive integer for a specific style, or 0 to let |
| 28906 | the style be chosen automatically, or @i{-1} to turn off lines or points | 28899 | the style be chosen automatically, or @mathit{-1} to turn off lines or points |
| 28907 | altogether. If there are more curves than elements in the vector, the | 28900 | altogether. If there are more curves than elements in the vector, the |
| 28908 | last few curves will continue to have the default styles. Of course, | 28901 | last few curves will continue to have the default styles. Of course, |
| 28909 | you can later use @kbd{g s} and @kbd{g S} to change any of these styles. | 28902 | you can later use @kbd{g s} and @kbd{g S} to change any of these styles. |
| @@ -28942,7 +28935,7 @@ picture of the graph composed of characters like @code{-} and @code{|} | |||
| 28942 | to a buffer called @samp{*Gnuplot Trail*}, which Calc then displays. | 28935 | to a buffer called @samp{*Gnuplot Trail*}, which Calc then displays. |
| 28943 | The graph is made the same size as the Emacs screen, which on most | 28936 | The graph is made the same size as the Emacs screen, which on most |
| 28944 | dumb terminals will be | 28937 | dumb terminals will be |
| 28945 | @texline @tmath{80\times24} | 28938 | @texline @math{80\times24} |
| 28946 | @infoline 80x24 | 28939 | @infoline 80x24 |
| 28947 | characters. The graph is displayed in | 28940 | characters. The graph is displayed in |
| 28948 | an Emacs ``recursive edit''; type @kbd{q} or @kbd{M-# M-#} to exit | 28941 | an Emacs ``recursive edit''; type @kbd{q} or @kbd{M-# M-#} to exit |
| @@ -29252,7 +29245,7 @@ would correctly split the line into two error forms. | |||
| 29252 | 29245 | ||
| 29253 | @xref{Matrix Functions}, to see how to pull the matrix apart into its | 29246 | @xref{Matrix Functions}, to see how to pull the matrix apart into its |
| 29254 | constituent rows and columns. (If it is a | 29247 | constituent rows and columns. (If it is a |
| 29255 | @texline @tmath{1\times1} | 29248 | @texline @math{1\times1} |
| 29256 | @infoline 1x1 | 29249 | @infoline 1x1 |
| 29257 | matrix, just hit @kbd{v u} (@code{calc-unpack}) twice.) | 29250 | matrix, just hit @kbd{v u} (@code{calc-unpack}) twice.) |
| 29258 | 29251 | ||
| @@ -29590,7 +29583,7 @@ same limit as last time. | |||
| 29590 | @key{INV GCD} computes the LCM (least common multiple) function. | 29583 | @key{INV GCD} computes the LCM (least common multiple) function. |
| 29591 | 29584 | ||
| 29592 | @key{INV FACT} is the gamma function. | 29585 | @key{INV FACT} is the gamma function. |
| 29593 | @texline @tmath{\Gamma(x) = (x-1)!}. | 29586 | @texline @math{\Gamma(x) = (x-1)!}. |
| 29594 | @infoline @expr{gamma(x) = (x-1)!}. | 29587 | @infoline @expr{gamma(x) = (x-1)!}. |
| 29595 | 29588 | ||
| 29596 | @key{PERM} is the number-of-permutations function, which is on the | 29589 | @key{PERM} is the number-of-permutations function, which is on the |
| @@ -31018,7 +31011,7 @@ forced to use upward-counting conventions. In this case, if @var{initial} | |||
| 31018 | is greater than @var{final} the body will not be executed at all. | 31011 | is greater than @var{final} the body will not be executed at all. |
| 31019 | Note that @var{step} may still be negative in this loop; the prefix | 31012 | Note that @var{step} may still be negative in this loop; the prefix |
| 31020 | argument merely constrains the loop-finished test. Likewise, a prefix | 31013 | argument merely constrains the loop-finished test. Likewise, a prefix |
| 31021 | argument of @i{-1} forces downward-counting conventions. | 31014 | argument of @mathit{-1} forces downward-counting conventions. |
| 31022 | 31015 | ||
| 31023 | @kindex Z @{ | 31016 | @kindex Z @{ |
| 31024 | @kindex Z @} | 31017 | @kindex Z @} |
| @@ -31989,7 +31982,7 @@ same thing with a single division by 512. | |||
| 31989 | @tindex mysin | 31982 | @tindex mysin |
| 31990 | A somewhat limited sine function could be defined as follows, using the | 31983 | A somewhat limited sine function could be defined as follows, using the |
| 31991 | well-known Taylor series expansion for | 31984 | well-known Taylor series expansion for |
| 31992 | @texline @tmath{\sin x}: | 31985 | @texline @math{\sin x}: |
| 31993 | @infoline @samp{sin(x)}: | 31986 | @infoline @samp{sin(x)}: |
| 31994 | 31987 | ||
| 31995 | @smallexample | 31988 | @smallexample |
| @@ -32512,10 +32505,10 @@ which is not a Lisp list. | |||
| 32512 | Large integers are stored as lists of the form @samp{(bigpos @var{d0} | 32505 | Large integers are stored as lists of the form @samp{(bigpos @var{d0} |
| 32513 | @var{d1} @var{d2} @dots{})} for positive integers 1000000 or more, or | 32506 | @var{d1} @var{d2} @dots{})} for positive integers 1000000 or more, or |
| 32514 | @samp{(bigneg @var{d0} @var{d1} @var{d2} @dots{})} for negative integers | 32507 | @samp{(bigneg @var{d0} @var{d1} @var{d2} @dots{})} for negative integers |
| 32515 | @i{-1000000} or less. Each @var{d} is a base-1000 ``digit,'' a Lisp integer | 32508 | @mathit{-1000000} or less. Each @var{d} is a base-1000 ``digit,'' a Lisp integer |
| 32516 | from 0 to 999. The least significant digit is @var{d0}; the last digit, | 32509 | from 0 to 999. The least significant digit is @var{d0}; the last digit, |
| 32517 | @var{dn}, which is always nonzero, is the most significant digit. For | 32510 | @var{dn}, which is always nonzero, is the most significant digit. For |
| 32518 | example, the integer @i{-12345678} is stored as @samp{(bigneg 678 345 12)}. | 32511 | example, the integer @mathit{-12345678} is stored as @samp{(bigneg 678 345 12)}. |
| 32519 | 32512 | ||
| 32520 | The distinction between small and large integers is entirely hidden from | 32513 | The distinction between small and large integers is entirely hidden from |
| 32521 | the user. In @code{defmath} definitions, the Lisp predicate @code{integerp} | 32514 | the user. In @code{defmath} definitions, the Lisp predicate @code{integerp} |
| @@ -32536,7 +32529,7 @@ Floating-point numbers are stored in the form, @samp{(float @var{mant} | |||
| 32536 | @samp{10^@var{p}} in absolute value (@var{p} represents the current | 32529 | @samp{10^@var{p}} in absolute value (@var{p} represents the current |
| 32537 | precision), and @var{exp} (the ``exponent'') is a fixnum. The value of | 32530 | precision), and @var{exp} (the ``exponent'') is a fixnum. The value of |
| 32538 | the float is @samp{@var{mant} * 10^@var{exp}}. For example, the number | 32531 | the float is @samp{@var{mant} * 10^@var{exp}}. For example, the number |
| 32539 | @i{-3.14} is stored as @samp{(float -314 -2) = -314*10^-2}. Other constraints | 32532 | @mathit{-3.14} is stored as @samp{(float -314 -2) = -314*10^-2}. Other constraints |
| 32540 | are that the number 0.0 is always stored as @samp{(float 0 0)}, and, | 32533 | are that the number 0.0 is always stored as @samp{(float 0 0)}, and, |
| 32541 | except for the 0.0 case, the rightmost base-10 digit of @var{mant} is | 32534 | except for the 0.0 case, the rightmost base-10 digit of @var{mant} is |
| 32542 | always nonzero. (If the rightmost digit is zero, the number is | 32535 | always nonzero. (If the rightmost digit is zero, the number is |
| @@ -32848,7 +32841,7 @@ is applied to the top stack element, or, if @var{unary} is not | |||
| 32848 | specified, nothing happens. When the argument is two or more, | 32841 | specified, nothing happens. When the argument is two or more, |
| 32849 | the binary function @var{func} is reduced across the top @var{arg} | 32842 | the binary function @var{func} is reduced across the top @var{arg} |
| 32850 | stack elements; when the argument is negative, the function is | 32843 | stack elements; when the argument is negative, the function is |
| 32851 | mapped between the next-to-top @i{-@var{arg}} stack elements and the | 32844 | mapped between the next-to-top @mathit{-@var{arg}} stack elements and the |
| 32852 | top element. | 32845 | top element. |
| 32853 | @end defun | 32846 | @end defun |
| 32854 | 32847 | ||
| @@ -33267,7 +33260,7 @@ or formula, this calls @code{reject-arg}. | |||
| 33267 | @end defun | 33260 | @end defun |
| 33268 | 33261 | ||
| 33269 | @defun compare x y | 33262 | @defun compare x y |
| 33270 | Compare the numbers @var{x} and @var{y}, and return @i{-1} if | 33263 | Compare the numbers @var{x} and @var{y}, and return @mathit{-1} if |
| 33271 | @samp{(lessp @var{x} @var{y})}, 1 if @samp{(lessp @var{y} @var{x})}, | 33264 | @samp{(lessp @var{x} @var{y})}, 1 if @samp{(lessp @var{y} @var{x})}, |
| 33272 | 0 if @samp{(math-equal @var{x} @var{y})}, or 2 if the order is | 33265 | 0 if @samp{(math-equal @var{x} @var{y})}, or 2 if the order is |
| 33273 | undefined or cannot be determined. | 33266 | undefined or cannot be determined. |
| @@ -33280,7 +33273,7 @@ considered to have zero digits. | |||
| 33280 | @end defun | 33273 | @end defun |
| 33281 | 33274 | ||
| 33282 | @defun scale-int x n | 33275 | @defun scale-int x n |
| 33283 | Shift integer @var{x} left @var{n} decimal digits, or right @i{-@var{n}} | 33276 | Shift integer @var{x} left @var{n} decimal digits, or right @mathit{-@var{n}} |
| 33284 | digits with truncation toward zero. | 33277 | digits with truncation toward zero. |
| 33285 | @end defun | 33278 | @end defun |
| 33286 | 33279 | ||
| @@ -33488,7 +33481,7 @@ function @code{frac}, and can be rather slow. | |||
| 33488 | @defun quarter-integer n | 33481 | @defun quarter-integer n |
| 33489 | If @var{n} is an integer or integer-valued float, this function | 33482 | If @var{n} is an integer or integer-valued float, this function |
| 33490 | returns zero. If @var{n} is a half-integer (i.e., an integer plus | 33483 | returns zero. If @var{n} is a half-integer (i.e., an integer plus |
| 33491 | @i{1:2} or 0.5), it returns 2. If @var{n} is a quarter-integer, | 33484 | @mathit{1:2} or 0.5), it returns 2. If @var{n} is a quarter-integer, |
| 33492 | it returns 1 or 3. If @var{n} is anything else, this function | 33485 | it returns 1 or 3. If @var{n} is anything else, this function |
| 33493 | returns @code{nil}. | 33486 | returns @code{nil}. |
| 33494 | @end defun | 33487 | @end defun |
| @@ -35631,8 +35624,8 @@ input data set. Each entry may be a single value or a vector of values. | |||
| 35631 | @c 20 | 35624 | @c 20 |
| 35632 | @item | 35625 | @item |
| 35633 | With a prefix argument of 1, take a single | 35626 | With a prefix argument of 1, take a single |
| 35634 | @texline @tmath{@var{n}\times2} | 35627 | @texline @var{n}@math{\times2} |
| 35635 | @infoline @i{@var{N}x2} | 35628 | @infoline @mathit{@var{N}x2} |
| 35636 | matrix from the stack instead of two separate data vectors. | 35629 | matrix from the stack instead of two separate data vectors. |
| 35637 | 35630 | ||
| 35638 | @c 21 | 35631 | @c 21 |
| @@ -35834,7 +35827,7 @@ to evaluate variables. | |||
| 35834 | The variable is replaced by the formula shown on the right. The | 35827 | The variable is replaced by the formula shown on the right. The |
| 35835 | Inverse flag reverses the order of the operands, e.g., @kbd{I s - x} | 35828 | Inverse flag reverses the order of the operands, e.g., @kbd{I s - x} |
| 35836 | assigns | 35829 | assigns |
| 35837 | @texline @tmath{x \coloneq a-x}. | 35830 | @texline @math{x \coloneq a-x}. |
| 35838 | @infoline @expr{x := a-x}. | 35831 | @infoline @expr{x := a-x}. |
| 35839 | 35832 | ||
| 35840 | @c 48 | 35833 | @c 48 |
| @@ -35842,7 +35835,7 @@ assigns | |||
| 35842 | Press @kbd{?} repeatedly to see how to choose a model. Answer the | 35835 | Press @kbd{?} repeatedly to see how to choose a model. Answer the |
| 35843 | variables prompt with @expr{iv} or @expr{iv;pv} to specify | 35836 | variables prompt with @expr{iv} or @expr{iv;pv} to specify |
| 35844 | independent and parameter variables. A positive prefix argument | 35837 | independent and parameter variables. A positive prefix argument |
| 35845 | takes @i{@var{n}+1} vectors from the stack; a zero prefix takes a matrix | 35838 | takes @mathit{@var{n}+1} vectors from the stack; a zero prefix takes a matrix |
| 35846 | and a vector from the stack. | 35839 | and a vector from the stack. |
| 35847 | 35840 | ||
| 35848 | @c 49 | 35841 | @c 49 |