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


GNU Emacs Calc 2.02 Manual

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

3.7.51 Algebra Tutorial Exercise 4

The hard part is that V R + is no longer sufficient to add up all the contributions from the slices, since the slices have varying coefficients. So first we must come up with a vector of these coefficients. Here's one way:

 
2:  -1                 2:  3                    1:  [4, 2, ..., 4]
1:  [1, 2, ..., 9]     1:  [-1, 1, ..., -1]         .
    .                      .

    1 n v x 9 RET          V M ^  3 TAB             -

 
1:  [4, 2, ..., 4, 1]      1:  [1, 4, 2, ..., 4, 1]
    .                          .

    1 |                        1 TAB |

Now we compute the function values. Note that for this method we need eleven values, including both endpoints of the desired interval.

 
2:  [1, 4, 2, ..., 4, 1]
1:  [1, 1.1, 1.2,  ...  , 1.8, 1.9, 2.]
    .

 11 RET 1 RET .1 RET  C-u v x

 
2:  [1, 4, 2, ..., 4, 1]
1:  [0., 0.084941, 0.16993, ... ]
    .

    ' sin(x) ln(x) RET   m r  p 5 RET   V M $ RET

Once again this calls for V M * V R +; a simple * does the same thing.

 
1:  11.22      1:  1.122      1:  0.374
    .              .              .

    *              .1 *           3 /

Wow! That's even better than the result from the Taylor series method.


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