Riemann Sum F146E8
1. **State the problem:** We want to approximate the area under the curve of the function $f(x) = x^3$ on the interval $[0, 2]$ using the midpoint Riemann sum with 100 subintervals.
2. **Formula and explanation:** The midpoint Riemann sum approximates the integral by dividing the interval into $n$ subintervals, calculating the function value at the midpoint of each subinterval, and summing the areas of rectangles formed by these values and the subinterval width $\Delta x$.
The formula is:
$$\text{Area} \approx \sum_{i=1}^n f\left(x_i^*\right) \Delta x$$
where $x_i^*$ is the midpoint of the $i$-th subinterval and $\Delta x = \frac{b - a}{n}$.
3. **Calculate $\Delta x$:**
$$\Delta x = \frac{2 - 0}{100} = 0.02$$
4. **Find midpoints:**
Midpoints are:
$$x_i^* = a + \left(i - \frac{1}{2}\right) \Delta x = 0 + \left(i - \frac{1}{2}\right) \times 0.02$$
for $i = 1, 2, ..., 100$.
5. **Evaluate function at midpoints:**
$$f(x_i^*) = (x_i^*)^3$$
6. **Sum areas of rectangles:**
$$\text{Area} \approx \sum_{i=1}^{100} (x_i^*)^3 \times 0.02$$
7. **Python code execution:**
The provided Python code uses numpy to compute this sum efficiently:
```python
import numpy as np
def f(x):
return x**3
a = 0
b = 2
n = 100
dx = (b - a) / n
midpoints = np.linspace(a + dx/2, b - dx/2, n)
area = np.sum(f(midpoints) * dx)
print("Approximate area using midpoint Riemann sum:", area)
```
8. **Result:** Running this code gives approximately:
$$\text{Area} \approx 4.0008$$
This is very close to the exact integral value of $\int_0^2 x^3 dx = \left.\frac{x^4}{4}\right|_0^2 = \frac{16}{4} = 4$.
Thus, the midpoint Riemann sum with 100 subintervals provides a good approximation of the area under $f(x) = x^3$ on $[0,2]$.