[Math] Use the Midpoint Rule with n=6 to approximate the value of $\int_{a=0}^{ b=1} e^{x^2} dx$. error estimate to find smallest n value

calculus

The question is Use the Midpoint Rule with n=6 to approximate the value of

$\int_{a=0}^{ b=1} e^{x^2} dx$

I understand i need to find delta x, which is 1/6. When it comes to finding the values to plug in for $f(x)$ i got $M=1/6[f(1/12)+f(1/4)+f(5/12)+f(7/12)+f(3/4)+f(11/12)]$ which after plugging in these answers i got 1.456409832 as the answer. Now, i have a part b) of the question which is, Use the error estimate to find the smallest value of n that can be chosen in order to guarantee that the midpoint rule approximates the integral in part (a) to within 10^-5. I don't even know what part b is suggesting i should do? do i need to use the trapezoidal rule to find out the error estimate? and if i do how does that tell me the smallest value of n?

Best Answer

For the Midpoint Rule, we suppose that $|f''(x)| \le k$, for some $k \in \mathbb{R}$, where $a \le x \le b$. Then, the error estimate is given by:

$$|E_M| \le k\dfrac{(b-a)^3}{24 n^2} \tag 1$$

We have:

$$f(x) = e^{x^2} \rightarrow f'(x) = 2 x e^{x^2} \rightarrow f''(x) = 2 e^{x^2} + 4 x^2 e^{x^2}$$

Where does the max of that occur on the interval? Use your favorite method to find that, but clearly it is an increasing function over the interval, so the max occurs when $x = 1$, so we take:

$$|f''(x)| \le k = 6e$$

Substituting this into $(1)$, yields:

$$|E_M| \le k\dfrac{(b-a)^3}{24 n^2} = 6e \dfrac{1^3}{24 n^2}$$

The problem wants an error $|E_M| \le 10^{-5}$, thus

$$|E_M| = 6e \dfrac{1^3}{24 n^2} \le 10^{-5}$$

Solving for $n$ yields $n \ge 260.686$, so take:

$$n = 261$$

The actual integral is

$$\displaystyle \int_0^1 e^{x^2}~dx = \dfrac{1}{2} \sqrt{\pi } \text{erfi}(1) = 1.46265$$

Note that this is just a range, so it is entirely possible that the number of iterations is less. Experimentation shows that $184$ were sufficient.

Related Question