Mws Gen Int Ppt Simpson3by8
-
Upload
joahuabond -
Category
Documents
-
view
53 -
download
1
description
Transcript of Mws Gen Int Ppt Simpson3by8
Numerical Methods Part: Simpson Rule For Integration. http://numericalmethods.eng.usf.edu
83
For more details on this topic Go to http://numericalmethods.eng.usf.edu Click on Keyword
You are free
to Share – to copy, distribute, display and perform the work
to Remix – to make derivative works
Under the following conditions Attribution — You must attribute the work in
the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
Noncommercial — You may not use this work for commercial purposes.
Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
Chapter 07.08: Simpson Rule For Integration.
Major: All Engineering Majors
Authors: Duc Nguyen
http://numericalmethods.eng.usf.edu Numerical Methods for STEM undergraduates
http://numericalmethods.eng.usf.edu 5 11/14/2011
Lecture # 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. 6
Introduction The main objective in this chapter is to develop appropriated formulas for obtaining the integral expressed in the following form:
∫=b
adxxfI )(
where is a given function. )(xf
)(xf)(xfi i
(1)
http://numericalmethods.eng.usf.edu 7
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. 8
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
)(
aaaa
xxx
xaxaxaaxf
(3)
83
http://numericalmethods.eng.usf.edu 9
Method 1 The 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)
http://numericalmethods.eng.usf.edu 10
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
1111
xfxfxfxf
aaaa
xxxxxxxxxxxx
The above Eq. (5) can be symbolically represented as
[ ] 141444 ××× = faA
(5)
(6)
http://numericalmethods.eng.usf.edu 11
Thus,
[ ] fA
aaaa
a
×=
= −1
3
2
1
0
Substituting Eq. (7) into Eq. (3), one gets
( ) { } [ ] fAxxxxf
××= −1323 ,,,1
(7)
(8)
http://numericalmethods.eng.usf.edu 12
Remarks As indicated in Figure 1, one has
=−
+=+=
+=
−+=+=
+=
−+=+=
=
babahax
baabahax
baabahax
ax
3333
32
3222
32
3
3
2
1
0
With the help from MATLAB [2], the unknown vector (shown in Eq. 7) can be solved. a
(9)
http://numericalmethods.eng.usf.edu 13
Method 2 Using 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
xxxxxxxfxxxxxx
xxxxxx
xfxxxxxx
xxxxxxxfxxxxxx
xxxxxxxf
×−−−
−−−+×
−−−−−−
+
×−−−−−−
+×−−−
−−−=
(10)
http://numericalmethods.eng.usf.edu 14
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
adxxfdxxfI 3
Integrating the right-hand-side of the above equations, one obtains
( ) ( ) ( ) ( ) ( ){ }8
33 3210 xfxfxfxfabI +++×−= (11)
83
http://numericalmethods.eng.usf.edu 15
Since hence , and the above 3abh −
=
equation becomes:
( ) ( ) ( ) ( ){ }3210 338
3 xfxfxfxfhI +++×≈
The error introduced by the Simpson 3/8 rule can be derived as [Ref. 1]:
( )ζfabEt ′′′′×−
−=6480
)( 5, where ba ≤≤ζ
hab 3=−
(13)
(12)
http://numericalmethods.eng.usf.edu 16
Example 1 (Single Simpson rule)
Compute
∫=
=
−
−
=30
8,8.9
2100000,140000,140ln2000
b
adxx
xI
by using a single segment Simpson rule Solution In this example:
3333.73
8303
=−
=−
=abh
83
83
http://numericalmethods.eng.usf.edu 17
( ) 2667.17788.982100140000
140000ln20008 00 =×−
×−=⇒= xfx
( )
=×−
×−=
=+=+=
4629.3723333.158.93333.152100140000
140000ln2000
3333.153333.78
1
01
xf
hxx
http://numericalmethods.eng.usf.edu 18
( )
=×−
×−=
=+=+=
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
http://numericalmethods.eng.usf.edu 19
Applying Eq. (12), one has:
{ }
3104.11063
6740.9018976.60834629.37232667.1773333.783
=
+×+×+××=
I
I
The “exact” answer can be computed as
34.11061=exactI
http://numericalmethods.eng.usf.edu 20
3. Multiple Segments for Simpson Rule
Using = number of equal (small) segments, the width can be defined as
3abh −
=
Notes: = multiple of 3 = number of small segments
""n""h
(14)
n ""h
83
http://numericalmethods.eng.usf.edu 21
( ) ( )∫∫ ≈=b
a
b
adxxfdxxfI 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)
http://numericalmethods.eng.usf.edu 22
Substituting Simpson rule (See Eq. 12) into Eq. (15), one gets
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )( ) ( ) ( ) ( )
++++++++++++
=−−− nnnn xfxfxfxf
xfxfxfxfxfxfxfxfhI123
65433210
33.....3333
83
( ) ( ) ( ) ( ) ( )
++++= ∑∑∑−
=
−
=
−
=n
n
ii
n
ii
n
ii xfxfxfxfxfhI
3
,..9,6,3
1
,..8,5,2
2
,..7,4,10 233
83
(16)
(17)
83
http://numericalmethods.eng.usf.edu 23
Example 2 (Multiple segments Simpson rule)
Compute ∫=
=
−
−
=30
8,8.9
2100000,140000,140ln2000
b
adxx
xI
using Simple multiple segments rule, with number (of ) segments = = 6 (which corresponds to 2 “big” segments).
""h n
83
83
http://numericalmethods.eng.usf.edu 24
Solution In 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
http://numericalmethods.eng.usf.edu 25
( ){ } { } 6666.224;8976.608,6666.22, 0444 =+== hxxwherexfx
( ){ } { } 3333.265;9870.746,3333.26, 0555 =+== hxxwherexfx
( ){ } { } 306;6740.901,30, 0666 =+== hxxwherexfx
http://numericalmethods.eng.usf.edu 26
Applying Eq. (17), one obtains:
( ) ( ) ( ) ( )
++++= ∑∑∑=−
=
=−
=
=−
=6740.9012332667.1776666.3
83 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,11=I
http://numericalmethods.eng.usf.edu 27
Example 3 (Mixed, multiple segments Simpson and rules)
Compute ∫=
=
−
−
=30
8,8.9
2100000,140000,140ln2000
b
adxx
xI
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.334830
21=
+−
=+−
=−
=nnab
nabh
83
31
=1n=2n
http://numericalmethods.eng.usf.edu 28
( )( )( )
ruleSimpson
hxxhxxhxx
hxxax
31
5714.201429.34844286.171429.33832857.141429.3282
1429.111429.3818
04
03
02
01
0
=+=+==+=+==+=+=
=+=+===
( )( )( ) 301429.3787
8571.261429.36867143.231429.3585
07
06
05
=+=+==+=+==+=+=
hxxhxxhxx
http://numericalmethods.eng.usf.edu 29
( ) 2667.17788.982100000,140
000,140ln200080 =×−
×−
==xf
Similarly: ( )( )( )( )( )( )( ) 6740.901
9978.7678260.6463909.5362749.4353241.342
5863.2561429.11
7
6
5
4
3
2
1
======
==
xfxfxfxfxfxfxf
http://numericalmethods.eng.usf.edu 30
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
xfxfxfxfhI n
n
ii
n
ii
31
http://numericalmethods.eng.usf.edu 31
For multiple segments using Simpson 3/8 rule, one obtains (See Eq. 17):
( )segmentslastn 32 =
( ) ( ) ( ) ( ) ( )
( ) ( ) ( ){ }
2748.6697
2749.435!3241.34235863.25632667.1771429.383
23383
2
2
03
,...6,3
21
,...2
12
,...3,102 1
222
=
++++
×=
++++
= ∑∑∑
=−
//=
=−
=
=−
=
I
skipI
xfxfxfxfxfhI n
n
ii
n
ii
n
ii
The mixed (combined) Simpson 1/3 and 3/8 rules give:
3946.061,112748.66971197.436421
=+=+=
IIII
http://numericalmethods.eng.usf.edu 32
Remarks: (a) Comparing the truncated error of Simpson 1/3 rule
( ) ( )ζfabEt ′′′′×−
−=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)
http://numericalmethods.eng.usf.edu 33
(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
xfxfxfxfhI
xfxfxfxfxfxfxfxfxfhI
2
...6,4,2
1
,...3,102
124322101
243
4.....443
(19)
http://numericalmethods.eng.usf.edu 34
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).
http://numericalmethods.eng.usf.edu 35
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
http://numericalmethods.eng.usf.edu 36
= 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
http://numericalmethods.eng.usf.edu 37
Step 2 Compute 21 nnn +=
nabh −
=
bnhax
ihax
haxhax
ax
n
i
=+=
+=
+=+=
=
.
.
.
.2
1
2
1
0
http://numericalmethods.eng.usf.edu 38
Step 3 Compute “multiple segments” Simpson 1/3 rule (See Eq. 19)
( ) ( ) ( ) ( )
+++
= ∑∑
−
=
−
=n
n
ii
n
ii xfxfxfxfhI
2
...6,4,2
1
,...3,101
1124
3
(19, repeated)
http://numericalmethods.eng.usf.edu 39
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
83
n
n
ii
n
ii
n
ii xfxfxfxfxfhI
Step 5
21 III +=and print out the final approximated answer for I.
(17, repeated)
(20)
THE END
http://numericalmethods.eng.usf.edu
This instructional power point brought to you by Numerical Methods for STEM undergraduate http://numericalmethods.eng.usf.edu Committed to bringing numerical methods to the undergraduate
Acknowledgement
For instructional videos on other topics, go to
http://numericalmethods.eng.usf.edu/videos/ This material is based upon work supported by the National Science Foundation under Grant # 0717624. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
The End - Really