Page 254 -
P. 254

8.7.4  Accuracy of a Truncated Taylor Series
                             In this subsection and subection 8.7.5, we illustrate the use of matrices as a
                             convenient constructional tool to state and manipulate problems with two
                             indices. In this application, we desire to verify the accuracy of the truncated
                                             N
                             Taylor series  S = ∑  x  n   as an approximation to the function y = exp(x), over
                                            n=0  n!
                             the interval 0 ≤ x < 1.
                              Because this application’s purpose is to illustrate a constructional scheme,
                             we write the code lines as we are proceeding with the different computa-
                             tional steps:

                                1. We start by dividing the (0, 1) interval into equally spaced seg-
                                   ments. This array is given by:

                                   x=[0:0.01:1];
                                   M=length(x);

                                2. Assume that we are truncating the series at the value N = 10:


                                   N=10;

                                3. Construct the matrix W having the following form:


                                                           x 2   x 3       x N  
                                                  1  x 1    1     1   L     1  
                                                           2! 2  3! 3      N! 
                                                                             N
                                                           x 2   x  2  L   x  2  
                                                  1  x 2   2!    3!        N! 
                                                           x 2   x 3       x N  
                                             W = 1   x 3    3     3   L     3            (8.20)
                                                           2!    3!        N! 
                                                  M        M          L       
                                                  M        M          O     M  
                                                            2     3         N  
                                                           x M  x  M       x  M  
                                                   1  x  M  2!  3!   L    N!  



                                   Specify the size of W, and then give the induction rule to go from
                                   one column to the next:


                                                                Wi j(, − 1 )
                                                    Wi j(, ) =  x i( ) *                   (8.21)
                                                                   j − 1



                             © 2001 by CRC Press LLC
   249   250   251   252   253   254   255   256   257   258   259