Upload
arnold-miller
View
217
Download
0
Tags:
Embed Size (px)
Citation preview
Simpson Rule For Integration.
1
83
Most (if not all) of the developed formulas for integration is based on a simple concept of replacing a given (oftently complicated) function by a simpler function (usually a polynomial function) where represents the order of the polynomial function.2
IntroductionThe main objective in this chapter is to develop appropriated formulas for obtaining the integral expressed in the following form:
b
a
dxxfI )(
where is a given function.)(xf
)(xf)(xfi i
(1)
3
In the previous chapter, it has been explained and illustrated that Simpsons 1/3 rule for integration can be derived by replacing the given function )(xfwith the 2nd –order (or quadratic) polynomial function
)()( 2 xfxfi , defined as:
22102 )( xaxaaxf (2)
which can also be symbolically represented in Figure 1.4
In a similar fashion, Simpson rule for integration can be derived by replacing the given function )(xfwith the 3rd-order (or cubic) polynomial (passing through 4 known data points) function )()( 3 xfxfi
defined as
3
2
1
0
32
33
22103
,,,1
)(
a
a
a
a
xxx
xaxaxaaxf
(3)
83
5
Method 1The unknown coefficients (in Eq. (3)) can be obtained by substituting 4 known coordinate data points
3210 ,, aandaaa
33221100 ,,,,,, xfxandxfxxfxxfxinto Eq. (3), as following
233
2323103
223
2222102
213
2121101
203
2020100
)(
)(
)(
)(
xaxaxaaxf
xaxaxaaxf
xaxaxaaxf
xaxaxaaxf
(4)
6
Eq. (4) can be expressed in matrix notation as
3
2
1
0
3
2
1
0
33
233
32
222
31
211
30
200
1
1
1
1
xf
xf
xf
xf
a
a
a
a
xxx
xxx
xxx
xxx
The above Eq. (5) can be symbolically represented as
141444 faA
(5)
(6)
7
Thus,
fA
a
a
a
a
a
1
3
2
1
0
Substituting Eq. (7) into Eq. (3), one gets
fAxxxxf
1323 ,,,1
(7)
(8)
8
Remarks As indicated in Figure 1, one has
bab
ahax
baabahax
baabahax
ax
3
333
3
2
3
222
3
2
3
3
2
1
0
With the help from MATLAB [2], the unknown vector (shown in Eq. 7) can be solved. a
(9)
9
Method 2Using Lagrange interpolation, the cubic polynomial function that passes through 4 data points xfi 3(see Figure 1) can be explicitly given as
3231303
2103
321202
310
1312101
3200
302010
3213
xfxxxxxx
xxxxxxxf
xxxxxx
xxxxxx
xfxxxxxx
xxxxxxxf
xxxxxx
xxxxxxxf
(10)
10
Simpsons Rule For Integration
Thus, Eq. (1) can be calculated as (See Eqs. 8, 10 for Method 1 and Method 2, respectively):
b
a
b
a
dxxfdxxfI 3
Integrating the right-hand-side of the above equations, one obtains
8
33 3210 xfxfxfxfabI
(11)
83
11
Since hence , and the above3
abh
equation becomes:
3210 338
3xfxfxfxf
hI
The error introduced by the Simpson 3/8 rule can be derived as [Ref. 1]:
fab
Et
6480
)( 5
, where ba
hab 3
(13)
(12)
12
Example 1 (Single Simpson rule)
Compute
30
8
,8.92100000,140
000,140ln2000
b
a
dxxx
I
by using a single segment Simpson ruleSolutionIn this example:
3333.73
830
3
abh
83
83
13
2667.17788.982100140000
140000ln20008 00
xfx
4629.3723333.158.93333.152100140000
140000ln2000
3333.153333.78
1
01
xf
hxx
14
8976.6086666.228.96666.222100140000
140000ln2000
6666.22)3333.7(282
2
02
xf
hxx
6740.901308.9302100140000
140000ln2000
30)3333.7(383
3
03
xf
hxx
15
Applying Eq. (12), one has:
3104.11063
6740.9018976.60834629.37232667.1773333.78
3
I
I
The “exact” answer can be computed as
34.11061exactI
16
3. Multiple Segments for Simpson Rule
Using = number of equal (small) segments, the width can be defined as
3
abh
Notes: = multiple of 3 = number of small segments
""n""h
(14)
n ""h
83
17
b
a
b
a
dxxfdxxfI 3
bx
x
x
x
x
ax
n
n
dxxfdxxfdxxfI3
6
3
3
0
333 ........
The integral, shown in Eq. (1), can be expressed as
(15)
18
Substituting Simpson rule (See Eq. 12) into Eq. (15), one gets
nnnn xfxfxfxf
xfxfxfxfxfxfxfxfhI
123
65433210
33.....
3333
8
3
n
n
ii
n
ii
n
ii xfxfxfxfxf
hI
3
,..9,6,3
1
,..8,5,2
2
,..7,4,10 233
8
3
(16)
(17)
83
19
Example 2 (Multiple segments Simpson rule)
Compute
30
8
,8.92100000,140
000,140ln2000
b
a
dxxx
I
using Simple multiple segments rule, with number (of ) segments = = 6 (which corresponds to 2 “big” segments).
""h n
83
83
20
SolutionIn this example, one has (see Eq. 14):
6666.36
830
h
2667.177,8, 00 xfx
6666.11
6666.38;4104.270,6666.11, 0111
hxxwherexfx
3333.152;4629.372,3333.15, 0222 hxxwherexfx
193;7455.484,19, 0333 hxxwherexfx
21
6666.224;8976.608,6666.22, 0444 hxxwherexfx
3333.265;9870.746,3333.26, 0555 hxxwherexfx
306;6740.901,30, 0666 hxxwherexfx
22
Applying Eq. (17), one obtains:
6740.9012332667.1776666.3
8
3 33
,..6,3
51
,..5,2
42
,..4,1
n
ii
n
ii
n
ii xfxfxfI
6740.9017455.4842
9870.7464629.37238976.6084104.27032667.1773750.1I
4696.601,11I
23
Example 3 (Mixed, multiple segments Simpson and rules)
Compute
30
8
,8.92100000,140
000,140ln2000
b
a
dxxx
I
using Simpson 1/3 rule (with 4 small segments), and Simpson 3/8 rule (with 3 small segments).
Solution:In this example, one has:
1429.334
830
21
nn
ab
n
abh
83
31
1n2n
24
ruleSimpson
hxx
hxx
hxx
hxx
ax
31
5714.201429.3484
4286.171429.3383
2857.141429.3282
1429.111429.381
8
04
03
02
01
0
301429.3787
8571.261429.3686
7143.231429.3585
07
06
05
hxx
hxx
hxx
25
2667.17788.982100000,140
000,140ln200080
xf
Similarly: 6740.901
9978.767
8260.646
3909.536
2749.435
3241.342
5863.2561429.11
7
6
5
4
3
2
1
xf
xf
xf
xf
xf
xf
xf
26
For multiple segments segmentsfirstn 41 using Simpson rule, one obtains (See Eq. 19):
1197.4364
3909.5363241.34222749.4355863.25642667.1773
1429.3
243
1
1
22
,...2
31
,...3,101 1
11
I
I
xfxfxfxfh
I n
n
ii
n
ii
31
27
For multiple segments
using Simpson 3/8 rule, one obtains (See Eq. 17):
segmentslastn 32
2748.6697
2749.435!3241.34235863.25632667.1771429.38
3
2338
3
2
2
03
,...6,3
21
,...2
12
,...3,102 1
222
I
skipI
xfxfxfxfxfh
I n
n
ii
n
ii
n
ii
The mixed (combined) Simpson 1/3 and 3/8 rules give:
3946.061,11
2748.66971197.436421
I
III
28
Remarks:(a) Comparing the truncated error of Simpson 1/3 rule
fab
Et
2880
5
With Simple 3/8 rule (See Eq. 13), the latter seems to offer slightly more accurate answer than the former. However, the cost associated with Simpson 3/8 rule (using 3rd order polynomial function) is significant higher than the one associated with Simpson 1/3 rule (using 2nd order polynomial function).
(18)
29
(b) The number of multiple segments that can be used in the conjunction with Simpson 1/3 rule is 2,4,6,8,.. (any even numbers).
n
n
ii
n
ii
nnn
xfxfxfxfh
I
xfxfxfxfxfxfxfxfxfh
I
2
...6,4,2
1
,...3,102
124322101
243
4.....443
(19)
30
However, Simpson 3/8 rule can be used with the number of segments equal to 3,6,9,12,.. (can be either certain odd or even numbers).
(c) If the user wishes to use, say 7 segments, then the mixed Simpson 1/3 rule (for the first 4 segments), and Simpson 3/8 rule (for the last 3 segments).
31
Based on the earlier discussions on (Single and Multiple segments) Simpson 1/3 and 3/8 rules, the following “pseudo” step-by-step mixed Simpson rules can be given as
Step 1 User’s input information, such as
Given function integral limits
= number of small, “h” segments, in conjunction with Simpson 1/3 rule.1n
4. Computer Algorithm For Mixed Simpson 1/3 and 3/8
rule For Integration
),(xf ,"," ba
32
= number of small, “h” segments, in conjunction with Simpson 3/8 rule.2n
Notes:
= a multiple of 2 (any even numbers)1n
= a multiple of 3 (can be certain odd, or even numbers)2n
33
Step 2
Compute 21 nnn
n
abh
bnhax
ihax
hax
hax
ax
n
i
.
.
.
.
2
1
2
1
0
34
Step 3
Compute “multiple segments” Simpson 1/3 rule (See Eq. 19)
n
n
ii
n
ii xfxfxfxf
hI
2
...6,4,2
1
,...3,101
11
243
(19, repeated)
35
Step 4
Compute “multiple segments” Simpson 3/8 rule (See Eq. 17)
2
222 3
,...9,6,3
1
...8,5,2
2
...7,4,102 233
8
3n
n
ii
n
ii
n
ii xfxfxfxfxf
hI
Step 5
21 III and print out the final approximated answer for I.
(17, repeated)
(20)