Docsity

Approximate Values for Definite Integrals: Trapezoidal Rule and Simpson's Rule - Prof. Qin, Study notes of Calculus

Toggle sidebar
bg1
•First •Prev •Next •Last •Go Back •Full Screen •Close •Quit
8.7 Numerical integration
AIM: Given a function f(x), we want to evaluate the definite integral
Zb
a
f(x)dx.
So far, we have learned many integration techniques.
However, in some situations, it is impossible to find the exact value.
Situation 1: There are many integrals of functions that do not have elementary antiderivatives. For instance,
Rsin x2dx R√1 + x4dx
Rex
xdx Reexdx
Rex2dx R1
ln xdx
Rln (ln x)dx Rsin x
xdx
Rsin x
xdx Rcos (ex)dx
These integrals look easy, but it can be proved that there is no way to express these integrals as finite combination of elementary
functions.
Situation 2: When a function is determined from a scientific experiment through instrument readings or collected data, there may
be no formula for the function.
In both cases, we need to find approximate values for definite integrals.
How to find approximate values?
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Approximate Values for Definite Integrals: Trapezoidal Rule and Simpson's Rule - Prof. Qin and more Study notes Calculus in PDF only on Docsity!

8.7 Numerical integration AIM: Given a function f (x), we want to evaluate the definite integral ∫ (^) b

a

f (x) dx.

So far, we have learned many integration techniques. However, in some situations, it is impossible to find the exact value. Situation 1: There are many integrals of functions that do not have elementary antiderivatives. For instance, ∫ sin x^2 dx

1 + x^4 dx ∫ (^) ex x dx^

eex dx ∫ ex^2 dx

ln x dx ∫ ln (ln x) dx

∫ (^) sin x x dx ∫ (^) sin x x dx^

cos (ex) dx

These integrals look easy, but it can be proved that there is no way to express these integrals as finite combination of elementary functions.

Situation 2: When a function is determined from a scientific experiment through instrument readings or collected data, there may be no formula for the function.

In both cases, we need to find approximate values for definite integrals. How to find approximate values?

One method we already know: approximate by Riemann Sums:

∫ (^) b

a

f (x) dx ≈

∑^ n

k=

f (ck) ∆xk

However, Riemann Sums approximation is sometime not very efficient. We want better approximations. The Trapezoidal Rule

The exact value of the integral is (^) ∫ 2 1

x^2 dx = x^3 3

|^21 =

The Error is 299 128

The percentage error is 3841 /^73 = 0.0011 = 0.11%.

Error Estimates for the Trapezoidal rule

A result from advanced calculus says that if f ′′^ is continuous on [a, b], then ∫ (^) b

a

f (x)dx = T − b^ −^ a 12 · f ′′(c)(∆x)^2

for some number c between a and b. Thus, as ∆x approaches zero, the error defined by

ET = − b − a 12 · f ′′(c)(∆x)^2

approaches zero as the square of ∆x. Note that if |f ′′(x)| ≤ M on [a, b], then

|ET | = |

b − a 12 · f ′′(c)(∆x)^2 |

= |b^ −^ a 12 · f ′′(c)(b^ −^ a n

)^2 |

b − a 12

· M (

b − a n

)^2

M (b − a)^3 12 n^2

Example: How many subdivisions should be used in the Trapezoidal Rule to approximate

ln 2 =

1

x dx

with an error whose absolute value is less than 10 −^4?

Simpson’s Rule: Approximation using parabolas

The area is then approximated by adding the areas under all the parabolas: ∫ (^) b

a

f (x)dx ≈ h 3 (y 0 + 4y 1 + y 2 ) + h 3 (y 2 + 4y 3 + y 4 ) + · · ·

h 3 (yn− 2 + 4yn− 1 + yn)

= h 3 (y 0 + 4y 1 + 2y 2 + 4y 3 + 2y 4 · · · + 2yn− 2 + 4yn− 1 + yn)

Note the pattern of the coefficients in the above rule:

1 , 4 , 2 , 4 , 2 , 4 , 2 , · · · , 4 , 2 , 4 , 1.

Error Estimates for Simpson’s Rule

A result from advanced calculus says that if the fourth derivative f (4)^ is continuous on [a, b], then ∫ (^) b

a

f (x)dx = S − b − a 180 · f (4)(c)(∆x)^4

for some number c between a and b. Thus, as ∆x approaches zero, the error defined by

ES = − b − a 180 · f (4)(c)(∆x)^4

approaches zero as the fourth power of ∆x. Note that if |f (4)(x)| ≤ M on [a, b], then

|ES | = |b^ −^ a 180 · f (4)(c)(∆x)^4 |

= | b − a 180 · f (4)(c)( b − a n

)^4 |

≤ b^ −^ a 180 · M (b^ −^ a n

)^4

M (b − a)^5 180 n^4.

Example: Use Simpson’s Rule with n = 4 to approximate

0 5 x (^4) dx.

Example: Use Simpson’s Rule with n = 8 to estimate

1 x (^2) dx. Compare the estimate with the exact value. Solution: Partition [1, 2] into 8 subintervals of equal length. x 1 98 54 118 32 138 74 158 2 y = x^2 1 81642516121649416964491622564