Professional Documents
Culture Documents
three-eight rules
Simpson’s 1/3 Rule
• If we use a 2nd order polynomial (need 3
points or 2 intervals):
– Lagrange form.
x + x2
x1 = 0
2
( x − x1 )( x − x2 )
x2 ( x − x0 )( x − x2 )
I =∫ f ( x0 ) + f ( x1 )
x0 ( x − x )( x − x ) (x1 − x0 )(x1 − x2 )
0 1 0 2
+
( x − x0 )( x − x1 )
f ( x2 ) dx
(x2 − x0 )(x2 − x1 )
x2 ( x − x0 − h )( x − x0 − 2h ) ( x − x0 )( x − x0 − 2h )
I =∫ f ( x0 ) + f ( x1 )
x0
−h ( −2h ) ( h )( −h )
( x − x0 )( x − x0 − h )
+ f ( x2 ) dx
( 2h )( h )
h b−a
I ≈ [ f ( x0 ) + 4 f ( x1 ) + f ( x2 )] h=
12
3 2
10
Quadratic
8 Polynomial
0
3 5 7 9 11 13 15
f ( x0 ) + 4 f ( x1 ) + f ( x2 )
I ≈ (b − a )
6
width
average height
Et = −
h 5 (4 )
f (ξ ) = −
(b − a ) (4 )
5
f (ξ ) 5
90 2880
O(h )
b−a
h=
2
(4 )
⇒Integrates a cubic exactly: f (ξ ) = 0
20
15
10
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
-5
n −1 n−2
f ( x0 ) + 4 ∑ f ( xi ) + 2 ∑ f (x )+ f (x )
j n
i =1,3,5 j = 2,4,6
I = (b − a )
3n
n+1 data points, an odd number
Engineering Mathematics III 9
Composite Simpson’s 1/3 Rule
• Odd coefficients receive a weight of 4, even
receive a weight of 2.
• Doesn’t seem very fair, does it?
4 1 coefficients on
1
4 1 i=n numerator
1 1
1 4
i=0
nh 5 ( 4 ) (b − a )h 4 ( 4 ) 4
Ea = f = f O(h )
180
• If n is doubled, 180and Ea → Ea/16
h → h/2
b−a a+b
h= =1 x0 = a = 0 x1 = =1 x2 = b = 2
2 2
2 1
I =∫ e − x2
dx ≈ h f ( x0 ) + 4 f ( x1 ) + f ( x2 )
0 3
1
= f ( 0 ) + 4 f (1) + f ( 2 )
3
1 0
= (e + 4e −1 + e −4 ) = 0.82994
3
Engineering Mathematics III 12
Example
• Error estimate:
h 5 (4 )
Et = − f (ξ )
90
• Where h = b - a and a < ξ < b
• Don’t know ξ
– use average value
5
1 ( 4) 1 5f ( 4)
( x0 ) + f ( 4)
( x1 ) + f ( 4)
( x2 )
Et ≈ Ea = − f =−
90 90 3
2 3 4 5
f ( x ) = 0.2 + 25
– From a = 0 to b = 0.8x − 200 x + 675 x − 900 x + 400 x
b−a a+b
h= = 0. 4 x0 = a = 0 x1 = = 0.4 x2 = b = 0.8
2 2
2 1
I = ∫ f ( x )dx ≈ h[ f ( x0 ) + 4 f ( x1 ) + f ( x2 )]
0 3
(0.4)
= [ f (0) + 4 f (0.4) + f (0.8)]
3
= 1.36746667
Exact integral is 1.64053334
Engineering Mathematics III 14
Error
(4 )
f ( x ) = − 21600 + 48000 x
5 5
0 .4
E t ≈ E a = − f (4 )
(x 1 ) = − 0 . 4 f (4 )
(0 . 4 ) = 0 . 27306667
90 90
middle point
• Matches actual error pretty well.
I = (b − a ) i =1, 3,5 j =2 , 4, 6
3n
f (0) + 4 f (0.2) + 2 f (0.4) + 4 f (0.6) + f (0.8)
= (0.8 − 0)
(3)( 4)
0.2 + 4(1.288 + 3.464) + 2( 2.456) + 0.232
= 0.8
12
= 1.6234667 Exact integral is 1.64053334
Engineering Mathematics III 17
Error
• Actual Error: (using the known exact value)
0.25 (4 ) 0.25 (4 )
Et ≈ Ea = − f ( x2 ) = − f (0.4) = −0.0085
90 90
middle point
(4 )
f ( x ) = − 21600 + 48000 x
m ax
x ∈ [0 , 0 . 8 ]
{ f (4)
(x) }= f (4)
(0 ) = − 2 1 6 0 0
(4)
f ( 0 .4 ) = 2 4 0 0
0.25 ( 4) 0.25 ( 4)
Ea = − f (ξ ) ≤ f ( 0 ) = 0.0768
90 90
• Five times the actual, but provides a safer
error metric.
f ( x ) ≈ p3 ( x) = a0 + a1 x + a2 x 2 + a3 x 3
x3 x3
I = ∫ f ( x )dx ≈ ∫ p3 ( x )dx
x0 x0
3
I = h[ f ( x0 ) + 3( x1 ) + 3 f ( x2 ) + f ( x3 )]
8
b−a
h=
3
3 5 ( 4)
Et = − h f (ξ ) O(h 4 )
80
• Integrates a cubic exactly:
⇒ f (4 ) (ξ ) = 0
Simpson’s 1/3
Simpson’s 3/8
h
I≈ [ f (x0 ) + 4 f (x1 ) + f (x2 )]
3
• Where initially, we have a=x0 and b=x2.
• Subdividing the integral into two:
h
I ≈ f ( a ) + 4 f ( x1 ) + 2 f ( x2 ) + 4 f ( x3 ) + f ( b )
6
b
h
∫
a
f ( x ) dx − f ( a ) + 4 f ( x1 ) + f ( b ) ≤ ε
3
b
h
∫
a
f ( x ) dx − f ( a ) + 4 f ( x1 ) + 2 f ( x2 ) + 4 f ( x3 ) + f ( b ) ≤ ε
6
c
h ε
∫
a
f ( x ) dx − f ( a ) + 4 f ( x1 ) + f ( x2 ) ≤ , and
6 2
b
h ε
∫
c
f ( x ) dx − f ( x2 ) + 4 f ( x3 ) + f ( b ) ≤ , where
6 2
a+b
c =left
• The x2 =and the right are within one-half of the error.
2
b
I ≡ ∫ f ( x ) dx = S ( a, b ) + E ( a, b ) , where
a
b−a a+b
S ( a, b ) = f (a) + 4 f + f ( b ) , and
6 2
5
1 b − a ( 4)
E ( a, b ) = − f
90 2
I = S ( ) + E ( ) , where
1 1
() ()
S =
1
S ( )
a , b ,
• Subsequent subdivision E ( a, bbe
= Ecan
1
) defined as:
( 2)
S = S ( a, c ) + S ( c, b )
( 2)
E ( a, c ) + E(2)( c, b )
• We Ecan =solve for E in terms of E(1).
5 5
1 h / 2 ( 4) 1 h / 2 ( 4)
E(
2)
=− f − f
90 2 90 2
5
1 1 h ( 4) 1 (1)
= 4 − f = E
2 90 2 16
(1) (1) ( 2) ( 2)
=S
• We Ihave: +E =S +E
( 2) (1) (1) ( 2) ( 2)
S −into
• Plugging = Edefinition:
S our − E = 15 E
1 ( 2)
I =S ( 2)
+E ( 2)
=S ( 2)
+
15
S −S (
(1)
)
Engineering Mathematics III 36
Adaptive Simpson’s Scheme
• Our error criteria is thus:
1 ( 2)
I −S =( 2)
15
S −S ( (1)
≤ε )
• Simplifying leads to the termination formula:
(S ( 2)
−S (1)
) ≤ 15ε
Engineering Mathematics III 37
Adaptive Simpson’s Scheme
• What happens graphically:
I=Ileft + Iright