Simpson’s 1/3 rd Rule of Integration
description
Transcript of Simpson’s 1/3 rd Rule of Integration
04/21/23http://
numericalmethods.eng.usf.edu 1
Simpson’s 1/3rd Rule of Integration
Civil Engineering Majors
Authors: Autar Kaw, Charlie Barker
http://numericalmethods.eng.usf.eduTransforming Numerical Methods Education for STEM
Undergraduates
Simpson’s 1/3rd Rule of Integration
http://numericalmethods.eng.usf.edu
http://numericalmethods.eng.usf.edu3
What is Integration?Integration
b
a
dx)x(fI
The process of measuring the area under a curve.
Where:
f(x) is the integrand
a= lower limit of integration
b= upper limit of integration
f(x)
a b
y
x
b
a
dx)x(f
http://numericalmethods.eng.usf.edu4
Simpson’s 1/3rd Rule
http://numericalmethods.eng.usf.edu5
Basis of Simpson’s 1/3rd Rule
Trapezoidal rule was based on approximating the integrand by a firstorder polynomial, and then integrating the polynomial in the interval
ofintegration. Simpson’s 1/3rd rule is an extension of Trapezoidal rulewhere the integrand is approximated by a second order polynomial.
Hence
b
a
b
a
dx)x(fdx)x(fI 2
Where is a second order polynomial.
)x(f2
22102 xaxaa)x(f
http://numericalmethods.eng.usf.edu6
Basis of Simpson’s 1/3rd Rule
Choose
)),a(f,a( ,ba
f,ba
22))b(f,b(an
das the three points of the function to evaluate a0, a1 and a2.
22102 aaaaa)a(f)a(f
2
2102 2222
ba
aba
aaba
fba
f
22102 babaa)b(f)b(f
http://numericalmethods.eng.usf.edu7
Basis of Simpson’s 1/3rd Rule
Solving the previous equations for a0, a1 and a2 give
22
22
02
24
baba
)a(fb)a(abfba
abf)b(abf)b(faa
2212
2433
24
baba
)b(bfba
bf)a(bf)b(afba
af)a(afa
2222
222
baba
)b(fba
f)a(f
a
http://numericalmethods.eng.usf.edu8
Basis of Simpson’s 1/3rd Rule
Then
b
a
dx)x(fI 2
b
a
dxxaxaa 2210
b
a
xa
xaxa
32
3
2
2
10
32
33
2
22
10
aba
aba)ab(a
http://numericalmethods.eng.usf.edu9
Basis of Simpson’s 1/3rd Rule
Substituting values of a0, a1, a 2 give
)b(fba
f)a(fab
dx)x(fb
a 24
62
Since for Simpson’s 1/3rd Rule, the interval [a, b] is brokeninto 2 segments, the segment width
2
abh
http://numericalmethods.eng.usf.edu10
Basis of Simpson’s 1/3rd Rule
)b(fba
f)a(fh
dx)x(fb
a 24
32
Hence
Because the above form has 1/3 in its formula, it is called Simpson’s 1/3rd Rule.
http://numericalmethods.eng.usf.edu11
Example 1
Since decays rapidly as , we will approximate
a) Use Simpson 1/3rd rule to find the approximate value of erfc(0.6560).b) Find the true error, for part (a).c) Find the absolute relative true error, for part (a).
6560.0
5
2
6560.0 dzeerfc z
The concentration of benzene at a critical location is given by
758.56560.075.1 73.32 erfceerfcc
where dzexerfc
xz
2
So in the above formula dzeerfc z
6560.0
2
6560.0
tEa
2zez
http://numericalmethods.eng.usf.edu12
Solution
a)
2
)( zezf
bfba
fafab
erfc2
46
6560.0
6560.08280.2456
56560.0fff
65029.0103627.34103888.16
3440.4 411
47178.0
6560.0
5
2
6560.0 dzeerfc z
http://numericalmethods.eng.usf.edu13
Solution (cont)
b) The exact value of the above integral cannot be found. We assume the value obtained by adaptive numerical integration using Maple as the exact value for calculating the true error and relative true error.
True Error
31333.0
6560.06560.0
5
2
dzeerfc z
ValueeApproximatValueTrueEt
47178.031333.0
15846.0
http://numericalmethods.eng.usf.edu14
Solution (cont)
c) The absolute relative true error,
%573.50
10031333.0
15846.0
100Value True
Error True
t
http://numericalmethods.eng.usf.edu15
Multiple Segment Simpson’s 1/3rd Rule
http://numericalmethods.eng.usf.edu16
Multiple Segment Simpson’s 1/3rd Rule
Just like in multiple segment Trapezoidal Rule, one can subdivide the interval
[a, b] into n segments and apply Simpson’s 1/3rd Rule repeatedly overevery two segments. Note that n needs to be even. Divide interval[a, b] into equal segments, hence the segment width
n
abh
nx
x
b
a
dx)x(fdx)x(f0
where
ax 0 bxn
http://numericalmethods.eng.usf.edu17
Multiple Segment Simpson’s 1/3rd Rule
Apply Simpson’s 1/3rd Rule over each interval,
...)x(f)x(f)x(f
)xx(dx)x(fb
a
6
4 21002
...)x(f)x(f)x(f
)xx(
6
4 43224
f(x)
. . .
x0 x2 xn-
2
xn
x
.....dx)x(fdx)x(fdx)x(fx
x
x
x
b
a
4
2
2
0
n
n
n
n
x
x
x
x
dx)x(fdx)x(f....2
2
4
http://numericalmethods.eng.usf.edu18
Multiple Segment Simpson’s 1/3rd Rule
...)x(f)x(f)x(f
)xx(... nnnnn
64 234
42
6
4 122
)x(f)x(f)x(f)xx( nnn
nn
Since
hxx ii 22 n...,,,i 42
http://numericalmethods.eng.usf.edu19
Multiple Segment Simpson’s 1/3rd Rule
Then
...)x(f)x(f)x(f
hdx)x(fb
a
6
42 210
...)x(f)x(f)x(f
h
6
42 432
...)x(f)x(f)x(f
h nnn
6
42 234
6
42 12 )x(f)x(f)x(fh nnn
http://numericalmethods.eng.usf.edu20
Multiple Segment Simpson’s 1/3rd Rule
b
a
dx)x(f ...)x(f...)x(f)x(f)x(fh
n 1310 43
)}]()(...)()(2... 242 nn xfxfxfxf
)()(2)(4)(3
2
2
1
10 n
n
evenii
i
n
oddii
i xfxfxfxfh
)()(2)(4)(3
2
2
1
10 n
n
evenii
i
n
oddii
i xfxfxfxfn
ab
http://numericalmethods.eng.usf.edu21
Example 2
Since decays rapidly as , we will approximate
a) Use four segment Simpson’s 1/3rd Rule to find the approximate value of erfc(0.6560).
b) Find the true error, for part (a).c) Find the absolute relative true error, for part (a).
6560.0
5
2
6560.0 dzeerfc z
The concentration of benzene at a critical location is given by
758.56560.075.1 73.32 erfceerfcc where
dzexerfcx
z
2
So in the above formula
dzeerfc z
6560.0
2
6560.0
atE
2ze z
http://numericalmethods.eng.usf.edu22
SolutionUsing n segment Simpson’s 1/3rd
Rule,
So
a)
0860.14
56560.0
n
abh
)5()( 0 fzf
)9140.3()0860.15()( 1 ffzf
)8280.2()0860.19140.3()( 2 ffzf
)7420.1()0860.18280.2()( 3 ffzf
)6560.0()( 4 fzf
http://numericalmethods.eng.usf.edu23
Solution (cont.)
30529.0
65029.0103627.32048096.04102226.24103888.112
3440.4
6560.08280.227420.149140.34512
3440.4
6560.0244512
3440.4
6560.024543
56560.0
4711
231
2
2
3
1
fffff
fzfzfzff
fzfzff
evenii
i
oddii
i
n
n
evenii
i
n
oddii
i zfzfzfzfn
aberfc
2
2
1
10 24
36560.0
http://numericalmethods.eng.usf.edu24
Solution (cont.)
In this case, the true error is
The absolute relative true error
0080347.0
30529.031333.0
ValueeApproximatValueTrueEt
%5643.2
10031333.0
0080347.0
100Value True
Error True
t
c)
b)
Approximate Value
246810
−0.47178−0.30529−0.30678−0.31110−0.31248
0.15846−0.0080347−0.0065444−0.0022249
−0.00084868
50.573%2.5643%2.0887%
0.71009%0.27086%
http://numericalmethods.eng.usf.edu25
Solution (cont.)Table 1: Values of Simpson’s 1/3rd Rule for Example 2 with multiple segments
ntE t
http://numericalmethods.eng.usf.edu26
Error in the Multiple Segment Simpson’s 1/3rd Rule
The true error in a single application of Simpson’s 1/3rd Rule is given as
bafab
Et
),(2880
)( )4(5
In Multiple Segment Simpson’s 1/3rd Rule, the error is the sum of the errors
in each application of Simpson’s 1/3rd Rule. The error in n segment Simpson’s1/3rd Rule is given by
)(f)xx(
E )(1
45
021 2880
),(fh )(
14
5
90
)(f)xx(
E )(2
45
242 2880
),(fh )(
24
5
90
210 xx
422 xx
http://numericalmethods.eng.usf.edu27
Error in the Multiple Segment Simpson’s 1/3rd Rule
)(f)xx(
E i)()i(i
i
45
122
2880),(f
hi
)( 45
90
12
45
42
12 2880 n
)(nnn f
)xx(E ,f
hn
)(
12
45
90
nnn xx, 2
2
2
)4(5
90 nfh
.
.
.
ii)i( xx 212
21
2
4
nnn xx
2
45
2
22880 n
nnn f
)xx(E
http://numericalmethods.eng.usf.edu28
Error in the Multiple Segment Simpson’s 1/3rd Rule
Hence, the total error in Multiple Segment Simpson’s 1/3rd Rule is
2
1
n
iit EE
2
1
)4(5
)(90
n
iif
h
2
1
)4(5
5
)(90
)(n
iif
n
ab
n
f
n
ab
n
ii
2
1
)4(
4
5 )(
90
)(
http://numericalmethods.eng.usf.edu29
Error in the Multiple Segment Simpson’s 1/3rd Rule
The term n
f
n
ii
2
1
)4( )(is an approximate average value of
bxaxf ),()4(
Hence )4(
4
5
90
)(f
n
abEt
where
n
ff
n
ii
2
1
)4(
)4()(
Additional ResourcesFor all resources on this topic such as digital audiovisual lectures, primers, textbook chapters, multiple-choice tests, worksheets in MATLAB, MATHEMATICA, MathCad and MAPLE, blogs, related physical problems, please visit
http://numericalmethods.eng.usf.edu/topics/simpsons_13rd_rule.html