aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorJay Belanger2009-08-27 13:36:19 +0000
committerJay Belanger2009-08-27 13:36:19 +0000
commit0ff2d6c28efa369ae227c5f35bc2f22eef0f5a60 (patch)
tree0ce5e3f31caae62afed2b49eb693ec2cd6406258 /doc
parent550c8289fd72b5bff091ce1c2f9c6567215a8994 (diff)
downloademacs-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/ChangeLog6
-rw-r--r--doc/misc/calc.texi43
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 @@
12009-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
12009-08-25 Michael Albinus <michael.albinus@gmx.de> 72009-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
52901: 1 / cos(x) - sin(x) tan(x) 52901: 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
5298If we were simplifying this by hand, we'd probably replace the 5298If 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
5300denominator. There is no Calc command to do the former; the @kbd{a n} 5300denominator. The @kbd{I a s} command will do the former and the @kbd{a n}
5301algebra command will do the latter but we'll do both with rewrite 5301algebra command will do the latter, but we'll do both with rewrite
5302rules just for practice. 5302rules just for practice.
5303 5303
5304Rewrite rules are written with the @samp{:=} symbol. 5304Rewrite rules are written with the @samp{:=} symbol.
5305 5305
5306@smallexample 5306@smallexample
5307@group 5307@group
53081: 1 / cos(x) - sin(x)^2 / cos(x) 53081: 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
53381: (1 - sin(x)^2) / cos(x) 53381: (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
5351Second, meta-variable names are independent from variables in the 5351Second, meta-variable names are independent from variables in the
5352target formula. Notice that the meta-variable @samp{x} here matches 5352target formula. Notice that the meta-variable @samp{x} here matches
5353the subformula @samp{cos(x)}; Calc never confuses the two meanings of 5353the subformula @samp{cos(x)^2}; Calc never confuses the two meanings of
5354@samp{x}. 5354@samp{x}.
5355 5355
5356And third, rewrite patterns know a little bit about the algebraic 5356And third, rewrite patterns know a little bit about the algebraic
5357properties of formulas. The pattern called for a sum of two quotients; 5357properties of formulas. The pattern called for a sum of two quotients;
5358Calc was able to match a difference of two quotients by matching 5358Calc 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]
5362We could just as easily have written @samp{a/x - b/x := (a-b)/x} for 5362We 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.)
5368One more rewrite will complete the job. We want to use the identity 5368One 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
5370the identity in a way that matches our formula. The obvious rule 5370the identity in a way that matches our formula. The obvious rule
5371would be @samp{@w{1 - sin(x)^2} := cos(x)^2}, but a little thought shows 5371would be @samp{@w{2 - 2 sin(x)^2} := 2 cos(x)^2}, but a little thought shows
5372that the rule @samp{sin(x)^2 := 1 - cos(x)^2} will also work. The 5372that the rule @samp{sin(x)^2 := 1 - cos(x)^2} will also work. The
5373latter rule has a more general pattern so it will work in many other 5373latter rule has a more general pattern so it will work in many other
5374situations, too. 5374situations, too.
5375 5375
5376@smallexample 5376@smallexample
5377@group 5377@group
53781: (1 + cos(x)^2 - 1) / cos(x) 1: cos(x) 53781: (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
54001: 1 / cos(x) - sin(x) tan(x) 1: cos(x) 54001: 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
22299The @kbd{a s} (@code{calc-simplify}) [@code{simplify}] command applies 22301The @kbd{a s} (@code{calc-simplify}) [@code{simplify}] command applies
@@ -22317,6 +22319,23 @@ and rewrite rules. @xref{Rearranging with Selections}.
22317simplification occurs automatically. Normally only the ``default 22319simplification occurs automatically. Normally only the ``default
22318simplifications'' occur. 22320simplifications'' occur.
22319 22321
22322There are some simplifications that, while sometimes useful, are never
22323done 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
22325function to the appropriate combination of @samp{sin}s and @samp{cos}s
22326before simplifying. This can be useful in simplifying even mildly
22327complicated trigonometric expressions. For example, while @kbd{a s}
22328can 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
22330simplify this latter expression; it will transform @samp{sin(x)^2
22331csc(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
22333transform @samp{tan(x)^2} into @samp{sin(x)^2 / cos(x)^2}.
22334Similar to the @kbd{I} prefix, the Hyperbolic prefix @kbd{H} will
22335replace any hyperbolic functions in the formula with the appropriate
22336combinations 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::