Monday, September 16, 2019

Numerical approximations

You should be convinced by now that not every integral can be computed by means of computing an antiderivative of the integrand. For instance, it is quite difficult to just compute $$\int_{0}^{1} e^{-x^{2}} dx,$$ even though this integral arises many times in statistics. Hence, you need to learn about various ways to numerically approximate such an integral.

Left sums and right sums. Since I cannot draw here, I will first assign you some reading.

Exercise. Read p.377, and compute $\mathrm{LEFT}(4)$ and $\mathrm{RIGHT}(4)$ for the integral $$\int_{0}^{1} e^{-x^{2}} dx.$$ Which one is bigger? Can you generalize this pattern?

What's the most important about left sums and right sums is how to compare them when the integrand is either given by an increasing function or a decreasing function with positivity condition.

(1) If $f(x)$ is positive (i.e., $f > 0$) and increasing (e.g., $f' > 0$), then $$\mathrm{LEFT}(n) \leq \int_{a}^{b} f(x) dx \leq \mathrm{RIGHT}(n);$$ (2) If $f(x)$ is positive (i.e., $f > 0$) and decreasing (e.g., $f' < 0$), then $$\mathrm{RIGHT}(n) \leq \int_{a}^{b} f(x) dx \leq \mathrm{LEFT}(n).$$ To see these, it is the best to draw pictures.

Exercise. What happens if $f(x)$ is negative?

Exercise. Estimate $$\int_{0}^{1} x^{2} dx$$ by bounding it with $\mathrm{LEFT}(5)$ and $\mathrm{RIGHT}(5).$ Compare the bounds with the actual answer $1/3.$

Exercise. Can you apply the same method as in the previous exercise for estimating $$\int_{0}^{\pi} \sin(x) dx?$$ If not, how would you modify your method?

Midpoint sums and trapezoid sums. As in p.377, the midpoint sums are given by summing up the rectangles whose heights were taken in the middle of subintervals. Trapezoid sums are defined by Figure 7.7 on p.378.

Exercise. Figure out why the trapezoid sum is the average of the left sum and the right sum, namely, explain why the following formula holds: $$\mathrm{TRAP}(n) = \frac{\mathrm{LEFT}(n) + \mathrm{RIGHT}(n)}{2}.$$

Exercise. Compute $\mathrm{MID}(4)$ and $\mathrm{TRAP}(4)$ for the integral $$\int_{0}^{1} e^{x} dx.$$ Which one is bigger? Can you generalize this pattern?

Midpoint sums and trapezoid sums have some story related to concavity.

(1) If $f(x)$ is concave up (e.g., $f'' > 0$), then $$\mathrm{MID}(n) \leq \int_{a}^{b} f(x) dx \leq \mathrm{TRAP}(n);$$ (2) If $f(x)$ is concave down (e.g., $f'' < 0$), then $$\mathrm{TRAP}(n) \leq \int_{a}^{b} f(x) dx \leq \mathrm{MID}(n).$$ To see these, it is the best to draw pictures, or you can just read:

Exercise. Read p.379 to understand why the above stories are true.

Exercise. Do #1 on Team HW 1.

No comments:

Post a Comment