www.delorie.com/gnu/docs/calc/calc_86.html   search  
 
Buy the book!


GNU Emacs Calc 2.02 Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7.52 Rewrites Tutorial Exercise 1

We'll use Big mode to make the formulas more readable.

 
                                               ___
                                          2 + V 2
1:  (2 + sqrt(2)) / (1 + sqrt(2))     1:  --------
    .                                          ___
                                          1 + V 2

                                          .

  ' (2+sqrt(2)) / (1+sqrt(2)) RET         d B

Multiplying by the conjugate helps because (a+b) (a-b) = a^2 - b^2.

 
          ___    ___
1:  (2 + V 2 ) (V 2  - 1)
    .

  a r a/(b+c) := a*(b-c) / (b^2-c^2) RET

 
         ___                         ___
1:  2 + V 2  - 2                1:  V 2
    .                               .

  a r a*(b+c) := a*b + a*c          a s

(We could have used a x instead of a rewrite rule for the second step.)

The multiply-by-conjugate rule turns out to be useful in many different circumstances, such as when the denominator involves sines and cosines or the imaginary constant i.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003