User:Egm6341.s11.team4.fields/HW4.8

=Problem 4.8: Taylor, Trapezoidal and Simpson's Error Estimate Comparisons=

Refer to lecture slide [[media:nm1.s11.mtg22.djvu|22-2]] for the problem statement.

Given

 * {| style="width:70%" border="0" align="center"



(8.1)
 * $$\displaystyle I:=\int_{a}^{b}\underbrace{\frac{e^x-1}{x}}_{f(x)}dx$$
 * 
 * }
 * }

For the Taylor Series Expansion, the max error in the integral is limited by the following from lecture [[media:nm1.s11.mtg7.djvu|7-2]]


 * {| style="width:70%" border="0" align="center"



(8.2)
 * $$\displaystyle E_n \le \frac{e}{(n+1)!(n+1)}$$
 * 
 * }
 * }

For the composite Trapezoidal rule, the max error is limited by the following from lecture [[media:nm1.s11.mtg22.djvu|22-1]]


 * {| style="width:70%" border="0" align="center"



(8.3)
 * $$\displaystyle \vert E_n \vert \le \frac{(b-a)h^2}{12}M_2$$
 * 
 * }
 * }

For the composite Simpson's rule, the max error is limited by the following from lecture [[media:nm1.s11.mtg22.djvu|22-2]]


 * {| style="width:70%" border="0" align="center"



(8.4)
 * $$\displaystyle \vert E_n \vert \le \frac{(b-a)h^4}{2880}M_4$$
 * 
 * }
 * }

Where


 * {| style="width:70%" border="0" align="center"




 * $$\displaystyle a = -1$$


 * }
 * }


 * {| style="width:70%" border="0" align="center"




 * $$\displaystyle b = 1$$


 * }
 * }

and,


 * {| style="width:70%" border="0" align="center"




 * $$\displaystyle h = \frac{(b-a)}{n}$$


 * }
 * }

Objective
1.a.) Find n such that En = O(10^-6) and compare to numerical results in HW2.4 using Taylor Series error.

1.b.) Find n such that En = O(10^-6) and compare to numerical results in HW2.4 using Composite Trapezoidal rule error.

1.c.) Find n such that En = O(10^-6) and compare to numerical results in HW2.4 using Composite Simpson's rule error.

2.a.) Numerically find the power of h in the Composite Trapezoidal rule error.

2.b.) Numerically find the power of h in the Composite Simpson's rule error.

Solution
Using Wolfram Alpha we find that the exact value of the integral to 12 significant digits is:

I = 2.11450175075

1.a.) Taylor Series Error Comparison
From equation (8.1) we can easily show that when n = 7 the error will be less than or equal to 8.4272 x 10^-6.

To compare the predicted value of the integral with the actual value of the integral we will use the following:

I = 2.11450175075

And from HW2.4:


 * {| style="width:70%" border="0" align="center"

$$\displaystyle I_7 = \left[\sum_{i=1}^{7}\frac{x^{i}}{i!i}\right]_{x=-1}^{x=1} = 2.11450113379$$ (8.5)
 * 
 * }
 * }

Now,


 * {| style="width:70%" border="0" align="center"

$$\displaystyle E_{7} = |I - I_{7}| = |2.11450175075 - 2.11450113379| = 6.1696 \times 10^{-7}$$


 * }
 * }

In this case the actual error is approximately one order of magnitude less than the maximum possible error.

1.b.) Composite Trapezoidal Rule Error Comparison
From equation (8.3) with


 * {| style="width:70%" border="0" align="center"

$$\displaystyle M_2 = max |f^{(2)}(x)| = e - 2 \approx 0.718281828459$$


 * }
 * }

We get


 * {| style="width:70%" border="0" align="center"

$$\displaystyle En \le 7.3067 \times 10^{-6} \quad at \quad n = 256$$


 * }
 * }

From equation (1) on lecture slide [[media:nm1.s11.mtg7.djvu|7-4]] we get:


 * {| style="width:70%" border="0" align="center"

$$\displaystyle I_{256} = h \left[\frac{1}{2}f_0 + f_1 + \cdots + f_{n-1} + \frac{1}{2}f_n\right] = 2.11450549301$$ (8.6)
 * 
 * }
 * }

This compares well with


 * {| style="width:70%" border="0" align="center"

$$\displaystyle E_{256} = |I - I_{256}| = |2.11450175075 - 2.11450549301| = 3.7423 \times 10^{-6}$$ (8.7)
 * 
 * }
 * }

1.c.) Composite Simpson's Rule Error Comparison
From equation (8.4) with


 * {| style="width:70%" border="0" align="center"

$$\displaystyle M_4 = max |f^{(4)}(x)| = 9e - 24 \approx 0.464536456131$$


 * }
 * }

We get


 * {| style="width:70%" border="0" align="center"

$$\displaystyle En \le 1.2601 \times 10^{-6} \quad at \quad n = 8$$


 * }
 * }

From equation (4) on lecture slide [[media:nm1.s11.mtg7.djvu|7-4]] we get:


 * {| style="width:70%" border="0" align="center"

$$\displaystyle I_8 = \frac{h}{3} \left[f_0 + 4f_1 + 2f_2 + \cdots + 4f_{n-2} + 2f_{n-1} + f_n\right] = 2.11451145359$$ (8.8)
 * 
 * }
 * }

However when we compare I8 with I we get an actual E8 that is greater than what the error equation tells us we should get. See below:


 * {| style="width:70%" border="0" align="center"

$$\displaystyle E_{8} = |I - I_{8}| = |2.11450175075 - 2.11451145359| = 9.70284 \times 10^{-6}$$ (8.9)
 * 
 * }
 * }

2.a.) Composite Trapezoidal Rule Error Power of h Determination
Using equations (8.6) and (8.7) we construct the following two tables:

By graphing the above table with log(h) on the x-axis and log(En) on the y-axis with MS Excel and fitting a linear regression line across the points we get the graph below. As can be seen on the graph the slope of the line is approximately two which corresponds to the power of h in the composite Trapezoidal rule error equation.



2.b.) Composite Simpson's Rule Error Power of h Determination
Using equations (8.8) and (8.9) we construct the following two tables:

By graphing the above table with log(h) on the x-axis and log(En) on the y-axis with MS Excel and fitting a linear regression line across the points we get the graph below. As can be seen on the graph the slope of the line is approximately four which corresponds to the power of h in the composite Simpson's rule error equation.



This problem was solved by Erle Fields