diff options
| author | Jay Belanger | 2012-08-01 13:24:13 -0500 |
|---|---|---|
| committer | Jay Belanger | 2012-08-01 13:24:13 -0500 |
| commit | 8e7046c395d80058a8a59525a965ff5c71c76cbc (patch) | |
| tree | ceb48cea6c13a742c066fa401a7e994e4e4f1cbf | |
| parent | 0f6cabdbbb64e0e73a8b2b1a442e1e8a1083c547 (diff) | |
| download | emacs-8e7046c395d80058a8a59525a965ff5c71c76cbc.tar.gz emacs-8e7046c395d80058a8a59525a965ff5c71c76cbc.zip | |
calc.texi (Simplification modes): Mention "basic" simplification.
(The Calc Mode Line): Mention the mode line display for Basic
simplification mode.
(Simplify Formulas): Refer to 'algebraic' rather than 'default'
simplifications.
(Basic Simplifications): Rename from "Limited Simplifications"
Replace "limited" by "basic" throughout.
(Algebraic Simplifications): Indicate that the algebraic
simplifications are done by default.
(Unsafe Simplifications): Mention `m E'.
(Simplification of Units): Mention `m U'.
(Trigonometric/Hyperbolic Functions, Reducing and Mapping,
Kinds of Declarations, Functions for Declarations): Mention
"algebraic simplifications" instead of `a s'.
| -rw-r--r-- | doc/misc/ChangeLog | 17 | ||||
| -rw-r--r-- | doc/misc/calc.texi | 276 |
2 files changed, 156 insertions, 137 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index d0f60c60234..2efb00a4898 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,20 @@ | |||
| 1 | 2012-08-01 Jay Belanger <jay.p.belanger@gmail.com> | ||
| 2 | |||
| 3 | * calc.texi (Simplification modes): Mention "basic" simplification. | ||
| 4 | (The Calc Mode Line): Mention the mode line display for Basic | ||
| 5 | simplification mode. | ||
| 6 | (Simplify Formulas): Refer to 'algebraic' rather than 'default' | ||
| 7 | simplifications. | ||
| 8 | (Basic Simplifications): Rename from "Limited Simplifications" | ||
| 9 | Replace "limited" by "basic" throughout. | ||
| 10 | (Algebraic Simplifications): Indicate that the algebraic | ||
| 11 | simplifications are done by default. | ||
| 12 | (Unsafe Simplifications): Mention `m E'. | ||
| 13 | (Simplification of Units): Mention `m U'. | ||
| 14 | (Trigonometric/Hyperbolic Functions, Reducing and Mapping) | ||
| 15 | (Kinds of Declarations, Functions for Declarations): Mention | ||
| 16 | "algebraic simplifications" instead of `a s'. | ||
| 17 | |||
| 1 | 2012-07-30 Jay Belanger <jay.p.belanger@gmail.com> | 18 | 2012-07-30 Jay Belanger <jay.p.belanger@gmail.com> |
| 2 | 19 | ||
| 3 | * calc.texi (Getting Started, Tutorial): Change simulated | 20 | * calc.texi (Getting Started, Tutorial): Change simulated |
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index 301866ad65c..f36796b180f 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi | |||
| @@ -12569,7 +12569,7 @@ are ``normalized'' when being taken from or pushed onto the stack. | |||
| 12569 | Some normalizations are unavoidable, such as rounding floating-point | 12569 | Some normalizations are unavoidable, such as rounding floating-point |
| 12570 | results to the current precision, and reducing fractions to simplest | 12570 | results to the current precision, and reducing fractions to simplest |
| 12571 | form. Others, such as simplifying a formula like @expr{a+a} (or @expr{2+3}), | 12571 | form. Others, such as simplifying a formula like @expr{a+a} (or @expr{2+3}), |
| 12572 | are done by default but can be turned off when necessary. | 12572 | are done automatically but can be turned off when necessary. |
| 12573 | 12573 | ||
| 12574 | When you press a key like @kbd{+} when @expr{2} and @expr{3} are on the | 12574 | When you press a key like @kbd{+} when @expr{2} and @expr{3} are on the |
| 12575 | stack, Calc pops these numbers, normalizes them, creates the formula | 12575 | stack, Calc pops these numbers, normalizes them, creates the formula |
| @@ -12603,9 +12603,9 @@ A constant is a number or other numeric object (such as a constant | |||
| 12603 | error form or modulo form), or a vector all of whose | 12603 | error form or modulo form), or a vector all of whose |
| 12604 | elements are constant. | 12604 | elements are constant. |
| 12605 | 12605 | ||
| 12606 | @kindex m L | 12606 | @kindex m I |
| 12607 | @pindex calc-limited-simplify-mode | 12607 | @pindex calc-basic-simplify-mode |
| 12608 | The @kbd{m L} (@code{calc-limited-simplify-mode}) command does limited | 12608 | The @kbd{m I} (@code{calc-basic-simplify-mode}) command does some basic |
| 12609 | simplifications for all formulas. This includes many easy and | 12609 | simplifications for all formulas. This includes many easy and |
| 12610 | fast algebraic simplifications such as @expr{a+0} to @expr{a}, and | 12610 | fast algebraic simplifications such as @expr{a+0} to @expr{a}, and |
| 12611 | @expr{a + 2 a} to @expr{3 a}, as well as evaluating functions like | 12611 | @expr{a + 2 a} to @expr{3 a}, as well as evaluating functions like |
| @@ -12620,23 +12620,21 @@ to the current binary word size. @xref{Binary Functions}. Real numbers | |||
| 12620 | are rounded to the nearest integer and then clipped; other kinds of | 12620 | are rounded to the nearest integer and then clipped; other kinds of |
| 12621 | results (after the default simplifications) are left alone. | 12621 | results (after the default simplifications) are left alone. |
| 12622 | 12622 | ||
| 12623 | @kindex m D | 12623 | @kindex m A |
| 12624 | @pindex calc-default-simplify-mode | 12624 | @pindex calc-alg-simplify-mode |
| 12625 | The @kbd{m D} (@code{calc-default-simplify-mode}) mode does standard | 12625 | The @kbd{m A} (@code{calc-alg-simplify-mode}) mode does standard |
| 12626 | algebraic simplifications. @xref{Algebraic Simplifications}. | 12626 | algebraic simplifications. @xref{Algebraic Simplifications}. |
| 12627 | 12627 | ||
| 12628 | @kindex m E | 12628 | @kindex m E |
| 12629 | @pindex calc-ext-simplify-mode | 12629 | @pindex calc-ext-simplify-mode |
| 12630 | The @kbd{m E} (@code{calc-ext-simplify-mode}) mode does ``extended'' | 12630 | The @kbd{m E} (@code{calc-ext-simplify-mode}) mode does ``extended'', or |
| 12631 | algebraic simplification, as by the @kbd{a e} (@code{calc-simplify-extended}) | 12631 | ``unsafe'', algebraic simplification. @xref{Unsafe Simplifications}. |
| 12632 | command. @xref{Unsafe Simplifications}. | ||
| 12633 | 12632 | ||
| 12634 | @kindex m U | 12633 | @kindex m U |
| 12635 | @pindex calc-units-simplify-mode | 12634 | @pindex calc-units-simplify-mode |
| 12636 | The @kbd{m U} (@code{calc-units-simplify-mode}) mode does units | 12635 | The @kbd{m U} (@code{calc-units-simplify-mode}) mode does units |
| 12637 | simplification; it applies the command @kbd{u s} | 12636 | simplification. @xref{Simplification of Units}. These include the |
| 12638 | (@code{calc-simplify-units}), which in turn | 12637 | algebraic simplifications, plus variable names which |
| 12639 | is a superset of @kbd{a s}. In this mode, variable names which | ||
| 12640 | are identifiable as unit names (like @samp{mm} for ``millimeters'') | 12638 | are identifiable as unit names (like @samp{mm} for ``millimeters'') |
| 12641 | are simplified with their unit definitions in mind. | 12639 | are simplified with their unit definitions in mind. |
| 12642 | 12640 | ||
| @@ -12853,8 +12851,8 @@ roots (if any) will be included in the list. | |||
| 12853 | only when certain values are integers (such as @samp{(x^y)^z} | 12851 | only when certain values are integers (such as @samp{(x^y)^z} |
| 12854 | shown above). | 12852 | shown above). |
| 12855 | 12853 | ||
| 12856 | Another command that makes use of declarations is @kbd{a s}, when | 12854 | Calc's algebraic simplifications also make use of declarations when |
| 12857 | simplifying equations and inequalities. It will cancel @code{x} | 12855 | simplifying equations and inequalities. They will cancel @code{x} |
| 12858 | from both sides of @samp{a x = b x} only if it is sure @code{x} | 12856 | from both sides of @samp{a x = b x} only if it is sure @code{x} |
| 12859 | is non-zero, say, because it has a @code{pos} declaration. | 12857 | is non-zero, say, because it has a @code{pos} declaration. |
| 12860 | To declare specifically that @code{x} is real and non-zero, | 12858 | To declare specifically that @code{x} is real and non-zero, |
| @@ -12992,10 +12990,10 @@ i.e., is mathematically equal to a real number times @expr{i}. | |||
| 12992 | The @code{dpos} function checks for positive (but nonzero) reals. | 12990 | The @code{dpos} function checks for positive (but nonzero) reals. |
| 12993 | The @code{dneg} function checks for negative reals. The @code{dnonneg} | 12991 | The @code{dneg} function checks for negative reals. The @code{dnonneg} |
| 12994 | function checks for nonnegative reals, i.e., reals greater than or | 12992 | function checks for nonnegative reals, i.e., reals greater than or |
| 12995 | equal to zero. Note that the @kbd{a s} command can simplify an | 12993 | equal to zero. Note that Calc's algebraic simplifications, which are |
| 12996 | expression like @expr{x > 0} to 1 or 0 using @code{dpos}, and that | 12994 | effectively applied to all conditions in rewrite rules, can simplify |
| 12997 | @kbd{a s} is effectively applied to all conditions in rewrite rules, | 12995 | an expression like @expr{x > 0} to 1 or 0 using @code{dpos}. |
| 12998 | so the actual functions @code{dpos}, @code{dneg}, and @code{dnonneg} | 12996 | So the actual functions @code{dpos}, @code{dneg}, and @code{dnonneg} |
| 12999 | are rarely necessary. | 12997 | are rarely necessary. |
| 13000 | 12998 | ||
| 13001 | @ignore | 12999 | @ignore |
| @@ -13021,7 +13019,7 @@ also the set of objects considered ``true'' in conditional contexts.) | |||
| 13021 | The @code{deven} function returns 1 if its argument is known to be | 13019 | The @code{deven} function returns 1 if its argument is known to be |
| 13022 | an even integer (or integer-valued float); it returns 0 if its argument | 13020 | an even integer (or integer-valued float); it returns 0 if its argument |
| 13023 | is known not to be even (because it is known to be odd or a non-integer). | 13021 | is known not to be even (because it is known to be odd or a non-integer). |
| 13024 | The @kbd{a s} command uses this to simplify a test of the form | 13022 | Calc's algebraic simplifications use this to simplify a test of the form |
| 13025 | @samp{x % 2 = 0}. There is also an analogous @code{dodd} function. | 13023 | @samp{x % 2 = 0}. There is also an analogous @code{dodd} function. |
| 13026 | 13024 | ||
| 13027 | @ignore | 13025 | @ignore |
| @@ -15648,7 +15646,7 @@ The exact sequence of events is as follows: When Calc tries a | |||
| 15648 | rule, it first matches the pattern as usual. It then substitutes | 15646 | rule, it first matches the pattern as usual. It then substitutes |
| 15649 | @samp{#1}, @samp{#2}, etc., in the conditions, if any. Next, the | 15647 | @samp{#1}, @samp{#2}, etc., in the conditions, if any. Next, the |
| 15650 | conditions are simplified and evaluated in order from left to right, | 15648 | conditions are simplified and evaluated in order from left to right, |
| 15651 | as if by the @w{@kbd{a s}} algebra command (@pxref{Simplifying Formulas}). | 15649 | using the algebraic simplifications (@pxref{Simplifying Formulas}). |
| 15652 | Each result is true if it is a nonzero number, or an expression | 15650 | Each result is true if it is a nonzero number, or an expression |
| 15653 | that can be proven to be nonzero (@pxref{Declarations}). If the | 15651 | that can be proven to be nonzero (@pxref{Declarations}). If the |
| 15654 | results of all conditions are true, the expression (such as | 15652 | results of all conditions are true, the expression (such as |
| @@ -15876,8 +15874,8 @@ Default simplifications for numeric arguments only (@kbd{m N}). | |||
| 15876 | @item BinSimp@var{w} | 15874 | @item BinSimp@var{w} |
| 15877 | Binary-integer simplification mode; word size @var{w} (@kbd{m B}, @kbd{b w}). | 15875 | Binary-integer simplification mode; word size @var{w} (@kbd{m B}, @kbd{b w}). |
| 15878 | 15876 | ||
| 15879 | @item LimSimp | 15877 | @item BasicSimp |
| 15880 | Limited simplification mode (@kbd{m L}). | 15878 | Basic simplification mode (@kbd{m I}). |
| 15881 | 15879 | ||
| 15882 | @item ExtSimp | 15880 | @item ExtSimp |
| 15883 | Extended algebraic simplification mode (@kbd{m E}). | 15881 | Extended algebraic simplification mode (@kbd{m E}). |
| @@ -18328,7 +18326,7 @@ reason why changing built-in variables is a bad idea. Arguments of | |||
| 18328 | the form @expr{x} plus a multiple of @cpiover{2} are also simplified. | 18326 | the form @expr{x} plus a multiple of @cpiover{2} are also simplified. |
| 18329 | Calc includes similar formulas for @code{cos} and @code{tan}. | 18327 | Calc includes similar formulas for @code{cos} and @code{tan}. |
| 18330 | 18328 | ||
| 18331 | The @kbd{a s} command knows all angles which are integer multiples of | 18329 | Calc's algebraic simplifications know all angles which are integer multiples of |
| 18332 | @cpiover{12}, @cpiover{10}, or @cpiover{8} radians. In Degrees mode, | 18330 | @cpiover{12}, @cpiover{10}, or @cpiover{8} radians. In Degrees mode, |
| 18333 | analogous simplifications occur for integer multiples of 15 or 18 | 18331 | analogous simplifications occur for integer multiples of 15 or 18 |
| 18334 | degrees, and for arguments plus multiples of 90 degrees. | 18332 | degrees, and for arguments plus multiples of 90 degrees. |
| @@ -22178,9 +22176,9 @@ but which also substitutes stored values for variables in the formula. | |||
| 22178 | Use @kbd{a v} if you want the variables to ignore their stored values. | 22176 | Use @kbd{a v} if you want the variables to ignore their stored values. |
| 22179 | 22177 | ||
| 22180 | If you give a numeric prefix argument of 2 to @kbd{a v}, it simplifies | 22178 | If you give a numeric prefix argument of 2 to @kbd{a v}, it simplifies |
| 22181 | as if in Algebraic Simplification mode. This is equivalent to typing | 22179 | using Calc's algebraic simplifications; @pxref{Simplifying Formulas}. |
| 22182 | @kbd{a s}; @pxref{Simplifying Formulas}. If you give a numeric prefix | 22180 | If you give a numeric prefix of 3 or more, it uses Extended |
| 22183 | of 3 or more, it uses Extended Simplification mode (@kbd{a e}). | 22181 | Simplification mode (@kbd{a e}). |
| 22184 | 22182 | ||
| 22185 | If you give a negative prefix argument @mathit{-1}, @mathit{-2}, or @mathit{-3}, | 22183 | If you give a negative prefix argument @mathit{-1}, @mathit{-2}, or @mathit{-3}, |
| 22186 | it simplifies in the corresponding mode but only works on the top-level | 22184 | it simplifies in the corresponding mode but only works on the top-level |
| @@ -22253,8 +22251,8 @@ If inequalities with opposite direction (e.g., @samp{<} and @samp{>}) | |||
| 22253 | are mapped, the direction of the second inequality is reversed to | 22251 | are mapped, the direction of the second inequality is reversed to |
| 22254 | match the first: Using @kbd{a M +} on @samp{a < b} and @samp{a > 2} | 22252 | match the first: Using @kbd{a M +} on @samp{a < b} and @samp{a > 2} |
| 22255 | reverses the latter to get @samp{2 < a}, which then allows the | 22253 | reverses the latter to get @samp{2 < a}, which then allows the |
| 22256 | combination @samp{a + 2 < b + a}, which the @kbd{a s} command can | 22254 | combination @samp{a + 2 < b + a}, which the algebraic simplifications |
| 22257 | then simplify to get @samp{2 < b}. | 22255 | can reduce to @samp{2 < b}. |
| 22258 | 22256 | ||
| 22259 | Using @kbd{a M *}, @kbd{a M /}, @kbd{a M n}, or @kbd{a M &} to negate | 22257 | Using @kbd{a M *}, @kbd{a M /}, @kbd{a M n}, or @kbd{a M &} to negate |
| 22260 | or invert an inequality will reverse the direction of the inequality. | 22258 | or invert an inequality will reverse the direction of the inequality. |
| @@ -22334,19 +22332,20 @@ and rewrite rules. @xref{Rearranging with Selections}. | |||
| 22334 | @xref{Rewrite Rules}. | 22332 | @xref{Rewrite Rules}. |
| 22335 | 22333 | ||
| 22336 | @xref{Simplification Modes}, for commands to control what level of | 22334 | @xref{Simplification Modes}, for commands to control what level of |
| 22337 | simplification occurs automatically. Normally only the default | 22335 | simplification occurs automatically. Normally the algebraic |
| 22338 | algebraic simplifications occur. If you have turned on a | 22336 | simplifications described below occur. If you have turned on a |
| 22339 | simplification mode which does not do these default simplifications, | 22337 | simplification mode which does not do these algebraic simplifications, |
| 22340 | you can still perform them on a formula with the @kbd{a s} command. | 22338 | you can still apply them to a formula with the @kbd{a s} |
| 22339 | (@code{calc-simplify}) [@code{simplify}] command. | ||
| 22341 | 22340 | ||
| 22342 | There are some simplifications that, while sometimes useful, are never | 22341 | There are some simplifications that, while sometimes useful, are never |
| 22343 | done automatically. For example, the @kbd{I} prefix can be given to | 22342 | done automatically. For example, the @kbd{I} prefix can be given to |
| 22344 | @kbd{a s}; the @kbd{I a s} command will change any trigonometric | 22343 | @kbd{a s}; the @kbd{I a s} command will change any trigonometric |
| 22345 | function to the appropriate combination of @samp{sin}s and @samp{cos}s | 22344 | function to the appropriate combination of @samp{sin}s and @samp{cos}s |
| 22346 | before simplifying. This can be useful in simplifying even mildly | 22345 | before simplifying. This can be useful in simplifying even mildly |
| 22347 | complicated trigonometric expressions. For example, while @kbd{a s} | 22346 | complicated trigonometric expressions. For example, while the algebraic |
| 22348 | can reduce @samp{sin(x) csc(x)} to @samp{1}, it will not simplify | 22347 | simplifications can reduce @samp{sin(x) csc(x)} to @samp{1}, they will not |
| 22349 | @samp{sin(x)^2 csc(x)}. The command @kbd{I a s} can be used to | 22348 | simplify @samp{sin(x)^2 csc(x)}. The command @kbd{I a s} can be used to |
| 22350 | simplify this latter expression; it will transform @samp{sin(x)^2 | 22349 | simplify this latter expression; it will transform @samp{sin(x)^2 |
| 22351 | csc(x)} into @samp{sin(x)}. However, @kbd{I a s} will also perform | 22350 | csc(x)} into @samp{sin(x)}. However, @kbd{I a s} will also perform |
| 22352 | some ``simplifications'' which may not be desired; for example, it | 22351 | some ``simplifications'' which may not be desired; for example, it |
| @@ -22357,21 +22356,22 @@ combinations of @samp{sinh}s and @samp{cosh}s before simplifying. | |||
| 22357 | 22356 | ||
| 22358 | 22357 | ||
| 22359 | @menu | 22358 | @menu |
| 22360 | * Limited Simplifications:: | 22359 | * Basic Simplifications:: |
| 22361 | * Algebraic Simplifications:: | 22360 | * Algebraic Simplifications:: |
| 22362 | * Unsafe Simplifications:: | 22361 | * Unsafe Simplifications:: |
| 22363 | * Simplification of Units:: | 22362 | * Simplification of Units:: |
| 22364 | @end menu | 22363 | @end menu |
| 22365 | 22364 | ||
| 22366 | @node Limited Simplifications, Algebraic Simplifications, Simplifying Formulas, Simplifying Formulas | 22365 | @node Basic Simplifications, Algebraic Simplifications, Simplifying Formulas, Simplifying Formulas |
| 22367 | @subsection Limited Simplifications | 22366 | @subsection Basic Simplifications |
| 22368 | 22367 | ||
| 22369 | @noindent | 22368 | @noindent |
| 22370 | @cindex Limited simplifications | 22369 | @cindex Basic simplifications |
| 22371 | This section describes a limited set of simplifications. These, as | 22370 | This section describes basic simplifications which Calc performs in many |
| 22372 | well as those described in the next section, are normally applied to | 22371 | situations. For example, both binary simplifications and algebraic |
| 22373 | all results. You can type @kbd{m L} to restrict the simplifications | 22372 | simplifications begin by performing these basic simplifications. You |
| 22374 | done on the stack to this limited set. | 22373 | can type @kbd{m I} to restrict the simplifications done on the stack to |
| 22374 | these simplifications. | ||
| 22375 | 22375 | ||
| 22376 | The most basic simplification is the evaluation of functions. | 22376 | The most basic simplification is the evaluation of functions. |
| 22377 | For example, @expr{2 + 3} is evaluated to @expr{5}, and @expr{@tfn{sqrt}(9)} | 22377 | For example, @expr{2 + 3} is evaluated to @expr{5}, and @expr{@tfn{sqrt}(9)} |
| @@ -22391,7 +22391,7 @@ operator) do not evaluate their arguments, @code{if} (the @code{? :} | |||
| 22391 | operator) does not evaluate all of its arguments, and @code{evalto} | 22391 | operator) does not evaluate all of its arguments, and @code{evalto} |
| 22392 | does not evaluate its lefthand argument. | 22392 | does not evaluate its lefthand argument. |
| 22393 | 22393 | ||
| 22394 | Most commands apply at least these limited simplifications to all | 22394 | Most commands apply at least these basic simplifications to all |
| 22395 | arguments they take from the stack, perform a particular operation, | 22395 | arguments they take from the stack, perform a particular operation, |
| 22396 | then simplify the result before pushing it back on the stack. In the | 22396 | then simplify the result before pushing it back on the stack. In the |
| 22397 | common special case of regular arithmetic commands like @kbd{+} and | 22397 | common special case of regular arithmetic commands like @kbd{+} and |
| @@ -22400,7 +22400,7 @@ and collected into a suitable function call, which is then simplified | |||
| 22400 | (the arguments being simplified first as part of the process, as | 22400 | (the arguments being simplified first as part of the process, as |
| 22401 | described above). | 22401 | described above). |
| 22402 | 22402 | ||
| 22403 | Even the limited set of simplifications are too numerous to describe | 22403 | Even the basic set of simplifications are too numerous to describe |
| 22404 | completely here, but this section will describe the ones that apply to the | 22404 | completely here, but this section will describe the ones that apply to the |
| 22405 | major arithmetic operators. This list will be rather technical in | 22405 | major arithmetic operators. This list will be rather technical in |
| 22406 | nature, and will probably be interesting to you only if you are | 22406 | nature, and will probably be interesting to you only if you are |
| @@ -22438,11 +22438,11 @@ commutative law (@expr{a + b} to @expr{b + a}) except in a few | |||
| 22438 | special cases described below. Some algebra programs always | 22438 | special cases described below. Some algebra programs always |
| 22439 | rearrange terms into a canonical order, which enables them to | 22439 | rearrange terms into a canonical order, which enables them to |
| 22440 | see that @expr{a b + b a} can be simplified to @expr{2 a b}. | 22440 | see that @expr{a b + b a} can be simplified to @expr{2 a b}. |
| 22441 | Calc assumes you have put the terms into the order you want | 22441 | If you are using Basic Simplification mode, Calc assumes you have put |
| 22442 | and generally leaves that order alone, with the consequence | 22442 | the terms into the order you want and generally leaves that order alone, |
| 22443 | that formulas like the above will only be simplified if you | 22443 | with the consequence that formulas like the above will only be |
| 22444 | explicitly give the @kbd{a s} command. @xref{Algebraic | 22444 | simplified if you explicitly give the @kbd{a s} command. |
| 22445 | Simplifications}. | 22445 | @xref{Algebraic Simplifications}. |
| 22446 | 22446 | ||
| 22447 | Differences @expr{a - b} are treated like sums @expr{a + (-b)} | 22447 | Differences @expr{a - b} are treated like sums @expr{a + (-b)} |
| 22448 | for purposes of simplification; one of the default simplifications | 22448 | for purposes of simplification; one of the default simplifications |
| @@ -22473,9 +22473,8 @@ for adjacent terms in a larger sum. Thus @expr{a + b + b + c} | |||
| 22473 | is simplified to @expr{a + 2 b + c}, but @expr{a + b + c + b} | 22473 | is simplified to @expr{a + 2 b + c}, but @expr{a + b + c + b} |
| 22474 | is not simplified. The reason is that comparing all terms of a | 22474 | is not simplified. The reason is that comparing all terms of a |
| 22475 | sum with one another would require time proportional to the | 22475 | sum with one another would require time proportional to the |
| 22476 | square of the number of terms; Calc relegates potentially slow | 22476 | square of the number of terms; Calc omits potentially slow |
| 22477 | operations like this to commands that have to be invoked | 22477 | operations like this in basic simplification mode. |
| 22478 | explicitly, like @kbd{a s}. | ||
| 22479 | 22478 | ||
| 22480 | Finally, @expr{a + 0} and @expr{0 + a} are simplified to @expr{a}. | 22479 | Finally, @expr{a + 0} and @expr{0 + a} are simplified to @expr{a}. |
| 22481 | A consequence of the above rules is that @expr{0 - a} is simplified | 22480 | A consequence of the above rules is that @expr{0 - a} is simplified |
| @@ -22672,9 +22671,9 @@ and @expr{b} are known to be real. | |||
| 22672 | 22671 | ||
| 22673 | Functions like @code{sin} and @code{arctan} generally don't have | 22672 | Functions like @code{sin} and @code{arctan} generally don't have |
| 22674 | any default simplifications beyond simply evaluating the functions | 22673 | any default simplifications beyond simply evaluating the functions |
| 22675 | for suitable numeric arguments and infinity. The @kbd{a s} command | 22674 | for suitable numeric arguments and infinity. The algebraic |
| 22676 | described in the next section does provide some simplifications for | 22675 | simplifications described in the next section do provide some |
| 22677 | these functions, though. | 22676 | simplifications for these functions, though. |
| 22678 | 22677 | ||
| 22679 | One important simplification that does occur is that | 22678 | One important simplification that does occur is that |
| 22680 | @expr{@tfn{ln}(@tfn{e})} is simplified to 1, and @expr{@tfn{ln}(@tfn{e}^x)} is | 22679 | @expr{@tfn{ln}(@tfn{e})} is simplified to 1, and @expr{@tfn{ln}(@tfn{e}^x)} is |
| @@ -22689,25 +22688,23 @@ and reversing the inequality. While it might seem reasonable to simplify | |||
| 22689 | @expr{!!x} to @expr{x}, this would not be valid in general because | 22688 | @expr{!!x} to @expr{x}, this would not be valid in general because |
| 22690 | @expr{!!2} is 1, not 2. | 22689 | @expr{!!2} is 1, not 2. |
| 22691 | 22690 | ||
| 22692 | Most other Calc functions have few if any default simplifications | 22691 | Most other Calc functions have few if any basic simplifications |
| 22693 | defined, aside of course from evaluation when the arguments are | 22692 | defined, aside of course from evaluation when the arguments are |
| 22694 | suitable numbers. | 22693 | suitable numbers. |
| 22695 | 22694 | ||
| 22696 | @node Algebraic Simplifications, Unsafe Simplifications, Limited Simplifications, Simplifying Formulas | 22695 | @node Algebraic Simplifications, Unsafe Simplifications, Basic Simplifications, Simplifying Formulas |
| 22697 | @subsection Algebraic Simplifications | 22696 | @subsection Algebraic Simplifications |
| 22698 | 22697 | ||
| 22699 | @noindent | 22698 | @noindent |
| 22700 | @cindex Algebraic simplifications | 22699 | @cindex Algebraic simplifications |
| 22701 | @kindex a s | 22700 | @kindex a s |
| 22702 | @kindex I a s | 22701 | @kindex m A |
| 22703 | @kindex H a s | ||
| 22704 | @pindex calc-simplify | ||
| 22705 | @tindex simplify | ||
| 22706 | This section describes all simplifications that are performed by | 22702 | This section describes all simplifications that are performed by |
| 22707 | the default algebraic simplification mode. If you have switched to a different | 22703 | the algebraic simplification mode, which is the default simplification |
| 22708 | simplification mode, you can switch back with the @kbd{m D} command. | 22704 | mode. If you have switched to a different simplification mode, you can |
| 22709 | Even in other simplification modes, the @kbd{a s} command will use | 22705 | switch back with the @kbd{m A} command. Even in other simplification |
| 22710 | these algebraic simplifications to simplifies the formula. | 22706 | modes, the @kbd{a s} command will use these algebraic simplifications to |
| 22707 | simplify the formula. | ||
| 22711 | 22708 | ||
| 22712 | There is a variable, @code{AlgSimpRules}, in which you can put rewrites | 22709 | There is a variable, @code{AlgSimpRules}, in which you can put rewrites |
| 22713 | to be applied. Its use is analogous to @code{EvalRules}, | 22710 | to be applied. Its use is analogous to @code{EvalRules}, |
| @@ -22715,7 +22712,7 @@ but without the special restrictions. Basically, the simplifier does | |||
| 22715 | @samp{@w{a r} AlgSimpRules} with an infinite repeat count on the whole | 22712 | @samp{@w{a r} AlgSimpRules} with an infinite repeat count on the whole |
| 22716 | expression being simplified, then it traverses the expression applying | 22713 | expression being simplified, then it traverses the expression applying |
| 22717 | the built-in rules described below. If the result is different from | 22714 | the built-in rules described below. If the result is different from |
| 22718 | the original expression, the process repeats with the limited | 22715 | the original expression, the process repeats with the basic |
| 22719 | simplifications (including @code{EvalRules}), then @code{AlgSimpRules}, | 22716 | simplifications (including @code{EvalRules}), then @code{AlgSimpRules}, |
| 22720 | then the built-in simplifications, and so on. | 22717 | then the built-in simplifications, and so on. |
| 22721 | 22718 | ||
| @@ -22731,8 +22728,8 @@ commuted to @expr{-x + 2}. | |||
| 22731 | 22728 | ||
| 22732 | Also, terms of sums are combined by the distributive law, as in | 22729 | Also, terms of sums are combined by the distributive law, as in |
| 22733 | @expr{x + y + 2 x} to @expr{y + 3 x}. This always occurs for | 22730 | @expr{x + y + 2 x} to @expr{y + 3 x}. This always occurs for |
| 22734 | adjacent terms, but @kbd{a s} compares all pairs of terms including | 22731 | adjacent terms, but Calc's algebraic simplifications compare all pairs |
| 22735 | non-adjacent ones. | 22732 | of terms including non-adjacent ones. |
| 22736 | 22733 | ||
| 22737 | @tex | 22734 | @tex |
| 22738 | \bigskip | 22735 | \bigskip |
| @@ -22935,21 +22932,26 @@ as is @expr{x^2 >= 0} if @expr{x} is known to be real. | |||
| 22935 | @cindex Unsafe simplifications | 22932 | @cindex Unsafe simplifications |
| 22936 | @cindex Extended simplification | 22933 | @cindex Extended simplification |
| 22937 | @kindex a e | 22934 | @kindex a e |
| 22935 | @kindex m E | ||
| 22938 | @pindex calc-simplify-extended | 22936 | @pindex calc-simplify-extended |
| 22939 | @ignore | 22937 | @ignore |
| 22940 | @mindex esimpl@idots | 22938 | @mindex esimpl@idots |
| 22941 | @end ignore | 22939 | @end ignore |
| 22942 | @tindex esimplify | 22940 | @tindex esimplify |
| 22943 | The @kbd{a e} (@code{calc-simplify-extended}) [@code{esimplify}] command | 22941 | Calc is capable of performing some simplifications which may sometimes |
| 22944 | is like @kbd{a s} | 22942 | be desired but which are not ``safe'' in all cases. The @kbd{a e} |
| 22945 | except that it applies some additional simplifications which are not | 22943 | (@code{calc-simplify-extended}) [@code{esimplify}] command |
| 22946 | ``safe'' in all cases. Use this only if you know the values in your | 22944 | applies the algebraic simplifications as well as these extended, or |
| 22947 | formula lie in the restricted ranges for which these simplifications | 22945 | ``unsafe'', simplifications. Use this only if you know the values in |
| 22948 | are valid. The symbolic integrator uses @kbd{a e}; | 22946 | your formula lie in the restricted ranges for which these |
| 22949 | one effect of this is that the integrator's results must be used with | 22947 | simplifications are valid. You can use Extended Simplification mode |
| 22950 | caution. Where an integral table will often attach conditions like | 22948 | (@kbd{m E}) to have these simplifications done automatically. |
| 22951 | ``for positive @expr{a} only,'' Calc (like most other symbolic | 22949 | |
| 22952 | integration programs) will simply produce an unqualified result. | 22950 | The symbolic integrator uses these extended simplifications; one effect |
| 22951 | of this is that the integrator's results must be used with caution. | ||
| 22952 | Where an integral table will often attach conditions like ``for positive | ||
| 22953 | @expr{a} only,'' Calc (like most other symbolic integration programs) | ||
| 22954 | will simply produce an unqualified result. | ||
| 22953 | 22955 | ||
| 22954 | Because @kbd{a e}'s simplifications are unsafe, it is sometimes better | 22956 | Because @kbd{a e}'s simplifications are unsafe, it is sometimes better |
| 22955 | to type @kbd{C-u -3 a v}, which does extended simplification only | 22957 | to type @kbd{C-u -3 a v}, which does extended simplification only |
| @@ -22957,21 +22959,20 @@ on the top level of the formula without affecting the sub-formulas. | |||
| 22957 | In fact, @kbd{C-u -3 j v} allows you to target extended simplification | 22959 | In fact, @kbd{C-u -3 j v} allows you to target extended simplification |
| 22958 | to any specific part of a formula. | 22960 | to any specific part of a formula. |
| 22959 | 22961 | ||
| 22960 | The variable @code{ExtSimpRules} contains rewrites to be applied by | 22962 | The variable @code{ExtSimpRules} contains rewrites to be applied when |
| 22961 | the @kbd{a e} command. These are applied in addition to | 22963 | the extended simplifications are used. These are applied in addition to |
| 22962 | @code{EvalRules} and @code{AlgSimpRules}. (The @kbd{a r AlgSimpRules} | 22964 | @code{EvalRules} and @code{AlgSimpRules}. (The @kbd{a r AlgSimpRules} |
| 22963 | step described above is simply followed by an @kbd{a r ExtSimpRules} step.) | 22965 | step described above is simply followed by an @kbd{a r ExtSimpRules} step.) |
| 22964 | 22966 | ||
| 22965 | Following is a complete list of ``unsafe'' simplifications performed | 22967 | Following is a complete list of the ``unsafe'' simplifications. |
| 22966 | by @kbd{a e}. | ||
| 22967 | 22968 | ||
| 22968 | @tex | 22969 | @tex |
| 22969 | \bigskip | 22970 | \bigskip |
| 22970 | @end tex | 22971 | @end tex |
| 22971 | 22972 | ||
| 22972 | Inverse trigonometric or hyperbolic functions, called with their | 22973 | Inverse trigonometric or hyperbolic functions, called with their |
| 22973 | corresponding non-inverse functions as arguments, are simplified | 22974 | corresponding non-inverse functions as arguments, are simplified. |
| 22974 | by @kbd{a e}. For example, @expr{@tfn{arcsin}(@tfn{sin}(x))} changes | 22975 | For example, @expr{@tfn{arcsin}(@tfn{sin}(x))} changes |
| 22975 | to @expr{x}. Also, @expr{@tfn{arcsin}(@tfn{cos}(x))} and | 22976 | to @expr{x}. Also, @expr{@tfn{arcsin}(@tfn{cos}(x))} and |
| 22976 | @expr{@tfn{arccos}(@tfn{sin}(x))} both change to @expr{@tfn{pi}/2 - x}. | 22977 | @expr{@tfn{arccos}(@tfn{sin}(x))} both change to @expr{@tfn{pi}/2 - x}. |
| 22977 | These simplifications are unsafe because they are valid only for | 22978 | These simplifications are unsafe because they are valid only for |
| @@ -23011,8 +23012,8 @@ simplifications are safe if @expr{x} is known to be real). | |||
| 23011 | Common factors are canceled from products on both sides of an | 23012 | Common factors are canceled from products on both sides of an |
| 23012 | equation, even if those factors may be zero: @expr{a x / b x} | 23013 | equation, even if those factors may be zero: @expr{a x / b x} |
| 23013 | to @expr{a / b}. Such factors are never canceled from | 23014 | to @expr{a / b}. Such factors are never canceled from |
| 23014 | inequalities: Even @kbd{a e} is not bold enough to reduce | 23015 | inequalities: Even the extended simplifications are not bold enough to |
| 23015 | @expr{a x < b x} to @expr{a < b} (or @expr{a > b}, depending | 23016 | reduce @expr{a x < b x} to @expr{a < b} (or @expr{a > b}, depending |
| 23016 | on whether you believe @expr{x} is positive or negative). | 23017 | on whether you believe @expr{x} is positive or negative). |
| 23017 | The @kbd{a M /} command can be used to divide a factor out of | 23018 | The @kbd{a M /} command can be used to divide a factor out of |
| 23018 | both sides of an inequality. | 23019 | both sides of an inequality. |
| @@ -23021,13 +23022,14 @@ both sides of an inequality. | |||
| 23021 | @subsection Simplification of Units | 23022 | @subsection Simplification of Units |
| 23022 | 23023 | ||
| 23023 | @noindent | 23024 | @noindent |
| 23024 | The simplifications described in this section are applied by the | 23025 | The simplifications described in this section (as well as the algebraic |
| 23025 | @kbd{u s} (@code{calc-simplify-units}) command. These are in addition | 23026 | simplifications) are applied when units need to be simplified. They can |
| 23026 | to the regular @kbd{a s} (but not @kbd{a e}) simplifications described | 23027 | be applied using the @kbd{u s} (@code{calc-simplify-units}) command, or |
| 23027 | earlier. @xref{Basic Operations on Units}. | 23028 | will be done automatically in Units Simplification mode (@kbd{m U}). |
| 23029 | @xref{Basic Operations on Units}. | ||
| 23028 | 23030 | ||
| 23029 | The variable @code{UnitSimpRules} contains rewrites to be applied by | 23031 | The variable @code{UnitSimpRules} contains rewrites to be applied by |
| 23030 | the @kbd{u s} command. These are applied in addition to @code{EvalRules} | 23032 | units simplifications. These are applied in addition to @code{EvalRules} |
| 23031 | and @code{AlgSimpRules}. | 23033 | and @code{AlgSimpRules}. |
| 23032 | 23034 | ||
| 23033 | Scalar mode is automatically put into effect when simplifying units. | 23035 | Scalar mode is automatically put into effect when simplifying units. |
| @@ -23581,10 +23583,11 @@ forever!) | |||
| 23581 | 23583 | ||
| 23582 | @vindex IntegSimpRules | 23584 | @vindex IntegSimpRules |
| 23583 | Another set of rules, stored in @code{IntegSimpRules}, are applied | 23585 | Another set of rules, stored in @code{IntegSimpRules}, are applied |
| 23584 | every time the integrator uses @kbd{a s} to simplify an intermediate | 23586 | every time the integrator uses algebraic simplifications to simplify an |
| 23585 | result. For example, putting the rule @samp{twice(x) := 2 x} into | 23587 | intermediate result. For example, putting the rule |
| 23586 | @code{IntegSimpRules} would tell Calc to convert the @code{twice} | 23588 | @samp{twice(x) := 2 x} into @code{IntegSimpRules} would tell Calc to |
| 23587 | function into a form it knows whenever integration is attempted. | 23589 | convert the @code{twice} function into a form it knows whenever |
| 23590 | integration is attempted. | ||
| 23588 | 23591 | ||
| 23589 | One more way to influence the integrator is to define a function with | 23592 | One more way to influence the integrator is to define a function with |
| 23590 | the @kbd{Z F} command (@pxref{Algebraic Definitions}). Calc's | 23593 | the @kbd{Z F} command (@pxref{Algebraic Definitions}). Calc's |
| @@ -23602,8 +23605,8 @@ above to try to hint at a more direct path to the desired result, or | |||
| 23602 | you can use @code{IntegAfterRules}. This is an extra rule set that | 23605 | you can use @code{IntegAfterRules}. This is an extra rule set that |
| 23603 | runs after the main integrator returns its result; basically, Calc does | 23606 | runs after the main integrator returns its result; basically, Calc does |
| 23604 | an @kbd{a r IntegAfterRules} on the result before showing it to you. | 23607 | an @kbd{a r IntegAfterRules} on the result before showing it to you. |
| 23605 | (It also does an @kbd{a s}, without @code{IntegSimpRules}, after that | 23608 | (It also does algebraic simplifications, without @code{IntegSimpRules}, |
| 23606 | to further simplify the result.) For example, Calc's integrator | 23609 | after that to further simplify the result.) For example, Calc's integrator |
| 23607 | sometimes produces expressions of the form @samp{ln(1+x) - ln(1-x)}; | 23610 | sometimes produces expressions of the form @samp{ln(1+x) - ln(1-x)}; |
| 23608 | the default @code{IntegAfterRules} rewrite this into the more readable | 23611 | the default @code{IntegAfterRules} rewrite this into the more readable |
| 23609 | form @samp{2 arctanh(x)}. Note that, unlike @code{IntegRules}, | 23612 | form @samp{2 arctanh(x)}. Note that, unlike @code{IntegRules}, |
| @@ -25414,7 +25417,7 @@ The limits of a sum do not need to be integers. For example, | |||
| 25414 | @samp{sum(a_k, k, 0, 2 n, n)} produces @samp{a_0 + a_n + a_(2 n)}. | 25417 | @samp{sum(a_k, k, 0, 2 n, n)} produces @samp{a_0 + a_n + a_(2 n)}. |
| 25415 | Calc computes the number of iterations using the formula | 25418 | Calc computes the number of iterations using the formula |
| 25416 | @samp{1 + (@var{high} - @var{low}) / @var{step}}, which must, | 25419 | @samp{1 + (@var{high} - @var{low}) / @var{step}}, which must, |
| 25417 | after simplification as if by @kbd{a s}, evaluate to an integer. | 25420 | after algebraic simplification, evaluate to an integer. |
| 25418 | 25421 | ||
| 25419 | If the number of iterations according to the above formula does | 25422 | If the number of iterations according to the above formula does |
| 25420 | not come out to an integer, the sum is invalid and will be left | 25423 | not come out to an integer, the sum is invalid and will be left |
| @@ -26038,7 +26041,7 @@ rule, this is an additional condition that must be satisfied before | |||
| 26038 | the rule is accepted. Once @var{old} has been successfully matched | 26041 | the rule is accepted. Once @var{old} has been successfully matched |
| 26039 | to the target expression, @var{cond} is evaluated (with all the | 26042 | to the target expression, @var{cond} is evaluated (with all the |
| 26040 | meta-variables substituted for the values they matched) and simplified | 26043 | meta-variables substituted for the values they matched) and simplified |
| 26041 | with @kbd{a s} (@code{calc-simplify}). If the result is a nonzero | 26044 | with Calc's algebraic simplifications. If the result is a nonzero |
| 26042 | number or any other object known to be nonzero (@pxref{Declarations}), | 26045 | number or any other object known to be nonzero (@pxref{Declarations}), |
| 26043 | the rule is accepted. If the result is zero or if it is a symbolic | 26046 | the rule is accepted. If the result is zero or if it is a symbolic |
| 26044 | formula that is not known to be nonzero, the rule is rejected. | 26047 | formula that is not known to be nonzero, the rule is rejected. |
| @@ -26718,7 +26721,7 @@ whereas @samp{eval(cons(2+3, []))} will be converted to @samp{[5]}. | |||
| 26718 | @end ignore | 26721 | @end ignore |
| 26719 | @tindex evalsimp | 26722 | @tindex evalsimp |
| 26720 | The formula @expr{x} has meta-variables substituted in the usual | 26723 | The formula @expr{x} has meta-variables substituted in the usual |
| 26721 | way, then algebraically simplified as if by the @kbd{a s} command. | 26724 | way, then algebraically simplified. |
| 26722 | 26725 | ||
| 26723 | @item evalextsimp(x) | 26726 | @item evalextsimp(x) |
| 26724 | @ignore | 26727 | @ignore |
| @@ -26741,15 +26744,15 @@ There are also some special functions you can use in conditions. | |||
| 26741 | @end ignore | 26744 | @end ignore |
| 26742 | @tindex let | 26745 | @tindex let |
| 26743 | The expression @expr{x} is evaluated with meta-variables substituted. | 26746 | The expression @expr{x} is evaluated with meta-variables substituted. |
| 26744 | The @kbd{a s} command's simplifications are @emph{not} applied by | 26747 | The algebraic simplifications are @emph{not} applied by |
| 26745 | default, but @expr{x} can include calls to @code{evalsimp} or | 26748 | default, but @expr{x} can include calls to @code{evalsimp} or |
| 26746 | @code{evalextsimp} as described above to invoke higher levels | 26749 | @code{evalextsimp} as described above to invoke higher levels |
| 26747 | of simplification. The | 26750 | of simplification. The result of @expr{x} is then bound to the |
| 26748 | result of @expr{x} is then bound to the meta-variable @expr{v}. As | 26751 | meta-variable @expr{v}. As usual, if this meta-variable has already |
| 26749 | usual, if this meta-variable has already been matched to something | 26752 | been matched to something else the two values must be equal; if the |
| 26750 | else the two values must be equal; if the meta-variable is new then | 26753 | meta-variable is new then it is bound to the result of the expression. |
| 26751 | it is bound to the result of the expression. This variable can then | 26754 | This variable can then appear in later conditions, and on the righthand |
| 26752 | appear in later conditions, and on the righthand side of the rule. | 26755 | side of the rule. |
| 26753 | In fact, @expr{v} may be any pattern in which case the result of | 26756 | In fact, @expr{v} may be any pattern in which case the result of |
| 26754 | evaluating @expr{x} is matched to that pattern, binding any | 26757 | evaluating @expr{x} is matched to that pattern, binding any |
| 26755 | meta-variables that appear in that pattern. Note that @code{let} | 26758 | meta-variables that appear in that pattern. Note that @code{let} |
| @@ -27499,17 +27502,19 @@ with @code{apply} as the top-level pattern must be tested against | |||
| 27499 | @cindex @code{AlgSimpRules} variable | 27502 | @cindex @code{AlgSimpRules} variable |
| 27500 | @vindex AlgSimpRules | 27503 | @vindex AlgSimpRules |
| 27501 | Suppose you want @samp{sin(a + b)} to be expanded out not all the time, | 27504 | Suppose you want @samp{sin(a + b)} to be expanded out not all the time, |
| 27502 | but only when @kbd{a s} is used to simplify the formula. The variable | 27505 | but only when algebraic simplifications are used to simplify the |
| 27503 | @code{AlgSimpRules} holds rules for this purpose. The @kbd{a s} command | 27506 | formula. The variable @code{AlgSimpRules} holds rules for this purpose. |
| 27504 | will apply @code{EvalRules} and @code{AlgSimpRules} to the formula, as | 27507 | The @kbd{a s} command will apply @code{EvalRules} and |
| 27505 | well as all of its built-in simplifications. | 27508 | @code{AlgSimpRules} to the formula, as well as all of its built-in |
| 27509 | simplifications. | ||
| 27506 | 27510 | ||
| 27507 | Most of the special limitations for @code{EvalRules} don't apply to | 27511 | Most of the special limitations for @code{EvalRules} don't apply to |
| 27508 | @code{AlgSimpRules}. Calc simply does an @kbd{a r AlgSimpRules} | 27512 | @code{AlgSimpRules}. Calc simply does an @kbd{a r AlgSimpRules} |
| 27509 | command with an infinite repeat count as the first step of @kbd{a s}. | 27513 | command with an infinite repeat count as the first step of algebraic |
| 27510 | It then applies its own built-in simplifications throughout the | 27514 | simplifications. It then applies its own built-in simplifications |
| 27511 | formula, and then repeats these two steps (along with applying the | 27515 | throughout the formula, and then repeats these two steps (along with |
| 27512 | default simplifications) until no further changes are possible. | 27516 | applying the default simplifications) until no further changes are |
| 27517 | possible. | ||
| 27513 | 27518 | ||
| 27514 | @cindex @code{ExtSimpRules} variable | 27519 | @cindex @code{ExtSimpRules} variable |
| 27515 | @cindex @code{UnitSimpRules} variable | 27520 | @cindex @code{UnitSimpRules} variable |
| @@ -27689,7 +27694,7 @@ to hit the apostrophe key every time you wish to enter units. | |||
| 27689 | @tindex usimplify | 27694 | @tindex usimplify |
| 27690 | The @kbd{u s} (@code{calc-simplify-units}) [@code{usimplify}] command | 27695 | The @kbd{u s} (@code{calc-simplify-units}) [@code{usimplify}] command |
| 27691 | simplifies a units | 27696 | simplifies a units |
| 27692 | expression. It uses @kbd{a s} (@code{calc-simplify}) to simplify the | 27697 | expression. It uses Calc's algebraic simplifications to simplify the |
| 27693 | expression first as a regular algebraic formula; it then looks for | 27698 | expression first as a regular algebraic formula; it then looks for |
| 27694 | features that can be further simplified by converting one object's units | 27699 | features that can be further simplified by converting one object's units |
| 27695 | to be compatible with another's. For example, @samp{5 m + 23 mm} will | 27700 | to be compatible with another's. For example, @samp{5 m + 23 mm} will |
| @@ -28773,7 +28778,7 @@ Edit @code{AlgSimpRules}. @xref{Algebraic Simplifications}. | |||
| 28773 | @item s D | 28778 | @item s D |
| 28774 | Edit @code{Decls}. @xref{Declarations}. | 28779 | Edit @code{Decls}. @xref{Declarations}. |
| 28775 | @item s E | 28780 | @item s E |
| 28776 | Edit @code{EvalRules}. @xref{Limited Simplifications}. | 28781 | Edit @code{EvalRules}. @xref{Basic Simplifications}. |
| 28777 | @item s F | 28782 | @item s F |
| 28778 | Edit @code{FitRules}. @xref{Curve Fitting}. | 28783 | Edit @code{FitRules}. @xref{Curve Fitting}. |
| 28779 | @item s G | 28784 | @item s G |
| @@ -28943,19 +28948,16 @@ to select the lefthand side, execute your commands, then type | |||
| 28943 | 28948 | ||
| 28944 | All current modes apply when an @samp{=>} operator is computed, | 28949 | All current modes apply when an @samp{=>} operator is computed, |
| 28945 | including the current simplification mode. Recall that the | 28950 | including the current simplification mode. Recall that the |
| 28946 | formula @samp{x + y + x} is not handled by Calc's default | 28951 | formula @samp{arcsin(sin(x))} will not be handled by Calc's algebraic |
| 28947 | simplifications, but the @kbd{a s} command will reduce it to | 28952 | simplifications, but Calc's unsafe simplifications will reduce it to |
| 28948 | the simpler form @samp{y + 2 x}. You can also type @kbd{m A} | 28953 | @samp{x}. If you enter @samp{arcsin(sin(x)) =>} normally, the result |
| 28949 | to enable an Algebraic Simplification mode in which the | 28954 | will be @samp{arcsin(sin(x)) => arcsin(sin(x))}. If you change to |
| 28950 | equivalent of @kbd{a s} is used on all of Calc's results. | 28955 | Extended Simplification mode, the result will be |
| 28951 | If you enter @samp{x + y + x =>} normally, the result will | 28956 | @samp{arcsin(sin(x)) => x}. However, just pressing @kbd{a e} |
| 28952 | be @samp{x + y + x => x + y + x}. If you change to | 28957 | once will have no effect on @samp{arcsin(sin(x)) => arcsin(sin(x))}, |
| 28953 | Algebraic Simplification mode, the result will be | ||
| 28954 | @samp{x + y + x => y + 2 x}. However, just pressing @kbd{a s} | ||
| 28955 | once will have no effect on @samp{x + y + x => x + y + x}, | ||
| 28956 | because the righthand side depends only on the lefthand side | 28958 | because the righthand side depends only on the lefthand side |
| 28957 | and the current mode settings, and the lefthand side is not | 28959 | and the current mode settings, and the lefthand side is not |
| 28958 | affected by commands like @kbd{a s}. | 28960 | affected by commands like @kbd{a e}. |
| 28959 | 28961 | ||
| 28960 | The ``let'' command (@kbd{s l}) has an interesting interaction | 28962 | The ``let'' command (@kbd{s l}) has an interesting interaction |
| 28961 | with the @samp{=>} operator. The @kbd{s l} command evaluates the | 28963 | with the @samp{=>} operator. The @kbd{s l} command evaluates the |
| @@ -33756,8 +33758,9 @@ will be the same as @code{lessp}. But whereas @code{lessp} considers | |||
| 33756 | other types of objects to be unordered, @code{beforep} puts any two | 33758 | other types of objects to be unordered, @code{beforep} puts any two |
| 33757 | objects into a definite, consistent order. The @code{beforep} | 33759 | objects into a definite, consistent order. The @code{beforep} |
| 33758 | function is used by the @kbd{V S} vector-sorting command, and also | 33760 | function is used by the @kbd{V S} vector-sorting command, and also |
| 33759 | by @kbd{a s} to put the terms of a product into canonical order: | 33761 | by Calc's algebraic simplifications to put the terms of a product into |
| 33760 | This allows @samp{x y + y x} to be simplified easily to @samp{2 x y}. | 33762 | canonical order: This allows @samp{x y + y x} to be simplified easily to |
| 33763 | @samp{2 x y}. | ||
| 33761 | @end defun | 33764 | @end defun |
| 33762 | 33765 | ||
| 33763 | @defun equal x y | 33766 | @defun equal x y |
| @@ -34426,10 +34429,9 @@ sub-formula that is @code{eq} to @var{old} replaced by @var{new}. | |||
| 34426 | @end defun | 34429 | @end defun |
| 34427 | 34430 | ||
| 34428 | @defun simplify expr | 34431 | @defun simplify expr |
| 34429 | Simplify the expression @var{expr} by applying various algebraic rules. | 34432 | Simplify the expression @var{expr} by applying Calc's algebraic |
| 34430 | This is what the @w{@kbd{a s}} (@code{calc-simplify}) command uses. This | 34433 | simplifications. This always returns a copy of the expression; the |
| 34431 | always returns a copy of the expression; the structure @var{expr} points | 34434 | structure @var{expr} points to remains unchanged in memory. |
| 34432 | to remains unchanged in memory. | ||
| 34433 | 34435 | ||
| 34434 | More precisely, here is what @code{simplify} does: The expression is | 34436 | More precisely, here is what @code{simplify} does: The expression is |
| 34435 | first normalized and evaluated by calling @code{normalize}. If any | 34437 | first normalized and evaluated by calling @code{normalize}. If any |
| @@ -36562,7 +36564,7 @@ A plain @kbd{C-u} prefix means to prompt for the step size. | |||
| 36562 | @c 7 | 36564 | @c 7 |
| 36563 | @item | 36565 | @item |
| 36564 | A prefix argument specifies simplification level and depth. | 36566 | A prefix argument specifies simplification level and depth. |
| 36565 | 1=Default, 2=like @kbd{a s}, 3=like @kbd{a e}. | 36567 | 1=Basic simplifications, 2=Algebraic simplifications, 3=Extended simplifications |
| 36566 | 36568 | ||
| 36567 | @c 8 | 36569 | @c 8 |
| 36568 | @item | 36570 | @item |