标签:
杂谈 |
第4.6节 数值积分
4.6 NUMERICAL INTEGRATION
In numerical integration, one computes an approximate value for the definite integral rather than finding an exact value. In this section we shall present two methods of numerical integration, called the Trapezoidal Rule and Simpson’s Rule.
The Fundamental Theorem of Calculus gives us a method of computing the definite integral of a given continuous function f from a to b. The method is to find, by trial and error, an antiderivative F of f and then to use the equation
______ f(t)dt = F(b) - F(a).
When the method works, it provides an exact value for the integral. However, the method succeeds only if the antiderivative happens to be a function that can be described in a simple way. For many integrals one cannot find a formula for the antiderivative, and the method fails. Such integrals can still be computed approximately using numerical integration.
The Trapezoidal Rule and Simpson’s Rule can always be applied and do not use the antiderivative. They are easy to carry out on a computer or hand calculator. We already discussed one method of approximating the definite integral in Section 4.1, the Riemann sum. The Trapezoidal Rule is a modified form of the Riemann sum, which gives a much closer approximation for a given amount of effort. Simpson’s Rule is a further modification that gives still better approximations.
Let f be a continuous function on an interval I, and let a<b in I. By definition, for each positive infinitesimal dx the definite integral
__________ f(x)dx
is the standard part of the infinite Riemann sum
_____ f(x) dx,
____ f(x) dx = st [ __ f(x) dx].
In Section 4.1, examples were worked out to show that the finite Riemann sums become very close to the definite integral when Δx is small; that is, the finite Riemann sums approximate the definite integral. In Section 4.2, we saw that the definite integral is the limit of the finite Riemann sums as Δ x→ 0+:
____ f(x) dx = ________ f(x) __ x.
The Riemann sum, which is a sum of areas of rectangles, is a rather inefficient approximation of the definite integral. We can usually get a much closer approximation with the same amount of work by adding up areas of trapezoids instead of rectangles, forming the Trapezoidal Rule suggested by Figure 4.6.1. The Trapezoidal Rule also provides a formula, called an error estimate, which tells us how close the approximation is to the exact value of the definite integral.
Figure 4.6.1
Choose a positive integer n and divide the interval [a, b] into n subintervals of equal length Δ x = (b - a)/ n. The partition points are a=x0, x1, x2…, xn = b.
The trapezoidal approximation is the area of the region under the broken line connecting the points
(x0, f(x0)), (x1, f(x1)), …, (xn, f(xn)).
Since all of these points lie on the curve y= f(x), the broken line closely follows the curve. So one would expect the area of the region under the broken line to closely approximate the area under the curve.
Consider a single subinterval [ xm , xm+1] of width Δ x. The region under the line segment connecting the two points
(xm, f (xm)), (xm+1, f (xm+1))
is a trapezoid and its area is
F(xm) + f(xm+1)
_____________ Δx.
2
The sum of the areas of the trapezoids is a modified Riemann sum
|
We thus make the definition:
DEFINITION
Let Δ x= (b-a)/ n evenly divide b-a. Then by the trapezoidal approximation to the definite integral __ f(x) dx we mean the sum
|
The Trapezoidal Approximation of an integral __ f(x)dx can be computed very efficiently on most hand calculators. First compute the sum
|
By cumulative addition. Then multiply this sum by Δ x to obtain the Trapezoidal Approximation.
THEOREM 1
For a continuous function f on [a, b], the trapezoidal approximation approaches the definite integral as Δx → 0+, that is,
|
PROOF Comparing the formulas for the trapezoidal approximation and the Riemann
sum, we see that
|
For dx positive infinitesimal, the extra term
|
is infinitely small. It follows that
|
From a practical standpoint, it is desirable to have a good estimate of error. We shall first work an example and then state a theorem which gives an error estimate for the trapezoidal approximation.
EXAMPLE 1 Approximate the definite integral
|
Use the trapezoidal approximation with Δx = ___ . We first make a table of
values of ______ . The graph is drawn in Figure 4.6.2.
Figure 4.6.2
Thus, __ f(x0) + f(x1) + f(x2) + f(x3) + f(x4) + ___f(x5) = 5.7507.
Since Δ x = __ , the trapezoidal approximation is
( 5.7507) ·_____ = 1.1501,
______ dx ~ 1.1501.
The trapezoidal approximation can be made as close to the definite integral as we want by taking Δ x small. From a practical standpoint, however, it is helpful to know how small we should take Δ x in order to be sure of a given degree of accuracy. For instance, suppose we need to know the definite integral to three decimal places. How small must we take Δ x in our trapezoidal approximation? The answer is given by the Trapezoidal Rule, which gives an error estimate for the trapezoidal approximation.
The error in the trapezoidal approximation is the absolute value of the difference between the trapezoidal sum and the definite integral,
|
An error estimate for the trapezoidal approximation is a function E(Δx). Which is known to be greater than or equal to the error.
Thus if E(Δ x) is an error estimate, the trapezoidal sum is within E(Δ x) of the definite integral. If we want to be sure that the trapezoidal approximation is accurate to three decimal places -i.e., the error is less than 0.0005 - we choose Δ x so that E(Δ x) ≤ 0.0005. We are now ready to state the Trapezoidal Rule.
TRAPEZOIDAL RULE
Let f be a function whose second derivative f '' exists and has absolute value at most M on a closed interval [ a, b],
| f ''(x)|≤M for a≤x≤b.
If Δx evenly divides b-a, then the trapezoidal approximation of the definite integral of f has the error estimate
|
That is,
|
The proof is omitted.
EXAMPLE 1 (Concluded) We let f(x) = _______. Then
|
|
Therefore | f '' (x)| ≤ 1 for all x in [0,1]. We take M = 1 and use the error
estimate given by the Trapezoidal Rule,
|
Thus our approximation is within an accuracy of 1/300,
|
This shows that the integral is, at least, between 1.146 and 1.154.
In this particular example we can even conclude that the integral is between 1.146 and 1.150 (rounded off to three places). That is, the integral is less than its trapezoidal approximation. This is because the second derivative f '' (x) = (1 +x²) -3/2 is always greater than 0, whence the curve is concave upwards and therefore y = f(x) is always less than or equal to the broken line used in the trapezoidal approximation. Actually, the value to three places is 1.148. This can be found by taking Δ x =____.
EXAMPLE 2 Consider the integral
|
Let f(x)= _____________
By Theorem 1, we have
|
However, the Trapezoidal Rule fails to give an error estimate in this case
Because f '(x) is discontinuous at x = __ 1.
We now turn to Simpson’s Rule, for which the number of subintervals n must be even. As before, we divide the interval [a, b] into n subintervals of equal length Δx with the n + 1 partition points
a = x0, x1, …xn = b.
We shall use subintervals of length 2 Δ x rather than Δ x. On each of the n/2 subintervals
[ x0 , x2], [ x2, x4], …[ xn-2, xn],
of length 2 Δx we approximate the curve y = f(x) by a parabolic arc that meets the curve at both endpoints and the midpoint of the subinterval, as shown in Figures 4.6.3. We then add up the areas under each of the parabolic arcs to obtain an approximation to the area under the curve, which is the definite integral. We begin with a lemma that gives a formula for the area of the region under one parabolic arc.
Figure 4.6.3
LEMMA
The area of the region under the parabola through three points (u, r), ( u+ h, s),
and (u+2h, t) (shown in Figure
4.6.4) is
Figure 4.6.4
____ (r + 4s +t).
The lemma is proved at the end of this section. Using the lemma, we find that the area of the region under one parabolic arc from xk to xk+2 is
______[ f(xk) + 4f(xk+1) + f(xk+2)].
It follows that the sum of the n/2 regions under the parabolic arcs is a modified Riemann sum,
|
This modified Riemann sum is Simpson’s approximation to the definite integral. Note the sequence of coefficients,
1, 4, 2, 4, 2…2, 4, 1.
Like the trapezoidal approximation, it is easily computed on a computer or hand calculator.
THEOREM 2
For a continuous function f on [ a, b] , Simpson’s approximation approaches the definite integral as Δx→ 0+,
|
Simpson’s approximation is almost as easy to calculate as the trapezoidal approximation, but is much more accurate. Simpson’s Rule is an error estimate that involves the forth derivative of the function and the fourth power of Δx.
SIMPSON’S RULE
Suppose the function f has a fourth derivative on the interval [a, b] that has absolute value at most M,
| f(4) (x) |≤ M for a ≤ x ≤ b.
If [a, b] is divided into an even number of subintervals of length Δx, then
Simpson’s approximation to the definite integral has the error estimate
|
EXAMPLE 3 Use Simpson’s Rule with Δx = 0.25 to approximate the integral
|
and find the error estimate.
The curve is the normal (bell- shaped ) curve used in statistics, shown in Figure 4.6.5.
We are to divide the interval [ 0,1] into four subintervals of equal length Δ x = 0.25. The following table shows the values of x and y and the coefficient to be used in Simpson’s approximation for each partition point.
Figure 4.6.5 Example 3
The sum used in the Simpson approximation is then
[ 1.000000 + 4·(0.969233) +2·(0.882496) + 4·(0.754840) + 0.606531]
= 10.267816
To get the Simpson approximation, we multiply this sum by Δx/3:
S = (10.267816) ·(0.25) /3 = 0.855651.
To find the error estimate we need the fourth derivative of
y = e -x²/2.
The fourth derivative can be computed as usual and turns out to be
y(4) = (x4 - 6x2 +3) e -x²/2.
On the interval [ 0, 1], y(4) is decreasing because both x4 - 6x2 +3 and -x2/2 are decreasing, and therefore y(4) has its maximum value at x = 0 and its minimum value at x = 1,
maximum: y(4) (0) =3
minimum: y(4) (1) = -1.213061
The maximum value of the absolute value | y(4)| is thus M = 3. The error estimate in Simpson’s Rule is then
|
This shows that the integral is within 0.000065 of the approximation; that is,
_______ e -x²/2 dx = 0.855651___ 0.000065,
Or using inequalities,
0.855586 ≤ ____e -x²/2dx ≤ 0.855716.
For comparison, a more accurate computation with a smaller Δ x shows that the actual value to six places is
____e -x²/2dx = 0.855624.
The Trapezoidal Rule for this integral and the same value of Δ x = 0.25 give an approximate value of 0.85246 for the integral and an error estimate of 0.00521.
PROOF OF THE LEMMA The algebra is simpler if the y-axis is drawn through the second point, so that u+ h = 0, and the three points have coordinates
( -h, r), (0, s), ( h, t).
Suppose the parabola has the equation y = ax² + bx + c. Then the area under the parabola is
A = __ (ax ²+ bx + c) dx
= ________
= ______ ah3 + 2ch.
When we substitute the coordinates of the three points ( -h, r), (0, s), ( h, t)
into the equation for the parabola, we obtain the three equations
r = ah² - bh + c.
s =c,
t = ah2 +bh +c.
Add the first and third equations and solve for a:
r + t = 2ah² + 2c
a= ________
Finally, substitute the above expression for a and s for c in the equation for the area:
A = ___ ah3 + 2ch
=_________ + 2ch
= __________·h
=____( r + 4c + t).
= ____ (r + 4s +t).
PROBLEMS FOR SECTION 4.6
Approximate the integrals in Problems 1-20 using (a) the Trapezoidal Rule and (b) Simpson’s Rule. When possible, find error estimates. If a hand calculator is available, do the problems again with Δ x = 0.1.
1 ___ xdx, Δ x = 0.5 2 ___x3dx, Δ x = 0.5
5______ dx, Δ x = 0.25 4______ dx, Δ x = 0.5
7___________ dx, Δ x = 0.5 8_________dx, Δ x = ____
9___________dx, Δ x = ___ 10 ________dx, Δ x = 0.5
11__________dx, Δ x = 1 12_________dx, Δ x = 2
13__________dx, Δ x = 3 14 __________dx, Δ x = 1
15 ___ _________ 16 __________
17____ex dx, Δx =_____ 18 ____ex² dx, Δx =_____
19_____1n x dx, Δx =_____ 20 ____1n (1/x) dx, Δx =_____
□21 let f be continuous on the interval [a,b] and let Δx=(b-a)/n where n is a positive integer. Prove that the trapezoidal sum is equal to the Riemann sum plus __ (f(b) - f(a)) Δx, that is ,
|
Show that if f(a) = f(b) then the trapezoidal sum and Riemann sum are equal.
□22 Prove that for a linear function f(x) = kx+c, the trapezoidal sum is exactly equal to the integral.
□23 Show that if f(x) is concave downward, f ''(x)>0, then the trapezoidal sum is less than the definite integral of f(x).
□24 Show that for a quadratic function f(x)=ax2 + bx +c, Simpson’s approximation is equal to the definite integral.
□25 show that for a cubic function f(x)=ax3 + bx2+cx +d, Simpson’s approximation is still equal to the definite integral.
EXTRA PROBLEMS FOR CHAPTER 4
1 Evaluate _______Δ x, Δ x = 1/4
2 Evaluate _______Δ x, Δ x = 2
3 Evaluate _______Δ x, Δ x = 1
4Evaluate _______Δ x, Δ x = 1/2
5 If F '(x) = 1/(2x-1)² for all x ≠1/2, find F(2) - F(1).
6 If G '(t) = ___________ for all t >-1/4, find G(2) - G(0).
7 A particle moves with velocity v =(3+2___)². How far does it move from times t0=1 to t1=5?
8A particle moves with velocity v =__________. How far does it move from times t0=1 to t1=4?
9 A particle moves with velocity v =(t+1)(2t+3). If it has position y0 =0 at time t=0, find its position at time t=10.
10A particle moves with acceleration a = 1/t4. If it has velocity v0 =4 and position y0 =2 at time t=1, find its position at time t =3 .
11 Find the area of the region under the curve y = 1/___ , 1 ≤ x ≤ 4.
12 Find the area of the region under the curve y=____, 0 ≤ x ≤ 1.
In Problems 13-30, evaluate the integral.
13 ∫ (1- x)(2+3x) dx 14 ∫ (2+____) (2- ___) dx
15 ∫______dx 16 ∫(4x+1)1/3 dx
17 ∫(u/_____) du 18 ∫x-2______dx
19 ∫(_______) dt 20 ∫ _______ dx
21 ∫ y_______ dy 21 ∫ (1-___)-4 dx
23 ∫ cos (__) dx 24 ∫ ___sin___ dx
25 ∫ e-tdt 26 ∫_______dt
27 ________dy 28____________dx
29 _____ e4x dx 30 ____ x sin(x²)dx
31 Differentiate ___ 32 Differentiate ___(t²/t²-1)) dt
33 Differentiate _______ dx 34 Differentiate ___(1/(x+_____)) dx
35 Find the function F such that F'(x) = x -1for all x, and the minimum value of F(x) is b.
36 Find the function F such that F''(x) = x for all x, F(0) =1, and F(1) =1
37 Find the function F such that F''(x) = 6 for all x, F(x) has a minimum at x =1, and the
minimum value is 2.
38 Find all functions F such that F''(x) = 1 + x-3 for all positive x.
□39 Find the functions F such that
|
and F(0) =1.
□40 Find the value of b such that the area of the region under the curve y= x(b-x),
0≤ x ≤ b, is1.
□41 Suppose f is increasing for a ≤ x≤ b, and Δx = (b-a)/n where n is a positive integer.
Show that
|
□42 Suppose f is continuous for a ≤ x ≤b. Show that
|
□43 Find the area of the top half of the ellipse x²/a² + y²/b² =1 using the formula
π =________du.
□44 Evaluate __ (1-x)3/2 (1+x)1/2 dx using the formula π =________du.
□45 Find dy/dx if y = __ xf(t)dt.
□46 Suppose f(t) is continuous for all t and let G(x) = __ (x - t) f(t) dt.
Prove that G''(x) = f(x).
□47 Prove that for any continuous functions f and g,
|
□48 Prove Schwartz' Inequality,
____ f(x) g(x) dx ≤________.
Hint: Use the preceding problem.
□49 Suppose f is continuous and dx is positive infinitesimal. Show that
____ f(x+__ dx) dx ≈ ____ f(x)dx.
Hint: for each positive real c,
F(x) - c < f (x+ __ dx) < f(x) + c.
Use this to show that
___ f(x)dx - c(b - a) < ___ f(x + ____ dx ) dx < __ f(x) dx + c(b-a).
□50 Suppose f is continuous, n is an integer, and dx is positive infinitesimal. Prove that
____ f(x + ndx) dx ≈ ___ f(x)dx.