Skip to main content

Exercises 13.6 Homework

1.

Estimate the error of the trapezoidal rule following the procedure in Section 13.4 (theoretical exercise).

2.

Calculate an approximate value of \(\pi\) using from the formula

\begin{equation*} \int_0^\infty \sin(x^2)\,dx = \sqrt{\frac{\pi}{8}} \end{equation*}

Two approximations must be made here: replacing \(\infty\) in the integral with a large number \(b\text{,}\) and using the trapezoidal rule with a large number of subintervals \(n\text{.}\) While avoiding extremely large \(b\) and \(n\) that might freeze your computer, calculate the value of integral \(I\) with enough precision so that round(8*I^2, 2) (rounding to 2 places) produces 3.14, a reasonable approximation to \(\pi\text{.}\)

Questions to answer: (a) What values of \(b\) and \(n\) did you use to achieve 3.14? (b) If you increase \(b\) while keeping \(n\) fixed, does the answer become more precise or less precise? Why? (Hint: think of the error estimate formula)

(For Octave users: round(x, 2) is not currently available in Octave: it only has round(x), rounding to the nearest integer. As a workaround, use round(x*100)/100 which has the same effect as round(x, 2) in Matlab.)