Problem 2

Question

Approximate the following integrals using the trapezoidal rule, the midpoint rule, and Simpson's rule for the specified number of subdivisions and compute error bounds using the formulas given in this section. Compare your answers to the exact answer. (a) \(\int_{0}^{2} x^{2} d x \quad n=4\) (b) \(\int_{0}^{1} \frac{1}{x+1} d x \quad n=4\)

Step-by-Step Solution

Verified
Answer
The detailed solutions for (a) and (b) give the results for approximated values of given integrals for each method along with their error bounds. Comparisons of these approximations with the exact values of integrals confirm the accuracy of these approximations.
1Step 1: Apply the Trapezoidal Rule
For an integral \(\int_{a}^{b} f(x) d x\), the formula for the trapezoidal rule for \(n\) subdivisions is: \(\int_{a}^{b} f(x) d x ≈ \delta x [\frac{1}{2}f(x_0) + \sum_{i = 1}^{n-1} f(x_i) + \frac{1}{2}f(x_n)]\), where \(\delta x = \frac{b-a}{n}\) and \(x_i = a+i\delta x\). Now, apply this rule to both (a) and (b).
2Step 2: Apply the Midpoint Rule
The formula for the midpoint rule for n subdivisions is: \(\int_{a}^{b} f(x) d x \approx \delta x \sum_{i = 0}^{n-1} f(\frac{1}{2} (x_i + x_{i+1}))\). Apply this rule to both (a) and (b).
3Step 3: Apply Simpson's Rule
The formula for Simpson's rule for \(n\) subdivisions is: \(\int_{a}^{b} f(x) d x \approx \frac{\delta x}{3} [f(x_0) + 4 \sum_{i = 1 odd}^{n-1} f(x_i) + 2 \sum_{i = 1 even}^{n-1} f(x_i) +f(x_n)]\). Apply it to both (a) and (b).
4Step 4: Compute Error Bounds
Using the formulas given in the lesson, calculate the error bounds for the trapezoidal and midpoint rules for both (a) and (b).
5Step 5: Compare Estimates to the Exact Answers
Compare the results obtained from steps 1, 2 and 3 to the exact value of the integral for both (a) and (b).

Key Concepts

Trapezoidal RuleMidpoint RuleSimpson's RuleError Bounds
Trapezoidal Rule
The Trapezoidal Rule is a method used in numerical integration to approximate the definite integral of a function. The basic idea is to divide the area under the curve into trapezoids, rather than rectangles as in some other methods.
The formula to approximate an integral using the Trapezoidal Rule is given as:
  • \( \int_{a}^{b} f(x) \, dx \approx \delta x \left[ \frac{1}{2}f(x_0) + \sum_{i = 1}^{n-1} f(x_i) + \frac{1}{2}f(x_n) \right] \)
where:
  • \( \delta x = \frac{b-a}{n} \) is the width of each subinterval,
  • \( x_i = a+i\delta x \) are the points at which the function is evaluated.
To apply it, you calculate the height of the function at each subdivision point, multiply it by \( \delta x \), and sum these values, acknowledging that the first and last terms are halved because they only contribute half their height to the area approximation.This technique is useful because it can provide a fairly accurate estimate of the integral’s value, especially when the function is relatively linear over the interval. But keep in mind, with curved functions, the approximation may not be as precise without a large number of subdivisions.
Midpoint Rule
The Midpoint Rule is another method for approximating the value of a definite integral. It works by using the midpoint of each subinterval to approximate the area under the curve. This can sometimes provide a better approximation than the Trapezoidal Rule.
The Midpoint Rule uses the formula:
  • \( \int_{a}^{b} f(x) \, dx \approx \delta x \sum_{i = 0}^{n-1} f\left(\frac{x_i + x_{i+1}}{2}\right) \)
Here's how it's done:
  • Calculate \( \delta x = \frac{b-a}{n} \), the width of each subdivision.
  • For each subinterval, find the midpoint \(m_i = \frac{x_i + x_{i+1}}{2} \).
  • Evaluate the function at each midpoint.
  • Sum the evaluated function values, and multiply by \( \delta x \).
The Midpoint Rule can be more accurate than other simple approximations because it accounts for the behavior of the function within each subinterval, balancing out some of the over or underestimation issues found in simpler rules. Especially for functions that are not linear, this can often result in a closer approximation of the true integral value.
Simpson's Rule
Simpson's Rule offers a more sophisticated approach to numerical integration, typically providing superior accuracy compared to the Trapezoidal and Midpoint Rules when applied to polynomial functions.Simpson's Rule approximates the function using a quadratic polynomial over each pair of subintervals, which is more accurate for functions with curvature.
The formula looks like this:
  • \( \int_{a}^{b} f(x) \, dx \approx \frac{\delta x}{3} \left[ f(x_0) + 4 \sum_{i = 1 \text{ odd}}^{n-1} f(x_i) + 2 \sum_{i = 1 \text{ even}}^{n-1} f(x_i) + f(x_n) \right] \)
To apply Simpson’s Rule:
  • Divide the interval \([a, b]\) into an even number of subintervals, as the rule requires pairs (\( n \) must be even).
  • Calculate the function at each endpoint, at each odd-indexed point (multiply these values by 4), and at each even-indexed point (multiply these values by 2).
  • Add these values together and multiply the sum by \( \frac{\delta x}{3} \).
Simpson's Rule can lead to excellent approximations for many types of functions, especially when the function is well behaved and continuous over the interval. It’s a powerful tool in numerical integration, especially when high precision is required.
Error Bounds
When employing numerical integration, understanding error bounds is crucial. Error bounds give us an estimate of how far off our approximate solution might be from the exact integral we are trying to determine.
For the Trapezoidal Rule, the error is given by:
  • \( E_T = -\frac{(b-a)^3}{12n^2} f''(c) \)
where \( f''(c) \) comes from the second derivative evaluated at some point \( c \) in the interval \([a, b]\).
The Midpoint Rule error is:
  • \( E_M = -\frac{(b-a)^3}{24n^2} f''(d) \)
where \( f''(d) \) is similarly derived.
Simpson’s Rule has an error formula of:
  • \( E_S = -\frac{(b-a)^5}{180n^4} f^{(4)}(e) \)
where \( f^{(4)}(e) \) is the fourth derivative evaluated at some \( e \) in the interval. This rule generally provides the smallest error among the three if the function is sufficiently smooth.
Calculating and understanding these error terms can help indicate how reliable our approximation is, ensuring we choose an appropriate method based on the required accuracy.