Approximate Integration

Approximate Integration
Carmen Bruni
February 13, 2012
Definite Integrals
Sometimes its impossible to compute the indefinite integral of a
function.
Definite Integrals
Sometimes its impossible to compute the indefinite integral of a
function. For example, if
p
f (x) = 1 + x 3 sin(6x) + 14
then
Definite Integrals
Sometimes its impossible to compute the indefinite integral of a
function. For example, if
p
f (x) = 1 + x 3 sin(6x) + 14
then
Z
f (x)dx
has no nice formula.
Definite Integrals
Sometimes its impossible to compute the indefinite integral of a
function. For example, if
p
f (x) = 1 + x 3 sin(6x) + 14
then
Z
f (x)dx
has no nice formula.However, we should be able to compute or at
least approximate definite integrals of f (x), for example
Z
5
f (x)dx.
1
After all, definite integrals just represent area.
Definite Integral of f (x) =
√
1 + x 3 sin(6x) + 14
How do we approximate definite integrals?
Definite Integral of f (x) =
√
1 + x 3 sin(6x) + 14
How do we approximate definite integrals?
We have already seen 3 ways. Let x0 , x1 , .., xn be a partition of
[a, b] and let ∆x = b−a
n .
Definite Integral of f (x) =
√
1 + x 3 sin(6x) + 14
How do we approximate definite integrals?
We have already seen 3 ways. Let x0 , x1 , .., xn be a partition of
[a, b] and let ∆x = b−a
n .
Definite Integral of f (x) =
√
1 + x 3 sin(6x) + 14
How do we approximate definite integrals?
We have already seen 3 ways. Let x0 , x1 , .., xn be a partition of
[a, b] and let ∆x = b−a
n .
n
X
1. Left Endpoints Ln =
f (xi−1 )∆x.
i=0
Definite Integral of f (x) =
√
1 + x 3 sin(6x) + 14
How do we approximate definite integrals?
We have already seen 3 ways. Let x0 , x1 , .., xn be a partition of
[a, b] and let ∆x = b−a
n .
n
X
1. Left Endpoints Ln =
f (xi−1 )∆x.
i=0
n
X
2. Right Endpoints Rn =
i=0
f (xi )∆x.
Definite Integral of f (x) =
√
1 + x 3 sin(6x) + 14
How do we approximate definite integrals?
We have already seen 3 ways. Let x0 , x1 , .., xn be a partition of
[a, b] and let ∆x = b−a
n .
n
X
1. Left Endpoints Ln =
f (xi−1 )∆x.
i=0
n
X
2. Right Endpoints Rn =
3. Midpoint Rule Mn =
i=0
n
X
f (xi )∆x.
f (x̄i )∆x, where x̄i =
i=0
xi−1 +xi
.
2
Definite Integral of f (x) =
√
1 + x 3 sin(6x) + 14
How do we approximate definite integrals?
We have already seen 3 ways. Let x0 , x1 , .., xn be a partition of
[a, b] and let ∆x = b−a
n .
n
X
1. Left Endpoints Ln =
f (xi−1 )∆x.
i=0
n
X
2. Right Endpoints Rn =
3. Midpoint Rule Mn =
f (xi )∆x.
i=0
n
X
f (x̄i )∆x, where x̄i =
i=0
We will learn two additional ways today
xi−1 +xi
.
2
Definite Integral of f (x) =
√
1 + x 3 sin(6x) + 14
How do we approximate definite integrals?
We have already seen 3 ways. Let x0 , x1 , .., xn be a partition of
[a, b] and let ∆x = b−a
n .
n
X
1. Left Endpoints Ln =
f (xi−1 )∆x.
i=0
n
X
2. Right Endpoints Rn =
3. Midpoint Rule Mn =
f (xi )∆x.
i=0
n
X
f (x̄i )∆x, where x̄i =
i=0
We will learn two additional ways today
1. Trapezoid Rule
xi−1 +xi
.
2
Definite Integral of f (x) =
√
1 + x 3 sin(6x) + 14
How do we approximate definite integrals?
We have already seen 3 ways. Let x0 , x1 , .., xn be a partition of
[a, b] and let ∆x = b−a
n .
n
X
1. Left Endpoints Ln =
f (xi−1 )∆x.
i=0
n
X
2. Right Endpoints Rn =
3. Midpoint Rule Mn =
f (xi )∆x.
i=0
n
X
f (x̄i )∆x, where x̄i =
i=0
We will learn two additional ways today
1. Trapezoid Rule
2. Simpson’s Rule
xi−1 +xi
.
2
Left Endpoint Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Let’s try each of these methods with our function f (x) on [1, 5]
and using a partition of four subintervals. In these cases,
∆x = 5−1
4 = 1.
Left Endpoint Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Let’s try each of these methods with our function f (x) on [1, 5]
and using a partition of four subintervals. In these cases,
∆x = 5−1
4 = 1.
Left Endpoint Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
f (x)dx ≈ L4 = f (1)∆x + f (2)∆x + f (3)∆x + f (4)∆x
1
Left Endpoint Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
f (x)dx ≈ L4 = f (1)∆x + f (2)∆x + f (3)∆x + f (4)∆x
1
q
= ( 1 + (1)3 sin(6(1)) + 14)(1)
q
+( 1 + (2)3 sin(6(2)) + 14)(1)
q
+( 1 + (3)3 sin(6(3)) + 14)(1)
q
+( 1 + (4)3 sin(6(4)) + 14)(1)
Left Endpoint Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
f (x)dx ≈ L4 = f (1)∆x + f (2)∆x + f (3)∆x + f (4)∆x
1
q
= ( 1 + (1)3 sin(6(1)) + 14)(1)
q
+( 1 + (2)3 sin(6(2)) + 14)(1)
q
+( 1 + (3)3 sin(6(3)) + 14)(1)
q
+( 1 + (4)3 sin(6(4)) + 14)(1)
=
42.72027090
Right Endpoint Rule for f (x) =
Right endpoint rule now.
√
1 + x 3 sin(6x) + 14
Right Endpoint Rule for f (x) =
Right endpoint rule now.
√
1 + x 3 sin(6x) + 14
Right Endpoint Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
f (x)dx ≈ R4 = f (2)∆x + f (3)∆x + f (4)∆x + f (5)∆x
1
Right Endpoint Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
f (x)dx ≈ R4 = f (2)∆x + f (3)∆x + f (4)∆x + f (5)∆x
1
q
= ( 1 + (2)3 sin(6(2)) + 14)(1)
q
+( 1 + (3)3 sin(6(3)) + 14)(1)
q
+( 1 + (4)3 sin(6(4)) + 14)(1)
q
+( 1 + (5)3 sin(6(5)) + 14)(1)
Right Endpoint Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
f (x)dx ≈ R4 = f (2)∆x + f (3)∆x + f (4)∆x + f (5)∆x
1
q
= ( 1 + (2)3 sin(6(2)) + 14)(1)
q
+( 1 + (3)3 sin(6(3)) + 14)(1)
q
+( 1 + (4)3 sin(6(4)) + 14)(1)
q
+( 1 + (5)3 sin(6(5)) + 14)(1)
=
32.02479662
Midpoint Rule for f (x) =
Midpoint rule now.
√
1 + x 3 sin(6x) + 14
Midpoint Rule for f (x) =
Midpoint rule now.
√
1 + x 3 sin(6x) + 14
Midpoint Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
f (x)dx ≈ M4 = f (1.5)∆x + f (2.5)∆x + f (3.5)∆x + f (4.5)∆x
1
Midpoint Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
f (x)dx ≈ M4 = f (1.5)∆x + f (2.5)∆x + f (3.5)∆x + f (4.5)∆x
1
q
= ( 1 + (1.5)3 sin(6(1.5)) + 14)(1)
q
+( 1 + (2.5)3 sin(6(2.5)) + 14)(1)
q
+( 1 + (3.5)3 sin(6(3.5)) + 14)(1)
q
+( 1 + (4.5)3 sin(6(4.5)) + 14)(1)
Midpoint Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
f (x)dx ≈ M4 = f (1.5)∆x + f (2.5)∆x + f (3.5)∆x + f (4.5)∆x
1
q
= ( 1 + (1.5)3 sin(6(1.5)) + 14)(1)
q
+( 1 + (2.5)3 sin(6(2.5)) + 14)(1)
q
+( 1 + (3.5)3 sin(6(3.5)) + 14)(1)
q
+( 1 + (4.5)3 sin(6(4.5)) + 14)(1)
=
74.23479834
Other Rules? The Trapezoid Rule.
How do we get new rules?
Other Rules? The Trapezoid Rule.
How do we get new rules? One way is to take combinations of the
above rules. For example, lets try taking half the left endpoint rule
and half the right endpoint rule. This gives us the trapezoid rule.
Tn
=
1
1
Ln + Rn
2
2
Other Rules? The Trapezoid Rule.
How do we get new rules? One way is to take combinations of the
above rules. For example, lets try taking half the left endpoint rule
and half the right endpoint rule. This gives us the trapezoid rule.
Tn
=
=
1
1
Ln + Rn
2
2
n
n
X
1
1X
f (xi−1 )∆x +
f (xi−1 )∆x
2
2
i=0
i=0
Other Rules? The Trapezoid Rule.
How do we get new rules? One way is to take combinations of the
above rules. For example, lets try taking half the left endpoint rule
and half the right endpoint rule. This gives us the trapezoid rule.
Tn
=
=
=
1
1
Ln + Rn
2
2
n
n
X
1
1X
f (xi−1 )∆x +
f (xi−1 )∆x
2
2
i=0
i=0
1
(f (x0 )∆x + f (x1 )∆x + ... + f (xn−1 )∆x)
2
+(f (x1 )∆x + ... + f (xn−1 )∆x + f (xn )∆x)
Other Rules? The Trapezoid Rule.
How do we get new rules? One way is to take combinations of the
above rules. For example, lets try taking half the left endpoint rule
and half the right endpoint rule. This gives us the trapezoid rule.
Tn
=
=
=
1
1
Ln + Rn
2
2
n
n
X
1
1X
f (xi−1 )∆x +
f (xi−1 )∆x
2
2
i=0
i=0
1
(f (x0 )∆x + f (x1 )∆x + ... + f (xn−1 )∆x)
2
+(f (x1 )∆x + ... + f (xn−1 )∆x + f (xn )∆x)
=
∆x
(f (x0 ) + 2f (x1 ) + ... + 2f (xn−1 ) + f (xn ))
2
Trapezoid Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Why is it called the trapezoid rule? Well,
Trapezoid Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Why is it called the trapezoid rule? Well,
Trapezoid Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
∆x
(f (x0 ) + 2f (x1 ) + 2f (x2 ) + 2f (x3 ) + f (x4 ))
f (x)dx ≈ T4 =
2
1
Trapezoid Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
∆x
(f (x0 ) + 2f (x1 ) + 2f (x2 ) + 2f (x3 ) + f (x4 ))
f (x)dx ≈ T4 =
2
1
q
= 0.5 ( 1 + (1)3 sin(6(1)) + 14)(1)
q
+2( 1 + (2)3 sin(6(2)) + 14)(1)
q
+2( 1 + (3)3 sin(6(3)) + 14)(1)
q
+2( 1 + (4)3 sin(6(4)) + 14)(1)
q
+( 1 + (5)3 sin(6(5)) + 14)(1)
Trapezoid Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
∆x
(f (x0 ) + 2f (x1 ) + 2f (x2 ) + 2f (x3 ) + f (x4 ))
f (x)dx ≈ T4 =
2
1
q
= 0.5 ( 1 + (1)3 sin(6(1)) + 14)(1)
q
+2( 1 + (2)3 sin(6(2)) + 14)(1)
q
+2( 1 + (3)3 sin(6(3)) + 14)(1)
q
+2( 1 + (4)3 sin(6(4)) + 14)(1)
q
+( 1 + (5)3 sin(6(5)) + 14)(1)
=
37.37253376
How good are these rules?
How close do these rules get to the actual answer?
How good are these rules?
How close do these rules get to the actual answer? It turns out
that the left and right endpoint rules do not give us a good
estimate on how far we are from the actual answer. The midpoint
and trapezoid rules however do lend themselves to good error
bounds.
How good are these rules?
How close do these rules get to the actual answer? It turns out
that the left and right endpoint rules do not give us a good
estimate on how far we are from the actual answer. The midpoint
and trapezoid rules however do lend themselves to good error
bounds. To describe this, we define the error of the trapezoid rule
to be
Z
b
f (x)dx − Tn
ET =
a
How good are these rules?
How close do these rules get to the actual answer? It turns out
that the left and right endpoint rules do not give us a good
estimate on how far we are from the actual answer. The midpoint
and trapezoid rules however do lend themselves to good error
bounds. To describe this, we define the error of the trapezoid rule
to be
Z
b
f (x)dx − Tn
ET =
a
and the error of the midpoint rule to be
Z
b
f (x)dx − Mn .
EM =
a
How good are these rules?
How close do these rules get to the actual answer? It turns out
that the left and right endpoint rules do not give us a good
estimate on how far we are from the actual answer. The midpoint
and trapezoid rules however do lend themselves to good error
bounds. To describe this, we define the error of the trapezoid rule
to be
Z
b
f (x)dx − Tn
ET =
a
and the error of the midpoint rule to be
Z
b
f (x)dx − Mn .
EM =
a
Note that we could only compute the error term exactly if we knew
the value of the integral already (and if we knew that then what’s
the point of doing this!) However, it turns out that we can bound
the error.
A Bound on the Error
Theorem: Suppose that |f 00 (x)| ≤ K for all x ∈ [a, b] and for
some constant K ∈ R. If ET and EM are the errors in the
trapezoid and midpoint rules respectively, then
|ET | ≤
K (b − a)3
12n2
|EM | ≤
K (b − a)3
.
24n2
and
A Bound on the Error
Theorem: Suppose that |f 00 (x)| ≤ K for all x ∈ [a, b] and for
some constant K ∈ R. If ET and EM are the errors in the
trapezoid and midpoint rules respectively, then
|ET | ≤
and
K (b − a)3
.
24n2
is twice as good as the bound for
|EM | ≤
Notice that the bound for EM
ET .
K (b − a)3
12n2
Example Question using the error bound
Question:
How large does n have to be in order to estimate
R 1 −x 2
dx
within
0.001 using the trapezoid rule? How about with
e
0
the midpoint rule?
Example Question using the error bound
Question:
How large does n have to be in order to estimate
R 1 −x 2
dx
within
0.001 using the trapezoid rule? How about with
e
0
the midpoint rule?
2
Solution: Set f (x) = e −x .
Example Question using the error bound
Question:
How large does n have to be in order to estimate
R 1 −x 2
dx
within
0.001 using the trapezoid rule? How about with
e
0
the midpoint rule?
2
2
Solution: Set f (x) = e −x . Then f 0 (x) = −2xe −x and
Example Question using the error bound
Question:
How large does n have to be in order to estimate
R 1 −x 2
dx
within
0.001 using the trapezoid rule? How about with
e
0
the midpoint rule?
2
2
Solution: Set f (x) = e −x . Then f 0 (x) = −2xe −x and
2
2
2
f 00 (x) = −2e −x + 4x 2 e −x = e −x (4x 2 − 2).
Example Question using the error bound
Question:
How large does n have to be in order to estimate
R 1 −x 2
dx
within
0.001 using the trapezoid rule? How about with
e
0
the midpoint rule?
2
2
Solution: Set f (x) = e −x . Then f 0 (x) = −2xe −x and
2
2
2
f 00 (x) = −2e −x + 4x 2 e −x = e −x (4x 2 − 2).
I claim that this function is increasing form 0 to 1. To see this,
notice that the third derivative is
2
2
f 000 (x) = e −x (12x − 8x 3 ) = 4xe −x (3 − 2x 2 )
and this function is greater than or equal to 0 between 0 and 1.
Example Question using the error bound
Question:
How large does n have to be in order to estimate
R 1 −x 2
dx
within
0.001 using the trapezoid rule? How about with
e
0
the midpoint rule?
2
2
Solution: Set f (x) = e −x . Then f 0 (x) = −2xe −x and
2
2
2
f 00 (x) = −2e −x + 4x 2 e −x = e −x (4x 2 − 2).
I claim that this function is increasing form 0 to 1. To see this,
notice that the third derivative is
2
2
f 000 (x) = e −x (12x − 8x 3 ) = 4xe −x (3 − 2x 2 )
and this function is greater than or equal to 0 between 0 and 1.
Hence the derivative is positive on [0, 1] and so the function is
increasing there. Hence the maximum value of f 00 (x) on [0, 1]
occurs at x = 1 which gives the value
2
K = f 00 (1) = e −(1) (4(1)2 − 2) =
2
= 0.7357588824
e
Example Question using the error bound
Question:
How large does n have to be in order to estimate
R 1 −x 2
dx
within
0.001 using the trapezoid rule? How about
e
0
with the midpoint rule?
Solution: With K = 0.7357588824, we use the error bounding
theorem and note that
ET ≤ 0.001
whenever
K (b − a)3
≤ 0.001.
12n2
Example Question using the error bound
Question:
How large does n have to be in order to estimate
R 1 −x 2
dx
within
0.001 using the trapezoid rule? How about
e
0
with the midpoint rule?
Solution: With K = 0.7357588824, we use the error bounding
theorem and note that
ET ≤ 0.001
whenever
K (b − a)3
≤ 0.001.
12n2
Plugging in our K , a = 0 and b = 1 values and solving for n, we
see that we need n at least as large as
K (b − a)3
≤ 0.001
12n2
⇒ (0.7357588824)(1 − 0)3 ≤ 12(0.001)n2
s
0.7357588824
⇒
≤n
12(0.001)
⇒ 7.830277147 ≤ n
So we need n to be at least 8.
Example Question using the error bound
Question:
How large does n have to be in order to estimate
R 1 −x 2
dx
within
0.001 using the trapezoid rule? How about with
e
0
the midpoint rule?
Solution: For the midpoint rule, we use the error bounding
theorem and note that
K (b − a)3
EM ≤ 0.001 whenever
≤ 0.001.
24n2
Example Question using the error bound
Question:
How large does n have to be in order to estimate
R 1 −x 2
dx
within
0.001 using the trapezoid rule? How about with
e
0
the midpoint rule?
Solution: For the midpoint rule, we use the error bounding
theorem and note that
K (b − a)3
EM ≤ 0.001 whenever
≤ 0.001.
24n2
Plugging in our K = 0.7357588824, a = 0 and b = 1 values and
solving for n, we see that we need n at least as large as
K (b − a)3
≤ 0.001
24n2
⇒ (0.7357588824)(1 − 0)3 ≤ 24(0.001)n2
s
0.7357588824
⇒
≤n
24(0.001)
⇒ 5.536842069 ≤ n
So we need n to be at least 6.
Example Question using the error bound
Question:
How large does n have to be in order to estimate
R 1 −x 2
dx
within
0.001 using the trapezoid rule? How about with
e
0
the midpoint rule?
Solution: For the midpoint rule, we use the error bounding
theorem and note that
K (b − a)3
EM ≤ 0.001 whenever
≤ 0.001.
24n2
Plugging in our K = 0.7357588824, a = 0 and b = 1 values and
solving for n, we see that we need n at least as large as
K (b − a)3
≤ 0.001
24n2
⇒ (0.7357588824)(1 − 0)3 ≤ 24(0.001)n2
s
0.7357588824
⇒
≤n
24(0.001)
⇒ 5.536842069 ≤ n
So we need n to be at least 6. Notice that this n is smaller than the
one needed for the trapezoid rule because its a better estimation.
Other Rules? Simpson’s Rule.
Named after English mathematician Thomas Simpson
(1710-1761). For this rule, we can only apply it with an even
number of sub intervals. We try to combine the left, right, and
midpoint rules. We start by trying a third of each.
1
1
1
1
2
1
1
Ln + Rn + Mn = (Ln + Rn ) + Mn = Tn + Mn
3
3
3
3
3
3
3
Other Rules? Simpson’s Rule.
Named after English mathematician Thomas Simpson
(1710-1761). For this rule, we can only apply it with an even
number of sub intervals. We try to combine the left, right, and
midpoint rules. We start by trying a third of each.
1
1
1
1
2
1
1
Ln + Rn + Mn = (Ln + Rn ) + Mn = Tn + Mn
3
3
3
3
3
3
3
Remember the error bounds? We said that Mn was twice as good
as Tn and so these fractions are the wrong way. To change this,
we weigh the Mn piece twice as much. This gives
1
2
1
2
1
S2n = Ln + Rn + Mn = Tn + Mn .
6
6
3
3
3
Simpson’s Rule expanded
Let’s expand this rule. We need a diagram.
Simpson’s Rule expanded
Let’s expand this rule. We need a diagram.
So notice that yi = x2i , ȳi = x2i−1 and
∆y =
b−a
b−a
=2
= 2∆x
n
2n
A Formula for Simpson’s Rule
Hence,
S2n
=
1
2
Tn + Mn
3
3
A Formula for Simpson’s Rule
Hence,
S2n
=
=
1
Tn +
3
1 ∆y
·
3 2
2
Mn
3
(f (y0 ) + 2f (y1 ) + ... + 2f (yn−1 ) + f (yn ))
2
+ · ∆y (f (ȳ1 ) + f (ȳ2 ) + ... + f (ȳn ))
3
A Formula for Simpson’s Rule
Hence,
S2n
=
=
1
Tn +
3
1 ∆y
·
3 2
2
Mn
3
(f (y0 ) + 2f (y1 ) + ... + 2f (yn−1 ) + f (yn ))
2
+ · ∆y (f (ȳ1 ) + f (ȳ2 ) + ... + f (ȳn ))
3
=
∆x
f (x2(0) ) + 2f (x2(1) ) + ... + 2f (x2(n−1) ) + f (x2(n) )
3
4∆x
+
f (x2(1)−1 ) + f (x2(2)−1 ) + ... + f (x2(n)−1 )
3
A Formula for Simpson’s Rule
Hence,
S2n
=
=
1
Tn +
3
1 ∆y
·
3 2
2
Mn
3
(f (y0 ) + 2f (y1 ) + ... + 2f (yn−1 ) + f (yn ))
2
+ · ∆y (f (ȳ1 ) + f (ȳ2 ) + ... + f (ȳn ))
3
=
=
∆x
f (x2(0) ) + 2f (x2(1) ) + ... + 2f (x2(n−1) ) + f (x2(n) )
3
4∆x
+
f (x2(1)−1 ) + f (x2(2)−1 ) + ... + f (x2(n)−1 )
3
∆x (f (x0 ) + 2f (x2 ) + ... + 2f (x2n−2 ) + f (x2n ))
3
+(4f (x1 ) + 4f (x3 ) + ... + 4f (x2n−1 ))
A Formula for Simpson’s Rule
Hence,
S2n
=
=
1
Tn +
3
1 ∆y
·
3 2
2
Mn
3
(f (y0 ) + 2f (y1 ) + ... + 2f (yn−1 ) + f (yn ))
2
+ · ∆y (f (ȳ1 ) + f (ȳ2 ) + ... + f (ȳn ))
3
=
=
=
∆x
f (x2(0) ) + 2f (x2(1) ) + ... + 2f (x2(n−1) ) + f (x2(n) )
3
4∆x
+
f (x2(1)−1 ) + f (x2(2)−1 ) + ... + f (x2(n)−1 )
3
∆x (f (x0 ) + 2f (x2 ) + ... + 2f (x2n−2 ) + f (x2n ))
3
+(4f (x1 ) + 4f (x3 ) + ... + 4f (x2n−1 ))
∆x
f (x0 ) + 4f (x1 ) + 2f (x2 ) + 4f (x3 ) + 2f (x4 ) + ...
3
+2f (x2n−2 ) + 4f (x2n−1 ) + f (x2n )
Simpson’s Rule for f (x) =
Our last example,
√
1 + x 3 sin(6x) + 14
Simpson’s Rule for f (x) =
Our last example,
√
1 + x 3 sin(6x) + 14
Simpson’s Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
∆x
f (x)dx ≈ S4 =
(f (x0 ) + 4f (x1 ) + 2f (x2 ) + 4f (x3 ) + f (x4 ))
3
1
Simpson’s Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
∆x
f (x)dx ≈ S4 =
(f (x0 ) + 4f (x1 ) + 2f (x2 ) + 4f (x3 ) + f (x4 ))
3
1
q
= 13 ( 1 + (1)3 sin(6(1)) + 14)(1)
q
+4( 1 + (2)3 sin(6(2)) + 14)(1)
q
+2( 1 + (3)3 sin(6(3)) + 14)(1)
q
+4( 1 + (4)3 sin(6(4)) + 14)(1)
q
+( 1 + (5)3 sin(6(5)) + 14)(1)
Simpson’s Rule for f (x) =
√
1 + x 3 sin(6x) + 14
Using the formula, we see that
Z 5
∆x
f (x)dx ≈ S4 =
(f (x0 ) + 4f (x1 ) + 2f (x2 ) + 4f (x3 ) + f (x4 ))
3
1
q
= 13 ( 1 + (1)3 sin(6(1)) + 14)(1)
q
+4( 1 + (2)3 sin(6(2)) + 14)(1)
q
+2( 1 + (3)3 sin(6(3)) + 14)(1)
q
+4( 1 + (4)3 sin(6(4)) + 14)(1)
q
+( 1 + (5)3 sin(6(5)) + 14)(1)
=
37.04120590
A Bound on the Error
Let m be an even integer. As before, let
Z
b
f (x)dx − Sm .
ES =
a
A Bound on the Error
Let m be an even integer. As before, let
Z
b
f (x)dx − Sm .
ES =
a
Then
Theorem: Suppose that |f 0000 (x)| ≤ K for all x ∈ [a, b] and for
some constant K ∈ R. Then
|ES | ≤
K (b − a)5
.
180m4