Exercises 17.6 Homework
1.
Estimate the error of computing \(\int_{0.1}^{1.1} \sqrt{x}\,dx\) using Simpson's rule with \(h=1/2\text{,}\) according to the error bound (17.1.1).
2.
Calculate the actual error in Exercise 17.6.1, that is, the difference between what Simpson's rule gives and the exact value of the integral. Is the actual error similar in size to the error estimate found in Exercise 17.6.1?
3.
Rewrite the adaptive integration script in Example 17.5.1 so that it uses trapezoidal rule for \(I_1\) and Simpson's rule for \(I_2\text{.}\) Test it on the integral \(\int_0^4 x^{3/2}\,dx\) to make sure the script returns a correct result.
(For Octave users: recursive functions in Octave have some restrictions: the file must be named as the function itself, and the call to the function must come from the command line or from another file. For example, the Fibonacci recursion in Octave would be saved in file “fib.m” with the contents
function f = fib(n) if n < 1 f = 1; else f = fib(n-1) + fib(n-2); endif endfunction
and then one would use it by entering, for example, fib(8)
in the command line.)