emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/doc/misc calc.texi


From: Jay Belanger
Subject: [Emacs-diffs] emacs/doc/misc calc.texi
Date: Thu, 27 Aug 2009 13:35:12 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Jay Belanger <jpb>      09/08/27 13:35:12

Modified files:
        doc/misc       : calc.texi 

Log message:
        (Rewrite Rules): Improve the example.
        (Simplifying Formulas): Explain use of the I and H flags for 
simplification. 

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/doc/misc/calc.texi?cvsroot=emacs&r1=1.40&r2=1.41

Patches:
Index: calc.texi
===================================================================
RCS file: /cvsroot/emacs/emacs/doc/misc/calc.texi,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- calc.texi   9 Aug 2009 23:39:59 -0000       1.40
+++ calc.texi   27 Aug 2009 13:35:10 -0000      1.41
@@ -5287,25 +5287,25 @@
 
 @smallexample
 @group
-1:  1 / cos(x) - sin(x) tan(x)
+1:  2 / cos(x)^2 - 2 tan(x)^2
     .
 
-    ' 1/cos(x) - sin(x) tan(x) @key{RET}   s 1
+    ' 2/cos(x)^2 - 2tan(x)^2 @key{RET}   s 1
 @end group
 @end smallexample
 
 @noindent
 If we were simplifying this by hand, we'd probably replace the
 @samp{tan} with a @samp{sin/cos} first, then combine over a common
-denominator.  There is no Calc command to do the former; the @kbd{a n}
-algebra command will do the latter but we'll do both with rewrite
+denominator.  The @kbd{I a s} command will do the former and the @kbd{a n}
+algebra command will do the latter, but we'll do both with rewrite
 rules just for practice.
 
 Rewrite rules are written with the @samp{:=} symbol.
 
 @smallexample
 @group
-1:  1 / cos(x) - sin(x)^2 / cos(x)
+1:  2 / cos(x)^2 - 2 sin(x)^2 / cos(x)^2
     .
 
     a r tan(a) := sin(a)/cos(a) @key{RET}
@@ -5335,7 +5335,7 @@
 
 @smallexample
 @group
-1:  (1 - sin(x)^2) / cos(x)
+1:  (2 - 2 sin(x)^2) / cos(x)^2
     .
 
     a r a/x + b/x := (a+b)/x @key{RET}
@@ -5350,13 +5350,13 @@
 
 Second, meta-variable names are independent from variables in the
 target formula.  Notice that the meta-variable @samp{x} here matches
-the subformula @samp{cos(x)}; Calc never confuses the two meanings of
+the subformula @samp{cos(x)^2}; Calc never confuses the two meanings of
 @samp{x}.
 
 And third, rewrite patterns know a little bit about the algebraic
 properties of formulas.  The pattern called for a sum of two quotients;
 Calc was able to match a difference of two quotients by matching
address@hidden = 1}, @samp{b = -sin(x)^2}, and @samp{x = cos(x)}.
address@hidden = 2}, @samp{b = -2 sin(x)^2}, and @samp{x = cos(x)^2}.
 
 @c [fix-ref Algebraic Properties of Rewrite Rules]
 We could just as easily have written @samp{a/x - b/x := (a-b)/x} for
@@ -5368,14 +5368,14 @@
 One more rewrite will complete the job.  We want to use the identity
 @samp{sin(x)^2 + cos(x)^2 = 1}, but of course we must first rearrange
 the identity in a way that matches our formula.  The obvious rule
-would be @address@hidden - sin(x)^2} := cos(x)^2}, but a little thought shows
+would be @address@hidden - 2 sin(x)^2} := 2 cos(x)^2}, but a little thought 
shows
 that the rule @samp{sin(x)^2 := 1 - cos(x)^2} will also work.  The
 latter rule has a more general pattern so it will work in many other
 situations, too.
 
 @smallexample
 @group
-1:  (1 + cos(x)^2 - 1) / cos(x)           1:  cos(x)
+1:  (2 + 2 cos(x)^2 - 2) / cos(x)^2           1:  2
     .                                         .
 
     a r sin(x)^2 := 1 - cos(x)^2 @key{RET}          a s
@@ -5397,7 +5397,7 @@
 ' a/x + b/x := (a+b)/x @key{RET}         s t merge @key{RET}
 ' sin(x)^2 := 1 - cos(x)^2 @key{RET}     s t sinsqr @key{RET}
 
-1:  1 / cos(x) - sin(x) tan(x)     1:  cos(x)
+1:  2 / cos(x)^2 - 2 tan(x)^2      1:  2
     .                                  .
 
     r 1                a r tsc @key{RET}  a r merge @key{RET}  a r sinsqr 
@key{RET}  a s
@@ -22294,6 +22294,8 @@
 
 @noindent
 @kindex a s
address@hidden I a s
address@hidden H a s
 @pindex calc-simplify
 @tindex simplify
 The @kbd{a s} (@code{calc-simplify}) address@hidden command applies
@@ -22317,6 +22319,23 @@
 simplification occurs automatically.  Normally only the ``default
 simplifications'' occur.
 
+There are some simplifications that, while sometimes useful, are never
+done automatically.  For example, the @kbd{I} prefix can be given to
address@hidden s}; the @kbd{I a s} command will change any trigonometric
+function to the appropriate combination of @samp{sin}s and @samp{cos}s
+before simplifying.  This can be useful in simplifying even mildly
+complicated trigonometric expressions.  For example, while @kbd{a s}
+can reduce @samp{sin(x) csc(x)} to @samp{1}, it will not simplify
address@hidden(x)^2 csc(x)}.  The command @kbd{I a s} can be used to
+simplify this latter expression; it will transform @samp{sin(x)^2
+csc(x)} into @samp{sin(x)}.  However, @kbd{I a s} will also perform some
+``simplifications'' which may not be desired; for example, it will
+transform @samp{tan(x)^2} into @samp{sin(x)^2 / cos(x)^2}.
+Similar to the @kbd{I} prefix, the Hyperbolic prefix @kbd{H} will
+replace any hyperbolic functions in the formula with the appropriate
+combinations of @samp{sinh}s and @samp{cosh}s before simplifying.
+
+
 @menu
 * Default Simplifications::
 * Algebraic Simplifications::




reply via email to

[Prev in Thread] Current Thread [Next in Thread]