Midpoint Approximation: B A B A
Midpoint Approximation: B A B A
Midpoint Approximation
Rb
Sometimes, we need to approximate an integral of the form a f (x)dx and we
cannot find an antiderivative
in order to evaluate the integral. Also we may
Rb
need to evaluate a f (x)dx where we do not have a formula for f (x) but we
have data describing a set of values of the function.
Review
We might approximate the given integral using a Riemann sum. Already we
have looked at theR left end-point approximation and the right end point
b
approximation to a f (x)dx in Calculus 1. We also looked at the midpoint
approximation M:
Midpoint Rule If f is integrable on [a, b], then
Z
f (x)dx Mn =
a
n
X
i=1
where
x =
ba
n
Annette Pilkington
1
(xi1 +xi ) = midpoint of [xi1 , xi ].
2
Approximating an integral
Midpoint Approximation
Example Use the midpoint rule with n = 6 to approximate
(= ln(4) = 1.386294361)
Fill in the tables below:
Annette Pilkington
Approximating an integral
R4
1
dx.
1 x
Midpoint Approximation
Example Use the midpoint rule with n = 6 to approximate
(= ln(4) = 1.386294361)
Fill in the tables below:
I
x =
41
6
1
2
Annette Pilkington
Approximating an integral
R4
1
dx.
1 x
Midpoint Approximation
Example Use the midpoint rule with n = 6 to approximate
(= ln(4) = 1.386294361)
Fill in the tables below:
I
x =
41
6
R4
1
dx.
1 x
1
2
xi
x0 = 1
x1 = 3/2
x2 = 2
Annette Pilkington
x3 = 5/2
x4 = 3
Approximating an integral
x5 = 7/2
x6 = 4
Midpoint Approximation
Example Use the midpoint rule with n = 6 to approximate
(= ln(4) = 1.386294361)
Fill in the tables below:
I
x =
41
6
R4
1
dx.
1 x
1
2
xi
x0 = 1
x1 = 3/2
x2 = 2
x3 = 5/2
x4 = 3
x5 = 7/2
x6 = 4
I
xi = 1 (xi1 + xi )
2
f (xi ) = 1
xi
x1 = 5/4
x2 = 7/4
4/5
4/7
Annette Pilkington
x3 = 9/4
4/9
x4 = 11/4
x5 = 13/4
x6 = 15/4
4/11
4/13
4/15
Approximating an integral
Midpoint Approximation
Example Use the midpoint rule with n = 6 to approximate
(= ln(4) = 1.386294361)
Fill in the tables below:
I
x =
41
6
R4
1
dx.
1 x
1
2
xi
x0 = 1
x1 = 3/2
x2 = 2
x3 = 5/2
x4 = 3
x5 = 7/2
x6 = 4
I
xi = 1 (xi1 + xi )
2
f (xi ) = 1
xi
M6 =
P6
1
x1 = 5/4
x2 = 7/4
4/5
4/7
f (xi )x =
1
2
4
5
4
7
Annette Pilkington
4
9
x3 = 9/4
4/9
4
11
4
13
x4 = 11/4
x5 = 13/4
x6 = 15/4
4/11
4/13
4/15
4
15
= 1.376934177
Approximating an integral
Trapezoidal Rule
Rb
We can also approximate a definite integral a f (x)dx using an approximation
by trapezoids as shown in the picture below for f (x) 0
f (x)dx Tn =
a
x
(f (x0 ) + 2f (x1 ) + 2f (x2 ) + + +2f (xn1 ) + f (xn ))
2
where
x =
ba
n
and
Annette Pilkington
xi = a + ix and.
Approximating an integral
Trapezoidal Rule
Z b
a
f (x)dx Tn =
x
2
where
ba
and
x =
n
xi = a + ix and.
Annette Pilkington
Approximating an integral
R4
1
dx.
1 x
(=
Trapezoidal Rule
Z b
a
f (x)dx Tn =
x
2
where
ba
and
x =
n
xi = a + ix and.
x =
41
6
1
2
Annette Pilkington
Approximating an integral
R4
1
dx.
1 x
(=
Trapezoidal Rule
Z b
a
f (x)dx Tn =
x
2
where
ba
and
x =
n
xi = a + ix and.
x =
41
6
R4
1
dx.
1 x
(=
1
2
xi
x0 = 1
x1 = 3/2
x2 = 2
Annette Pilkington
x3 = 5/2
x4 = 3
Approximating an integral
x5 = 7/2
x6 = 4
Trapezoidal Rule
Z b
a
f (x)dx Tn =
x
2
where
ba
and
x =
n
xi = a + ix and.
x =
41
6
R4
1
dx.
1 x
(=
1
2
xi
x0 = 1
x1 = 3/2
x2 = 2
x3 = 5/2
x4 = 3
x5 = 7/2
I
xi
f (xi ) = 1
xi
x0 = 1
x1 = 3/2
x2 = 2
Annette Pilkington
x3 = 5/2
x4 = 3
Approximating an integral
x5 = 7/2
x6 = 4
x6 = 4
Trapezoidal Rule
Z b
a
f (x)dx Tn =
x
2
where
ba
x =
and
n
xi = a + ix and.
x =
xi
41
6
x0 = 1
xi
f (xi ) = 1
xi
R4
1
dx.
1 x
1
2
x1 = 3/2
x0 = 1
1
x2 = 2
x1 = 3/2
2/3
x3 = 5/2
x2 = 2
1/2
Annette Pilkington
x4 = 3
x3 = 5/2
2/5
x5 = 7/2
x4 = 3
1/3
x6 = 4
x5 = 7/2
2/7
Approximating an integral
x6 = 4
1/4
(=
Trapezoidal Rule
Z b
a
f (x)dx Tn =
x
2
where
ba
x =
and
n
xi = a + ix and.
x =
xi
I
I
41
6
x0 = 1
xi
f (xi ) = 1
xi
T6 =
x
(f
2
R4
1
dx.
1 x
(=
1
2
x1 = 3/2
x0 = 1
1
x2 = 2
x1 = 3/2
2/3
x3 = 5/2
x2 = 2
1/2
x4 = 3
x3 = 5/2
2/5
x5 = 7/2
x4 = 3
1/3
x6 = 4
x5 = 7/2
2/7
x6 = 4
1/4
Annette Pilkington
Approximating an integral
Trapezoidal Rule
Z b
a
f (x)dx Tn =
x
2
where
ba
x =
and
n
xi = a + ix and.
x =
xi
I
I
I
41
6
x0 = 1
xi
f (xi ) = 1
xi
T6 =
=
1
dx.
1 x
(=
1
2
x1 = 3/2
x0 = 1
1
x2 = 2
x1 = 3/2
2/3
x3 = 5/2
x2 = 2
1/2
x4 = 3
x3 = 5/2
2/5
x5 = 7/2
x4 = 3
1/3
x6 = 4
x5 = 7/2
2/7
x
(f
2
1
(1
4
R4
x6 = 4
1/4
Annette Pilkington
Approximating an integral
Trapezoidal Rule
Z b
a
f (x)dx Tn =
x
2
where
ba
x =
and
n
xi = a + ix and.
x =
xi
I
I
41
6
x0 = 1
xi
f (xi ) = 1
xi
T6 =
1
dx.
1 x
(=
1
2
x1 = 3/2
x0 = 1
1
x2 = 2
x1 = 3/2
2/3
x3 = 5/2
x2 = 2
1/2
x4 = 3
x3 = 5/2
2/5
x5 = 7/2
x4 = 3
1/3
x6 = 4
x5 = 7/2
2/7
x
(f
2
1
(1
4
R4
x6 = 4
1/4
= 1.405357143.
Annette Pilkington
Approximating an integral
Error of Approximation
The error when using an approximation is the difference between the true value
of the integral and the approximation.
Annette Pilkington
Approximating an integral
Error of Approximation
The error when using an approximation is the difference between the true value
of the integral and the approximation.
I
Annette Pilkington
Approximating an integral
Error of Approximation
The error when using an approximation is the difference between the true value
of the integral and the approximation.
I
K (b a)3
12n2
Annette Pilkington
and
|EM |
K (b a)3
24n2
Approximating an integral
Error of Approximation
Error Bounds If |f 00 (x)| K for a x b. Let ET and EM denote the errors
for the trapezoidal approximation and midpoint approximation respectively,
then
3
3
|ET |
K (b a)
12n2
and
|EM |
K (b a)
24n2
Annette Pilkington
Approximating an integral
Error of Approximation
Error Bounds If |f 00 (x)| K for a x b. Let ET and EM denote the errors
for the trapezoidal approximation and midpoint approximation respectively,
then
3
3
|ET |
K (b a)
12n2
and
|EM |
K (b a)
24n2
f (x) = x1 , f 0 (x) =
1
,
x2
f 00 (x) =
Annette Pilkington
2
x3
Approximating an integral
Error of Approximation
Error Bounds If |f 00 (x)| K for a x b. Let ET and EM denote the errors
for the trapezoidal approximation and midpoint approximation respectively,
then
3
3
|ET |
K (b a)
12n2
and
|EM |
K (b a)
24n2
f (x) = x1 , f 0 (x) =
We can use the above formula for the error bound with any value of K for
which |f 00 (x)| K for 1 x 4.
1
,
x2
f 00 (x) =
Annette Pilkington
2
x3
Approximating an integral
Error of Approximation
Error Bounds If |f 00 (x)| K for a x b. Let ET and EM denote the errors
for the trapezoidal approximation and midpoint approximation respectively,
then
3
3
|ET |
K (b a)
12n2
and
|EM |
K (b a)
24n2
f (x) = x1 , f 0 (x) =
We can use the above formula for the error bound with any value of K for
which |f 00 (x)| K for 1 x 4.
Since |f 00 (x)| = f 00 (x) = x23 is a decreasing function on the interval [1, 4],
we have that |f 00 (x)| f 00 (1) = 2 on the interval [1, 4]. So we can use
K = 2 in the formula for the error bound above.
1
,
x2
f 00 (x) =
Annette Pilkington
2
x3
Approximating an integral
Error of Approximation
Error Bounds If |f 00 (x)| K for a x b. Let ET and EM denote the errors
for the trapezoidal approximation and midpoint approximation respectively,
then
3
3
|ET |
K (b a)
12n2
and
|EM |
K (b a)
24n2
f (x) = x1 , f 0 (x) =
We can use the above formula for the error bound with any value of K for
which |f 00 (x)| K for 1 x 4.
Since |f 00 (x)| = f 00 (x) = x23 is a decreasing function on the interval [1, 4],
we have that |f 00 (x)| f 00 (1) = 2 on the interval [1, 4]. So we can use
K = 2 in the formula for the error bound above.
1
,
x2
f 00 (x) =
Annette Pilkington
2
x3
Approximating an integral
Error of Approximation
Error Bounds If |f 00 (x)| K for a x b. Let ET and EM denote the errors
for the trapezoidal approximation and midpoint approximation respectively,
then
3
3
|ET |
K (b a)
12n2
and
|EM |
K (b a)
24n2
f (x) = x1 , f 0 (x) =
We can use the above formula for the error bound with any value of K for
which |f 00 (x)| K for 1 x 4.
Since |f 00 (x)| = f 00 (x) = x23 is a decreasing function on the interval [1, 4],
we have that |f 00 (x)| f 00 (1) = 2 on the interval [1, 4]. So we can use
K = 2 in the formula for the error bound above.
Note that the bound for the error given by the formula is conservative
since it turns out to give |ET | 0.045 when n = 10, compared to a true
error of |ET | = 0.00696667.
1
,
x2
f 00 (x) =
Annette Pilkington
2
x3
Approximating an integral
Error of Approximation
|ET |
K (b a)3
12n2
and
|EM |
K (b a)3
24n2
Example(b) Give
R 4 an upper bound for the error in the midpoint
approximation of 1 x1 dx when n = 10.
(c) Using the error bounds given above determine how large should n be to
ensure that the trapezoidal approximation is accurate to within 0.000001
= 106 ?
Annette Pilkington
Approximating an integral
Error of Approximation
|ET |
K (b a)3
12n2
and
|EM |
K (b a)3
24n2
Example(b) Give
R 4 an upper bound for the error in the midpoint
approximation of 1 x1 dx when n = 10.
I As above, we can use K = 2 to get
|EM |
K (b a)3
2(3)3
=
= 0.0225.
2
24n
24(10)2
(c) Using the error bounds given above determine how large should n be to
ensure that the trapezoidal approximation is accurate to within 0.000001
= 106 ?
Annette Pilkington
Approximating an integral
Error of Approximation
|ET |
K (b a)3
12n2
and
|EM |
K (b a)3
24n2
Example(b) Give
R 4 an upper bound for the error in the midpoint
approximation of 1 x1 dx when n = 10.
I As above, we can use K = 2 to get
|EM |
K (b a)3
2(3)3
=
= 0.0225.
2
24n
24(10)2
(c) Using the error bounds given above determine how large should n be to
ensure that the trapezoidal approximation is accurate to within 0.000001
= 106 ?
I We want |ET | 106 .
Annette Pilkington
Approximating an integral
Error of Approximation
|ET |
K (b a)3
12n2
and
|EM |
K (b a)3
24n2
Example(b) Give
R 4 an upper bound for the error in the midpoint
approximation of 1 x1 dx when n = 10.
I As above, we can use K = 2 to get
|EM |
K (b a)3
2(3)3
=
= 0.0225.
2
24n
24(10)2
(c) Using the error bounds given above determine how large should n be to
ensure that the trapezoidal approximation is accurate to within 0.000001
= 106 ?
I We want |ET | 106 .
3
I We have |ET | K (ba) , where K = 2 since |f 00 (x)| 2 for 1 x 4.
12n2
Annette Pilkington
Approximating an integral
Error of Approximation
|ET |
K (b a)3
12n2
and
|EM |
K (b a)3
24n2
Example(b) Give
R 4 an upper bound for the error in the midpoint
approximation of 1 x1 dx when n = 10.
I As above, we can use K = 2 to get
|EM |
K (b a)3
2(3)3
=
= 0.0225.
2
24n
24(10)2
(c) Using the error bounds given above determine how large should n be to
ensure that the trapezoidal approximation is accurate to within 0.000001
= 106 ?
I We want |ET | 106 .
3
I We have |ET | K (ba) , where K = 2 since |f 00 (x)| 2 for 1 x 4.
12n2
I
Annette Pilkington
Approximating an integral
Error of Approximation
|ET |
K (b a)3
12n2
and
|EM |
K (b a)3
24n2
Example(b) Give
R 4 an upper bound for the error in the midpoint
approximation of 1 x1 dx when n = 10.
I As above, we can use K = 2 to get
|EM |
K (b a)3
2(3)3
=
= 0.0225.
2
24n
24(10)2
(c) Using the error bounds given above determine how large should n be to
ensure that the trapezoidal approximation is accurate to within 0.000001
= 106 ?
I We want |ET | 106 .
3
I We have |ET | K (ba) , where K = 2 since |f 00 (x)| 2 for 1 x 4.
12n2
I
That is
(106 )2(27)
12
n2
Annette Pilkington
Approximating an integral
Error of Approximation
|ET |
K (b a)3
12n2
and
|EM |
K (b a)3
24n2
Example(b) Give
R 4 an upper bound for the error in the midpoint
approximation of 1 x1 dx when n = 10.
I As above, we can use K = 2 to get
|EM |
K (b a)3
2(3)3
=
= 0.0225.
2
24n
24(10)2
(c) Using the error bounds given above determine how large should n be to
ensure that the trapezoidal approximation is accurate to within 0.000001
= 106 ?
I We want |ET | 106 .
3
I We have |ET | K (ba) , where K = 2 since |f 00 (x)| 2 for 1 x 4.
12n2
I
That is
or n
(106 )2(27)
12
n2
(106 )2(27)
12
Approximating an integral
Simpsons Rule
We can also approximate a definite integral using parabolas to approximate the
curve as in the picture below. [note n is even].
f (x)dx Sn =
x
3
where
ba
and
n
= 13 Tn + 23 Mn .
x =
In fact we have S2n
Annette Pilkington
xi = a + ix and.
Approximating an integral
Simpsons Rule
Z b
a
f (x)dx Sn =
x
3
Annette Pilkington
R4
Approximating an integral
1
dx.
1 x
(=
Simpsons Rule
Z b
a
f (x)dx Sn =
x
3
x =
41
6
R4
1
2
Annette Pilkington
Approximating an integral
1
dx.
1 x
(=
Simpsons Rule
Z b
a
f (x)dx Sn =
x
3
x =
41
6
R4
1
dx.
1 x
(=
1
2
I
xi
f (xi ) = 1
xi
x0 = 1
1
x1 = 3/2
2/3
x2 = 2
1/2
Annette Pilkington
x3 = 5/2
2/5
x4 = 3
1/3
Approximating an integral
x5 = 7/2
2/7
x6 = 4
1/4
Simpsons Rule
Z b
a
f (x)dx Sn =
x
3
x =
41
6
R4
1
dx.
1 x
(=
1
2
I
xi
f (xi ) = 1
xi
S6 =
x
(f
3
x0 = 1
1
x1 = 3/2
2/3
x2 = 2
1/2
x3 = 5/2
2/5
x4 = 3
1/3
x5 = 7/2
2/7
x6 = 4
1/4
Annette Pilkington
Approximating an integral
Simpsons Rule
Z b
a
f (x)dx Sn =
x
3
x =
41
6
R4
1
dx.
1 x
(=
1
2
I
xi
f (xi ) = 1
xi
I
I
x0 = 1
1
x1 = 3/2
2/3
x2 = 2
1/2
x3 = 5/2
2/5
x4 = 3
1/3
x5 = 7/2
2/7
x6 = 4
1/4
Annette Pilkington
Approximating an integral
Simpsons Rule
Z b
a
f (x)dx Sn =
x
3
x =
41
6
R4
1
dx.
1 x
(=
1
2
I
xi
f (xi ) = 1
xi
x0 = 1
1
x1 = 3/2
2/3
x2 = 2
1/2
x3 = 5/2
2/5
x4 = 3
1/3
x5 = 7/2
2/7
x6 = 4
1/4
Z
ES =
1
1
dx S6 =
x
Approximating an integral
K (b a)5
180n4
Example How
R 4large should n be in order to guarantee that the Simpson rule
estimate for 1 x1 dx is accurate to within 0.000001 = 106 ?
Annette Pilkington
Approximating an integral
K (b a)5
180n4
Example How
R 4large should n be in order to guarantee that the Simpson rule
estimate for 1 x1 dx is accurate to within 0.000001 = 106 ?
I
, f 00 (x) = x23 ,
f (3) (x) =
f (x) = x1 ,
f 0 (x) = 1
x2
(4)
433
f (x) = x 5 24 (for 1 k 4 ) = K
Annette Pilkington
Approximating an integral
(3)2
,
x4
K (b a)5
180n4
Example How
R 4large should n be in order to guarantee that the Simpson rule
estimate for 1 x1 dx is accurate to within 0.000001 = 106 ?
I
, f 00 (x) = x23 ,
f (3) (x) =
f (x) = x1 ,
f 0 (x) = 1
x2
(4)
433
f (x) = x 5 24 (for 1 k 4 ) = K
We have |ES |
24(3)5
180n4
Annette Pilkington
Approximating an integral
(3)2
,
x4
K (b a)5
180n4
Example How
R 4large should n be in order to guarantee that the Simpson rule
estimate for 1 x1 dx is accurate to within 0.000001 = 106 ?
(3)2
,
x4
, f 00 (x) = x23 ,
f (3) (x) =
f (x) = x1 ,
f 0 (x) = 1
x2
(4)
433
f (x) = x 5 24 (for 1 k 4 ) = K
We have |ES |
24(3)5
180n4
6
Annette Pilkington
Approximating an integral
K (b a)5
180n4
Example How
R 4large should n be in order to guarantee that the Simpson rule
estimate for 1 x1 dx is accurate to within 0.000001 = 106 ?
(3)2
,
x4
, f 00 (x) = x23 ,
f (3) (x) =
f (x) = x1 ,
f 0 (x) = 1
x2
(4)
433
f (x) = x 5 24 (for 1 k 4 ) = K
We have |ES |
10
we
get
that
10
n
or
n
106 24(3)
= 75.
4
180
180
180n
n = 76 will work.
24(3)5
180n4
6
Annette Pilkington
Approximating an integral
K (b a)5
180n4
Example How
R 4large should n be in order to guarantee that the Simpson rule
estimate for 1 x1 dx is accurate to within 0.000001 = 106 ?
(3)2
,
x4
, f 00 (x) = x23 ,
f (3) (x) =
f (x) = x1 ,
f 0 (x) = 1
x2
(4)
433
f (x) = x 5 24 (for 1 k 4 ) = K
We have |ES |
10
we
get
that
10
n
or
n
106 24(3)
= 75.
4
180
180
180n
n = 76 will work.
24(3)5
180n4
6
This is a conservative upper bound of the error, the actual error for
n = 76 is 8 10 8
Annette Pilkington
Approximating an integral