Section 5.7
Numerical Integration
Math 1a
Introduction to Calculus
April 25, 2008
Announcements
◮ Midterm III is Wednesday 4/30 in class (covers §4.9–5.6) ◮ Friday 5/2 is Movie Day!
Announcements
◮ Midterm III is Wednesday 4/30 in class (covers §4.9–5.6)
◮ Friday 5/2 is Movie Day!
◮ Final (tentative) 5/23 9:15am
◮ Problem Sessions Sunday, Thursday, 7pm, SC 310
Outline
Last Time: Integration by Parts
The Trapezoidal Rule
Trapezoids instead of rectangles
The Midpoint Rule
Simpson’s Rule
Error estimates for the Trapezoidal and Midpoint Rules
Theorem (Integration by Parts)
Let u and v be differentiable functions. Then
∫
u(x)v′(x)dx=u(x)v(x)
− ∫
v(x)u′(x)dx .
Succinctly,
∫
u dv=uv− ∫
v du.
Theorem (Integration by Parts, definite form)
b
a u dv uv b
Theorem (Integration by Parts)
Let u and v be differentiable functions. Then
∫
u(x)v′(x)dx=u(x)v(x)
− ∫
v(x)u′(x)dx .
Succinctly,
∫
u dv=uv− ∫
v du.
Theorem (Integration by Parts, definite form)
∫ b
a u dv= uv
¯ ¯ ¯ ¯
b
a−
∫ b
Outline
Last Time: Integration by Parts
The Trapezoidal Rule
Trapezoids instead of rectangles
The Midpoint Rule
Simpson’s Rule
Error estimates for the Trapezoidal and Midpoint Rules
Why estimate an integral when we have the FTC?
◮ Antidifferentiation is
“hard”
◮ Sometimes
antidifferentiation is
impossible
◮ Sometimes all we need
is an approximation
◮ These methods actually
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
Why not average them out and make a trapezoid?
A
f xi 1 f xi
2 x
The smaller the
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
Why not average them out and make a trapezoid?
A
f xi 1 f xi
2 x
The smaller the
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
◮ Why not average them
out and make a trapezoid?
∆A=
f xi 1 f xi
2 x
The smaller the
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
◮ Why not average them
out and make a trapezoid?
∆A= f(xi−1) +f(xi)
2 ∆x
The smaller the
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
◮ Why not average them
out and make a trapezoid?
∆A= f(xi−1) +f(xi)
2 ∆x
◮ The smaller the
The Trapezoidal Rule
Definition
Divide the interval[a,b]up intonpieces. Let∆x=
b−a n , xi=a+i∆x, andyi =f(xi)for eachifrom 1 ton.
The(n+1)-pointTrapezoidal Ruleapproximation to
∫ b
a f(x)dx
is given by
Tn(f) = n
∑
i=1
f(xi−1) +f(xi)
2 ∆x
= ∆x
[y 0+y1
2 +
y1+y2
2 +· · ·+
yn−1+yn
2
]
= ∆x
2
(
y0+2y1+2y2+· · ·+2yn−1+yn
Example
Example Estimate∫ 1
0 x
2dxwith the Trapezoidal Rule andn=4.
Solution
The set of values is
y0 y1 y2 y3 y4 0 1 4
2 2 4
2 3 4
2 4 4
2
So
Tn f 2 41 0 2 161 2 164 2 169 1616
1 8
2 8 18 16
16 44
Example
Example Estimate∫ 1
0 x
2dxwith the Trapezoidal Rule andn=4.
Solution
The set of values is
{
y0,y1,y2,y3,y4
}
={0,(1
4 )2 , (2 4 )2 , (3 4 )2 , (4 4
)2}
So
Tn(f) =21
·4 (
0+2·
1
16 +2·
4
16+2·
9 16+ 16 16 ) = 1 8 (2
+8+18+16
16
)
Your Turn
Example Estimate
ln 2=
∫ 2
1
1
xdx
with the Trapezoidal Rule andn=8.
Your Turn
Example Estimate
ln 2=
∫ 2
1
1
xdx
with the Trapezoidal Rule andn=8.
Outline
Last Time: Integration by Parts
The Trapezoidal Rule
Trapezoids instead of rectangles
The Midpoint Rule
Simpson’s Rule
Error estimates for the Trapezoidal and Midpoint Rules
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
Another possibility would be to average the
points.
A
f xi 1 xi
2 x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
Another possibility would be to average the
points.
A
f xi 1 xi
2 x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
Another possibility would be to average the
points.
A
f xi 1 xi
2 x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
◮ Another possibility
would be to average the
points.
∆A=
f xi 1 xi
2 x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
◮ Another possibility
would be to average the
points.
∆A=f
(x
i−1+xi 2
)
∆x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
◮ Another possibility
would be to average the
points.
∆A=f
(x
i−1+xi 2
)
∆x
◮ Again, the smaller the
The Midpoint Rule
Definition
Divide the interval[a,b]up intonpieces. Let∆x=
b−a
n , and
xi=a+i∆xfor eachifrom 1 ton.
The(n+1)-pointMidpoint Ruleapproximation to
∫ b
a f(x)dxis
given by
Mn(f) = n
∑
i=1
f (x
i−1+xi 2
)
∆x
= ∆x
( f
(x 0+x1
2
)
+f
(x 1+x2
2
)
+· · ·+f (x
n−1+xn 2
Example
Example Estimate∫ 1
0 x
2dxwith the Midpoint Rule andn=4.
Solution
The set of midpoints is
0 18 38 58 78
So
Mn f 14 0 18 2 38 2 58 2 78 2
1 4
1 9 25 49
64 84
Example
Example Estimate∫ 1
0 x
2dxwith the Midpoint Rule andn=4.
Solution
The set of midpoints is
{
0,18,
3 8, 5 8, 7 8 } So
Mn(f) =14
(
0+(1 8
)2
+(3
8 )2
+(5
8 )2
+(7
8 )2)
= 1
4
(1
+9+25+49
64
)
Your Turn
Example Estimate
ln 2=
∫ 2
1
1
xdx
with the Midpoint Rule andn=8.
Your Turn
Example Estimate
ln 2=
∫ 2
1
1
xdx
with the Midpoint Rule andn=8.
Outline
Last Time: Integration by Parts
The Trapezoidal Rule
Trapezoids instead of rectangles
The Midpoint Rule
Simpson’s Rule
Error estimates for the Trapezoidal and Midpoint Rules
Parabolas instead of lines
.
◮ Trapezoidal Rule
approximates the function with a line
◮ Why not use a parabola?
◮ A section of a parabola
passing through equally spaced points is
∆x
3 (y0+4y1+y2)
◮ need an even number of
Simpson’s Rule
Definition
Divide the interval[a,b]up intonpieces, wherenis even. Let
∆x= b−a
n ,xi=a+i∆x, andyi =f(xi)for eachifrom 1 ton.
The(n+1)-pointSimpson’s Ruleapproximation to
∫ b
a f(x)dxis
given by
Sn(f) = n/2 ∑
i=1
∆x
3
(
y2i+4y2i+1+y2i+2
)
= b−a
3n (
y0+4y1+2y2+4y3+· · ·+2yn−2+4yn−1+yn
Meet the Simpsons
Thomas Simpson
Examples
Example
Use Simpson’s rule withn=4 to estimate
∫ 1
0 x 2dx
Solution
y0 y1 y2 y3 y4 0 14 2 24 2 34 2 44 2
So
S4 f 3 41 0 4 161 2 164 4 169 1616
1 12
4 8 36 16
16
1 12
64 16
1 3
Examples
Example
Use Simpson’s rule withn=4 to estimate
∫ 1
0 x 2dx
Solution
{
y0,y1,y2,y3,y4
}
={0,(1
4 )2 , (2 4 )2 , (3 4 )2 , (4 4
)2}
So
S4(f) =31 ·4
(
0+4·
1
16 +2·
4
16 +4·
9 16+ 16 16 ) = 1 12 (4
+8+36+16
16 ) = 1 12 · 64 16 = 1 3
Examples
Example
Use Simpson’s rule withn=4 to estimate
∫ 1
0 x 2dx
Solution
{
y0,y1,y2,y3,y4
}
={0,(1
4 )2 , (2 4 )2 , (3 4 )2 , (4 4
)2}
So
S4(f) =31 ·4
(
0+4·
1
16 +2·
4
16 +4·
9 16+ 16 16 ) = 1 12 (4
+8+36+16
Your turn
Example
Use Simpson’s Rule withn=8 to estimate ln 2.
Your turn
Example
Use Simpson’s Rule withn=8 to estimate ln 2.
Section 5.7
Numerical Integration
Math 1a
Introduction to Calculus
April 25, 2008
Announcements
◮ Midterm III is Wednesday 4/30 in class (covers §4.9–5.6) ◮ Friday 5/2 is Movie Day!
Announcements
◮ Midterm III is Wednesday 4/30 in class (covers §4.9–5.6)
◮ Friday 5/2 is Movie Day!
◮ Final (tentative) 5/23 9:15am
◮ Problem Sessions Sunday, Thursday, 7pm, SC 310
Outline
Last Time: Integration by Parts
The Trapezoidal Rule
Trapezoids instead of rectangles
The Midpoint Rule
Simpson’s Rule
Error estimates for the Trapezoidal and Midpoint Rules
Theorem (Integration by Parts)
Let u and v be differentiable functions. Then
∫
u(x)v′(x)dx=u(x)v(x)
− ∫
v(x)u′(x)dx .
Succinctly,
∫
u dv=uv− ∫
v du.
Theorem (Integration by Parts, definite form)
b
a u dv uv b
Theorem (Integration by Parts)
Let u and v be differentiable functions. Then
∫
u(x)v′(x)dx=u(x)v(x)
− ∫
v(x)u′(x)dx .
Succinctly,
∫
u dv=uv− ∫
v du.
Theorem (Integration by Parts, definite form)
∫ b
a u dv= uv
¯ ¯ ¯ ¯
b
a−
∫ b
Outline
Last Time: Integration by Parts
The Trapezoidal Rule
Trapezoids instead of rectangles
The Midpoint Rule
Simpson’s Rule
Error estimates for the Trapezoidal and Midpoint Rules
Why estimate an integral when we have the FTC?
◮ Antidifferentiation is
“hard”
◮ Sometimes
antidifferentiation is
impossible
◮ Sometimes all we need
is an approximation
◮ These methods actually
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
Why not average them out and make a trapezoid?
A
f xi 1 f xi
2 x
The smaller the
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
Why not average them out and make a trapezoid?
A
f xi 1 f xi
2 x
The smaller the
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
◮ Why not average them
out and make a trapezoid?
∆A=
f xi 1 f xi
2 x
The smaller the
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
◮ Why not average them
out and make a trapezoid?
∆A= f(xi−1) +f(xi)
2 ∆x
The smaller the
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
◮ Why not average them
out and make a trapezoid?
∆A= f(xi−1) +f(xi)
2 ∆x
◮ The smaller the
The Trapezoidal Rule
Definition
Divide the interval[a,b]up intonpieces. Let∆x=
b−a n , xi=a+i∆x, andyi =f(xi)for eachifrom 1 ton.
The(n+1)-pointTrapezoidal Ruleapproximation to
∫ b
a f(x)dx
is given by
Tn(f) = n
∑
i=1
f(xi−1) +f(xi)
2 ∆x
= ∆x
[y 0+y1
2 +
y1+y2
2 +· · ·+
yn−1+yn
2
]
= ∆x
2
(
y0+2y1+2y2+· · ·+2yn−1+yn
Example
Example Estimate∫ 1
0 x
2dxwith the Trapezoidal Rule andn=4.
Solution
The set of values is
y0 y1 y2 y3 y4 0 1 4
2 2 4
2 3 4
2 4 4
2
So
Tn f 2 41 0 2 161 2 164 2 169 1616
1 8
2 8 18 16
16 44
Example
Example Estimate∫ 1
0 x
2dxwith the Trapezoidal Rule andn=4.
Solution
The set of values is
{
y0,y1,y2,y3,y4
}
={0,(1
4 )2 , (2 4 )2 , (3 4 )2 , (4 4
)2}
So
Tn(f) =21
·4 (
0+2·
1
16 +2·
4
16+2·
9 16+ 16 16 ) = 1 8 (2
+8+18+16
16
)
Your Turn
Example Estimate
ln 2=
∫ 2
1
1
xdx
with the Trapezoidal Rule andn=8.
Your Turn
Example Estimate
ln 2=
∫ 2
1
1
xdx
with the Trapezoidal Rule andn=8.
Outline
Last Time: Integration by Parts
The Trapezoidal Rule
Trapezoids instead of rectangles
The Midpoint Rule
Simpson’s Rule
Error estimates for the Trapezoidal and Midpoint Rules
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
Another possibility would be to average the
points.
A
f xi 1 xi
2 x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
Another possibility would be to average the
points.
A
f xi 1 xi
2 x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
Another possibility would be to average the
points.
A
f xi 1 xi
2 x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
◮ Another possibility
would be to average the
points.
∆A=
f xi 1 xi
2 x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
◮ Another possibility
would be to average the
points.
∆A=f
(x
i−1+xi 2
)
∆x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
◮ Another possibility
would be to average the
points.
∆A=f
(x
i−1+xi 2
)
∆x
◮ Again, the smaller the
The Midpoint Rule
Definition
Divide the interval[a,b]up intonpieces. Let∆x=
b−a
n , and
xi=a+i∆xfor eachifrom 1 ton.
The(n+1)-pointMidpoint Ruleapproximation to
∫ b
a f(x)dxis
given by
Mn(f) = n
∑
i=1
f (x
i−1+xi 2
)
∆x
= ∆x
( f
(x 0+x1
2
)
+f
(x 1+x2
2
)
+· · ·+f (x
n−1+xn 2
Example
Example Estimate∫ 1
0 x
2dxwith the Midpoint Rule andn=4.
Solution
The set of midpoints is
0 18 38 58 78
So
Mn f 14 0 18 2 38 2 58 2 78 2
1 4
1 9 25 49
64 84
Example
Example Estimate∫ 1
0 x
2dxwith the Midpoint Rule andn=4.
Solution
The set of midpoints is
{
0,18,
3 8, 5 8, 7 8 } So
Mn(f) =14
(
0+(1 8
)2
+(3
8 )2
+(5
8 )2
+(7
8 )2)
= 1
4
(1
+9+25+49
64
)
Your Turn
Example Estimate
ln 2=
∫ 2
1
1
xdx
with the Midpoint Rule andn=8.
Your Turn
Example Estimate
ln 2=
∫ 2
1
1
xdx
with the Midpoint Rule andn=8.
Outline
Last Time: Integration by Parts
The Trapezoidal Rule
Trapezoids instead of rectangles
The Midpoint Rule
Simpson’s Rule
Error estimates for the Trapezoidal and Midpoint Rules
Parabolas instead of lines
.
◮ Trapezoidal Rule
approximates the function with a line
◮ Why not use a parabola?
◮ A section of a parabola
passing through equally spaced points is
∆x
3 (y0+4y1+y2)
◮ need an even number of
Simpson’s Rule
Definition
Divide the interval[a,b]up intonpieces, wherenis even. Let
∆x= b−a
n ,xi=a+i∆x, andyi =f(xi)for eachifrom 1 ton.
The(n+1)-pointSimpson’s Ruleapproximation to
∫ b
a f(x)dxis
given by
Sn(f) = n/2 ∑
i=1
∆x
3
(
y2i+4y2i+1+y2i+2
)
= b−a
3n (
y0+4y1+2y2+4y3+· · ·+2yn−2+4yn−1+yn
Meet the Simpsons
Thomas Simpson
Examples
Example
Use Simpson’s rule withn=4 to estimate
∫ 1
0 x 2dx
Solution
y0 y1 y2 y3 y4 0 14 2 24 2 34 2 44 2
So
S4 f 3 41 0 4 161 2 164 4 169 1616
1 12
4 8 36 16
16
1 12
64 16
1 3
Examples
Example
Use Simpson’s rule withn=4 to estimate
∫ 1
0 x 2dx
Solution
{
y0,y1,y2,y3,y4
}
={0,(1
4 )2 , (2 4 )2 , (3 4 )2 , (4 4
)2}
So
S4(f) =31 ·4
(
0+4·
1
16 +2·
4
16 +4·
9 16+ 16 16 ) = 1 12 (4
+8+36+16
16 ) = 1 12 · 64 16 = 1 3
Examples
Example
Use Simpson’s rule withn=4 to estimate
∫ 1
0 x 2dx
Solution
{
y0,y1,y2,y3,y4
}
={0,(1
4 )2 , (2 4 )2 , (3 4 )2 , (4 4
)2}
So
S4(f) =31 ·4
(
0+4·
1
16 +2·
4
16 +4·
9 16+ 16 16 ) = 1 12 (4
+8+36+16
Your turn
Example
Use Simpson’s Rule withn=8 to estimate ln 2.
Your turn
Example
Use Simpson’s Rule withn=8 to estimate ln 2.
Section 5.7
Numerical Integration
Math 1a
Introduction to Calculus
April 25, 2008
Announcements
◮ Midterm III is Wednesday 4/30 in class (covers §4.9–5.6) ◮ Friday 5/2 is Movie Day!
Announcements
◮ Midterm III is Wednesday 4/30 in class (covers §4.9–5.6)
◮ Friday 5/2 is Movie Day!
◮ Final (tentative) 5/23 9:15am
◮ Problem Sessions Sunday, Thursday, 7pm, SC 310
Outline
Last Time: Integration by Parts
The Trapezoidal Rule
Trapezoids instead of rectangles
The Midpoint Rule
Simpson’s Rule
Error estimates for the Trapezoidal and Midpoint Rules
Theorem (Integration by Parts)
Let u and v be differentiable functions. Then
∫
u(x)v′(x)dx=u(x)v(x)
− ∫
v(x)u′(x)dx .
Succinctly,
∫
u dv=uv− ∫
v du.
Theorem (Integration by Parts, definite form)
b
a u dv uv b
Theorem (Integration by Parts)
Let u and v be differentiable functions. Then
∫
u(x)v′(x)dx=u(x)v(x)
− ∫
v(x)u′(x)dx .
Succinctly,
∫
u dv=uv− ∫
v du.
Theorem (Integration by Parts, definite form)
∫ b
a u dv= uv
¯ ¯ ¯ ¯
b
a−
∫ b
Outline
Last Time: Integration by Parts
The Trapezoidal Rule
Trapezoids instead of rectangles
The Midpoint Rule
Simpson’s Rule
Error estimates for the Trapezoidal and Midpoint Rules
Why estimate an integral when we have the FTC?
◮ Antidifferentiation is
“hard”
◮ Sometimes
antidifferentiation is
impossible
◮ Sometimes all we need
is an approximation
◮ These methods actually
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
Why not average them out and make a trapezoid?
A
f xi 1 f xi
2 x
The smaller the
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
Why not average them out and make a trapezoid?
A
f xi 1 f xi
2 x
The smaller the
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
◮ Why not average them
out and make a trapezoid?
∆A=
f xi 1 f xi
2 x
The smaller the
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
◮ Why not average them
out and make a trapezoid?
∆A= f(xi−1) +f(xi)
2 ∆x
The smaller the
Trapezoids instead of rectangles
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ In the case of a simple
decreasing function like this one, clearlyLnis too
much andRnis not
enough.
◮ Why not average them
out and make a trapezoid?
∆A= f(xi−1) +f(xi)
2 ∆x
◮ The smaller the
The Trapezoidal Rule
Definition
Divide the interval[a,b]up intonpieces. Let∆x=
b−a n , xi=a+i∆x, andyi =f(xi)for eachifrom 1 ton.
The(n+1)-pointTrapezoidal Ruleapproximation to
∫ b
a f(x)dx
is given by
Tn(f) = n
∑
i=1
f(xi−1) +f(xi)
2 ∆x
= ∆x
[y 0+y1
2 +
y1+y2
2 +· · ·+
yn−1+yn
2
]
= ∆x
2
(
y0+2y1+2y2+· · ·+2yn−1+yn
Example
Example Estimate∫ 1
0 x
2dxwith the Trapezoidal Rule andn=4.
Solution
The set of values is
y0 y1 y2 y3 y4 0 1 4
2 2 4
2 3 4
2 4 4
2
So
Tn f 2 41 0 2 161 2 164 2 169 1616
1 8
2 8 18 16
16 44
Example
Example Estimate∫ 1
0 x
2dxwith the Trapezoidal Rule andn=4.
Solution
The set of values is
{
y0,y1,y2,y3,y4
}
={0,(1
4 )2 , (2 4 )2 , (3 4 )2 , (4 4
)2}
So
Tn(f) =21
·4 (
0+2·
1
16 +2·
4
16+2·
9 16+ 16 16 ) = 1 8 (2
+8+18+16
16
)
Your Turn
Example Estimate
ln 2=
∫ 2
1
1
xdx
with the Trapezoidal Rule andn=8.
Your Turn
Example Estimate
ln 2=
∫ 2
1
1
xdx
with the Trapezoidal Rule andn=8.
Outline
Last Time: Integration by Parts
The Trapezoidal Rule
Trapezoids instead of rectangles
The Midpoint Rule
Simpson’s Rule
Error estimates for the Trapezoidal and Midpoint Rules
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
Another possibility would be to average the
points.
A
f xi 1 xi
2 x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
Another possibility would be to average the
points.
A
f xi 1 xi
2 x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
Another possibility would be to average the
points.
A
f xi 1 xi
2 x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
◮ Another possibility
would be to average the
points.
∆A=
f xi 1 xi
2 x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
◮ Another possibility
would be to average the
points.
∆A=f
(x
i−1+xi 2
)
∆x
Midpoints to cancel out the slop
. .
xi−1 .xi .
f(xi−1)
.
f(xi)
◮ The Trapezoidal Rule
averages the values
◮ Another possibility
would be to average the
points.
∆A=f
(x
i−1+xi 2
)
∆x
◮ Again, the smaller the
The Midpoint Rule
Definition
Divide the interval[a,b]up intonpieces. Let∆x=
b−a
n , and
xi=a+i∆xfor eachifrom 1 ton.
The(n+1)-pointMidpoint Ruleapproximation to
∫ b
a f(x)dxis
given by
Mn(f) = n
∑
i=1
f (x
i−1+xi 2
)
∆x
= ∆x
( f
(x 0+x1
2
)
+f
(x 1+x2
2
)
+· · ·+f (x
n−1+xn 2
Example
Example Estimate∫ 1
0 x
2dxwith the Midpoint Rule andn=4.
Solution
The set of midpoints is
0 18 38 58 78
So
Mn f 14 0 18 2 38 2 58 2 78 2
1 4
1 9 25 49
64 84
Example
Example Estimate∫ 1
0 x
2dxwith the Midpoint Rule andn=4.
Solution
The set of midpoints is
{
0,18,
3 8, 5 8, 7 8 } So
Mn(f) =14
(
0+(1 8
)2
+(3
8 )2
+(5
8 )2
+(7
8 )2)
= 1
4
(1
+9+25+49
64
)
Your Turn
Example Estimate
ln 2=
∫ 2
1
1
xdx
with the Midpoint Rule andn=8.
Your Turn
Example Estimate
ln 2=
∫ 2
1
1
xdx
with the Midpoint Rule andn=8.
Outline
Last Time: Integration by Parts
The Trapezoidal Rule
Trapezoids instead of rectangles
The Midpoint Rule
Simpson’s Rule
Error estimates for the Trapezoidal and Midpoint Rules
Parabolas instead of lines
.
◮ Trapezoidal Rule
approximates the function with a line
◮ Why not use a parabola?
◮ A section of a parabola
passing through equally spaced points is
∆x
3 (y0+4y1+y2)
◮ need an even number of
Simpson’s Rule
Definition
Divide the interval[a,b]up intonpieces, wherenis even. Let
∆x= b−a
n ,xi=a+i∆x, andyi =f(xi)for eachifrom 1 ton.
The(n+1)-pointSimpson’s Ruleapproximation to
∫ b
a f(x)dxis
given by
Sn(f) = n/2 ∑
i=1
∆x
3
(
y2i+4y2i+1+y2i+2
)
= b−a
3n (
y0+4y1+2y2+4y3+· · ·+2yn−2+4yn−1+yn
Meet the Simpsons
Thomas Simpson
Examples
Example
Use Simpson’s rule withn=4 to estimate
∫ 1
0 x 2dx
Solution
y0 y1 y2 y3 y4 0 14 2 24 2 34 2 44 2
So
S4 f 3 41 0 4 161 2 164 4 169 1616
1 12
4 8 36 16
16
1 12
64 16
1 3
Examples
Example
Use Simpson’s rule withn=4 to estimate
∫ 1
0 x 2dx
Solution
{
y0,y1,y2,y3,y4
}
={0,(1
4 )2 , (2 4 )2 , (3 4 )2 , (4 4
)2}
So
S4(f) =31 ·4
(
0+4·
1
16 +2·
4
16 +4·
9 16+ 16 16 ) = 1 12 (4
+8+36+16
16 ) = 1 12 · 64 16 = 1 3
Examples
Example
Use Simpson’s rule withn=4 to estimate
∫ 1
0 x 2dx
Solution
{
y0,y1,y2,y3,y4
}
={0,(1
4 )2 , (2 4 )2 , (3 4 )2 , (4 4
)2}
So
S4(f) =31 ·4
(
0+4·
1
16 +2·
4
16 +4·
9 16+ 16 16 ) = 1 12 (4
+8+36+16
Your turn
Example
Use Simpson’s Rule withn=8 to estimate ln 2.
Your turn
Example
Use Simpson’s Rule withn=8 to estimate ln 2.