An archive of Mark's Spring 2018 Numerical Analysis course.

Applying the midpoint rule

mark

Let f(x) = \sin(x^2). We wish to approximate

\int_0^2 f(x) dx

using a mid-point sum and we would like the estimate to be accurate to within 0.0001 of the actual value.

  • Use the error bound on the midpoint sum to find a value of N so that N terms in your sum guarantee the desired level of accuracy.
  • Write down the resulting sum in \Sigma notation.

Comments

Know the error bounds for Riemann, trapezoidal, and midpoints sums as stated on Wikipedia’s Riemann sum page.

While you need to use the the error formulae to get reasonable bounds, your estimate does not need to be sharp. For example, an expression like

2\sin(x^{42}) - 3x\cos(3x^3)

is easily seen to be bounded by 8 over the interval [0,2].

mark
mark
theoldernoah

Because we are using the midpoint rule, we calculate M_2 by finding an upper bound on f''(x). Our f''(x)= 2\cos(x^2) - 4x^2\sin(x^2), so our upper bound for this is 2+4*2^2 or 18.

Now we have the inequality 0.0001 \geq \frac{18*2^3}{12*n^2}, which gives us n \geq \sqrt{\frac{144}{12*0.0001}}, which is n \geq 346.410 or simply n \geq 347.

theoldernoah

The resulting sum from my previous response would be

\sum^n_{i=1} f(x_i) \Delta x = \sum^{347}_{i=1} \sin(x_i^2)* \frac{2}{347}.
Lorentz

In practice we would need to define the x_i terms to be the midpoints though right? So in our case

x_i=0+\frac{2i -1}{2(347)}*(2-0)
=\frac{2i-1}{347}