diff options
| author | Jay Belanger | 2009-08-27 13:36:19 +0000 |
|---|---|---|
| committer | Jay Belanger | 2009-08-27 13:36:19 +0000 |
| commit | 0ff2d6c28efa369ae227c5f35bc2f22eef0f5a60 (patch) | |
| tree | 0ce5e3f31caae62afed2b49eb693ec2cd6406258 /doc | |
| parent | 550c8289fd72b5bff091ce1c2f9c6567215a8994 (diff) | |
| download | emacs-0ff2d6c28efa369ae227c5f35bc2f22eef0f5a60.tar.gz emacs-0ff2d6c28efa369ae227c5f35bc2f22eef0f5a60.zip | |
(Rewrite Rules): Improve the example.
(Simplifying Formulas): Explain use of the I and H flags for simplification.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/misc/ChangeLog | 6 | ||||
| -rw-r--r-- | doc/misc/calc.texi | 43 |
2 files changed, 37 insertions, 12 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 4601f3d9de2..0b07c43a408 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2009-08-27 Jay Belanger <jay.p.belanger@gmail.com> | ||
| 2 | |||
| 3 | * calc.texi (Rewrite Rules): Improve the example. | ||
| 4 | (Simplifying Formulas): Explain use of the I and H flags for | ||
| 5 | simplification. | ||
| 6 | |||
| 1 | 2009-08-25 Michael Albinus <michael.albinus@gmx.de> | 7 | 2009-08-25 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 8 | ||
| 3 | * dbus.texi (Bus names): Add optional parameter TIMEOUT to dbus-ping. | 9 | * dbus.texi (Bus names): Add optional parameter TIMEOUT to dbus-ping. |
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index 49a5260af6c..f56c0b8c27b 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi | |||
| @@ -5287,25 +5287,25 @@ Suppose we want to simplify this trigonometric formula: | |||
| 5287 | 5287 | ||
| 5288 | @smallexample | 5288 | @smallexample |
| 5289 | @group | 5289 | @group |
| 5290 | 1: 1 / cos(x) - sin(x) tan(x) | 5290 | 1: 2 / cos(x)^2 - 2 tan(x)^2 |
| 5291 | . | 5291 | . |
| 5292 | 5292 | ||
| 5293 | ' 1/cos(x) - sin(x) tan(x) @key{RET} s 1 | 5293 | ' 2/cos(x)^2 - 2tan(x)^2 @key{RET} s 1 |
| 5294 | @end group | 5294 | @end group |
| 5295 | @end smallexample | 5295 | @end smallexample |
| 5296 | 5296 | ||
| 5297 | @noindent | 5297 | @noindent |
| 5298 | If we were simplifying this by hand, we'd probably replace the | 5298 | If we were simplifying this by hand, we'd probably replace the |
| 5299 | @samp{tan} with a @samp{sin/cos} first, then combine over a common | 5299 | @samp{tan} with a @samp{sin/cos} first, then combine over a common |
| 5300 | denominator. There is no Calc command to do the former; the @kbd{a n} | 5300 | denominator. The @kbd{I a s} command will do the former and the @kbd{a n} |
| 5301 | algebra command will do the latter but we'll do both with rewrite | 5301 | algebra command will do the latter, but we'll do both with rewrite |
| 5302 | rules just for practice. | 5302 | rules just for practice. |
| 5303 | 5303 | ||
| 5304 | Rewrite rules are written with the @samp{:=} symbol. | 5304 | Rewrite rules are written with the @samp{:=} symbol. |
| 5305 | 5305 | ||
| 5306 | @smallexample | 5306 | @smallexample |
| 5307 | @group | 5307 | @group |
| 5308 | 1: 1 / cos(x) - sin(x)^2 / cos(x) | 5308 | 1: 2 / cos(x)^2 - 2 sin(x)^2 / cos(x)^2 |
| 5309 | . | 5309 | . |
| 5310 | 5310 | ||
| 5311 | a r tan(a) := sin(a)/cos(a) @key{RET} | 5311 | a r tan(a) := sin(a)/cos(a) @key{RET} |
| @@ -5335,7 +5335,7 @@ To merge over a common denominator, we can use another simple rule: | |||
| 5335 | 5335 | ||
| 5336 | @smallexample | 5336 | @smallexample |
| 5337 | @group | 5337 | @group |
| 5338 | 1: (1 - sin(x)^2) / cos(x) | 5338 | 1: (2 - 2 sin(x)^2) / cos(x)^2 |
| 5339 | . | 5339 | . |
| 5340 | 5340 | ||
| 5341 | a r a/x + b/x := (a+b)/x @key{RET} | 5341 | a r a/x + b/x := (a+b)/x @key{RET} |
| @@ -5350,13 +5350,13 @@ denominators. | |||
| 5350 | 5350 | ||
| 5351 | Second, meta-variable names are independent from variables in the | 5351 | Second, meta-variable names are independent from variables in the |
| 5352 | target formula. Notice that the meta-variable @samp{x} here matches | 5352 | target formula. Notice that the meta-variable @samp{x} here matches |
| 5353 | the subformula @samp{cos(x)}; Calc never confuses the two meanings of | 5353 | the subformula @samp{cos(x)^2}; Calc never confuses the two meanings of |
| 5354 | @samp{x}. | 5354 | @samp{x}. |
| 5355 | 5355 | ||
| 5356 | And third, rewrite patterns know a little bit about the algebraic | 5356 | And third, rewrite patterns know a little bit about the algebraic |
| 5357 | properties of formulas. The pattern called for a sum of two quotients; | 5357 | properties of formulas. The pattern called for a sum of two quotients; |
| 5358 | Calc was able to match a difference of two quotients by matching | 5358 | Calc was able to match a difference of two quotients by matching |
| 5359 | @samp{a = 1}, @samp{b = -sin(x)^2}, and @samp{x = cos(x)}. | 5359 | @samp{a = 2}, @samp{b = -2 sin(x)^2}, and @samp{x = cos(x)^2}. |
| 5360 | 5360 | ||
| 5361 | @c [fix-ref Algebraic Properties of Rewrite Rules] | 5361 | @c [fix-ref Algebraic Properties of Rewrite Rules] |
| 5362 | We could just as easily have written @samp{a/x - b/x := (a-b)/x} for | 5362 | We could just as easily have written @samp{a/x - b/x := (a-b)/x} for |
| @@ -5368,15 +5368,15 @@ of Rewrite Rules}, for some examples of this.) | |||
| 5368 | One more rewrite will complete the job. We want to use the identity | 5368 | One more rewrite will complete the job. We want to use the identity |
| 5369 | @samp{sin(x)^2 + cos(x)^2 = 1}, but of course we must first rearrange | 5369 | @samp{sin(x)^2 + cos(x)^2 = 1}, but of course we must first rearrange |
| 5370 | the identity in a way that matches our formula. The obvious rule | 5370 | the identity in a way that matches our formula. The obvious rule |
| 5371 | would be @samp{@w{1 - sin(x)^2} := cos(x)^2}, but a little thought shows | 5371 | would be @samp{@w{2 - 2 sin(x)^2} := 2 cos(x)^2}, but a little thought shows |
| 5372 | that the rule @samp{sin(x)^2 := 1 - cos(x)^2} will also work. The | 5372 | that the rule @samp{sin(x)^2 := 1 - cos(x)^2} will also work. The |
| 5373 | latter rule has a more general pattern so it will work in many other | 5373 | latter rule has a more general pattern so it will work in many other |
| 5374 | situations, too. | 5374 | situations, too. |
| 5375 | 5375 | ||
| 5376 | @smallexample | 5376 | @smallexample |
| 5377 | @group | 5377 | @group |
| 5378 | 1: (1 + cos(x)^2 - 1) / cos(x) 1: cos(x) | 5378 | 1: (2 + 2 cos(x)^2 - 2) / cos(x)^2 1: 2 |
| 5379 | . . | 5379 | . . |
| 5380 | 5380 | ||
| 5381 | a r sin(x)^2 := 1 - cos(x)^2 @key{RET} a s | 5381 | a r sin(x)^2 := 1 - cos(x)^2 @key{RET} a s |
| 5382 | @end group | 5382 | @end group |
| @@ -5397,7 +5397,7 @@ having to retype it. | |||
| 5397 | ' a/x + b/x := (a+b)/x @key{RET} s t merge @key{RET} | 5397 | ' a/x + b/x := (a+b)/x @key{RET} s t merge @key{RET} |
| 5398 | ' sin(x)^2 := 1 - cos(x)^2 @key{RET} s t sinsqr @key{RET} | 5398 | ' sin(x)^2 := 1 - cos(x)^2 @key{RET} s t sinsqr @key{RET} |
| 5399 | 5399 | ||
| 5400 | 1: 1 / cos(x) - sin(x) tan(x) 1: cos(x) | 5400 | 1: 2 / cos(x)^2 - 2 tan(x)^2 1: 2 |
| 5401 | . . | 5401 | . . |
| 5402 | 5402 | ||
| 5403 | r 1 a r tsc @key{RET} a r merge @key{RET} a r sinsqr @key{RET} a s | 5403 | r 1 a r tsc @key{RET} a r merge @key{RET} a r sinsqr @key{RET} a s |
| @@ -22294,6 +22294,8 @@ turn the default simplifications off first (with @kbd{m O}). | |||
| 22294 | 22294 | ||
| 22295 | @noindent | 22295 | @noindent |
| 22296 | @kindex a s | 22296 | @kindex a s |
| 22297 | @kindex I a s | ||
| 22298 | @kindex H a s | ||
| 22297 | @pindex calc-simplify | 22299 | @pindex calc-simplify |
| 22298 | @tindex simplify | 22300 | @tindex simplify |
| 22299 | The @kbd{a s} (@code{calc-simplify}) [@code{simplify}] command applies | 22301 | The @kbd{a s} (@code{calc-simplify}) [@code{simplify}] command applies |
| @@ -22317,6 +22319,23 @@ and rewrite rules. @xref{Rearranging with Selections}. | |||
| 22317 | simplification occurs automatically. Normally only the ``default | 22319 | simplification occurs automatically. Normally only the ``default |
| 22318 | simplifications'' occur. | 22320 | simplifications'' occur. |
| 22319 | 22321 | ||
| 22322 | There are some simplifications that, while sometimes useful, are never | ||
| 22323 | done automatically. For example, the @kbd{I} prefix can be given to | ||
| 22324 | @kbd{a s}; the @kbd{I a s} command will change any trigonometric | ||
| 22325 | function to the appropriate combination of @samp{sin}s and @samp{cos}s | ||
| 22326 | before simplifying. This can be useful in simplifying even mildly | ||
| 22327 | complicated trigonometric expressions. For example, while @kbd{a s} | ||
| 22328 | can reduce @samp{sin(x) csc(x)} to @samp{1}, it will not simplify | ||
| 22329 | @samp{sin(x)^2 csc(x)}. The command @kbd{I a s} can be used to | ||
| 22330 | simplify this latter expression; it will transform @samp{sin(x)^2 | ||
| 22331 | csc(x)} into @samp{sin(x)}. However, @kbd{I a s} will also perform some | ||
| 22332 | ``simplifications'' which may not be desired; for example, it will | ||
| 22333 | transform @samp{tan(x)^2} into @samp{sin(x)^2 / cos(x)^2}. | ||
| 22334 | Similar to the @kbd{I} prefix, the Hyperbolic prefix @kbd{H} will | ||
| 22335 | replace any hyperbolic functions in the formula with the appropriate | ||
| 22336 | combinations of @samp{sinh}s and @samp{cosh}s before simplifying. | ||
| 22337 | |||
| 22338 | |||
| 22320 | @menu | 22339 | @menu |
| 22321 | * Default Simplifications:: | 22340 | * Default Simplifications:: |
| 22322 | * Algebraic Simplifications:: | 22341 | * Algebraic Simplifications:: |