Skip to main content

Exercises 8.6 Exercises

1.
Evaluate the integral \(\int_0^1 e^{x^2}dx\) correctly to 10 decimal places with all methods presented in this chapter. Explain why you believe that those 10 digits are correct.
2.
Run this chapter's code for the Simpson method and record somewhere (e.g. a piece of paper or picture) the errors you get for the different values of h. Then re-run the code after changing line 9 from s(i)=sum(h(i)*sim); to s(i)=h(i)*sum(sim); and compare the numerical results found in the two methods. What would we find if we were able to use exact mathematics? What do we get?

Now modify the initial value of h, in line 4, from 0.1 to 0.5 and re-run the code with both versions of line 9 as explained above. Compare again the errors you get in the two cases. What do you notice? Explain the result you see.
3.
Using our 3-digits decimal floating point system, evaluate \(\int_0^1 x^4dx\) "by hand" with the midpoint, trapezoidal and Simpson rules by dividing the interval \([0,1]\) into three equal-length subintervals. Then compare the numerical results with the exact one and compare the error with the corresponding global error estimate for each method.