approximate integration: the trapezoidal rule claus schubert may 25, 2000
Post on 11-Jan-2016
212 Views
Preview:
TRANSCRIPT
Approximate Integration:The Trapezoidal Rule
Claus SchubertMay 25, 2000
Why Approximate Integration?
Can’t always find an antiderivative
Example: dxex1
0
2
Don’t always know the function
First Approach: Riemann Sums
Use left or right Riemann sums to approximate the integral.
b
a
n
ii xxfdxxf
11)()( Left Riemann sum:
x: length of the n subintervals
xi: endpoints of the subintervals
x0 x1 x2 x3
Left Riemann Sums
By refining the partition, we obtain
better approximations.
Ln is the sum of all the inscribed
rectangles starting at the left endpoints.
It is called a left endpoint
approximation.
b
a
n
iin xxfLdxxf
11)()(
y
xx
f(x0)
x
f(x1)
x
f(x2)
x0 x1 x2 x3
Right Riemann Sums
b
a
n
iin xxfRdxxf
1
)()(
y
x
Rn is the sum of all the inscribed
rectangles starting at the right endpoints.
It is called a right endpoint approximation.
If Ln underestimates, then Rn overestimates, and vice versa
Left and Right Endpoint Approximations
Observations: Approximations get better if we increase n
Take the average of both approximations
Idea for improvement:
Trapezoidal Approximation
b
a nnn RLTdxxf )(2
1)(
a
b
h
ahLn
bhRn
hbabhahTn )(2
1)(
2
1
Trapezoidal Approximation
b
a nnn RLTdxxf )(2
1)(
Ln
Rn
x0 x1 x2 x3
y
x
Tn
Trapezoidal Approximation
b
a nnn RLTdxxf )(2
1)(
x0 x1 x2 x3
y
x
Tn
Trapezoidal Approximation
b
a nnn RLTdxxf )(2
1)(
])()([2
1
111
n
ii
n
ii xxfxxf
)]()(2...)(2)([2 110 nn xfxfxfxfx
An Example
As an example, let us look at .dxx1
0
2
3
1
3|1
0
31
0
2 x
dxx
)]()(2)([2 2102 xfxfxfx
T
8
3]1
4
120[
4
1
An Example
333333335.200000000
66666667
33335.20000
6667
34375.32
11
10000
100
4
T
T
T
Error bounds
Question:How accurate is the trapezoidal approximation?
Answer:
where K is an upper bound for | f”(x) |.
2
3
12
)(||
n
abKET
Error bounds: An Example
In our previous example, how large should n be so that the error is less than 0.00001 ?
1,0,)( 2 baxxf
2)('',2)(' xfxxf
2K
00001.012
12
12
)(||
22
3
nn
abKET
Error bounds: An Example
00001.012
12
12
)(||
22
3
nn
abKET
099.1296.1666600001.012
2
n
130n
....333343195.
....333343348.
130
129
T
T
Let’s Wrap Up
Approximations are useful if the function cannot be integrated or no function is given to begin with.
Left and right endpoint approximations are too inaccurate, so take their average.
The trapezoidal approximation is much more accurate than the left/right approximations, but better approximations exist (midpoint, Simpson’s etc.)
You need a computer to find approximations with large n - or you need to get a life!!!
top related