Sei sulla pagina 1di 17

CE 341/441 - Lecture 18 - Fall 2004

p. 18.1
LECTURE 18
NUMERICAL INTEGRATION CONTINUED
Simpsons 1/3 Rule
Simpsons 1/3 rule assumes 3 equispaced data/interpolation/integration points
The integration rule is based on approximating using Lagrange quadratic (second
degree) interpolation.
The sub-interval is dened as [x
o
, x
2
] and the integration point to integration point
spacing equals
79
f x ( )
h
x
2
x
o

2
----------------
f
0
f
1
x
0
x
1
f(x)
g(x)
f
2
x
2
h h
x
0
=0 x
1
=h x
2
=2h coordinate shift
CE 341/441 - Lecture 18 - Fall 2004
p. 18.2
Lagrange quadratic interpolation over the sub-interval:
where

g x ( ) f
o
V
o
x ( ) f
1
V
1
x ( ) f
2
V
2
x ( ) + + =
V
o
x ( )
x x
1
( ) x x
2
( )
x
o
x
1
( ) x
o
x
2
( )
------------------------------------------- =
V
o
x ( )
x
2
3hx 2h
2
+
2h
2
------------------------------------ =
V
1
x ( )
x x
o
( ) x x
2
( )
x
1
x
o
( ) x
1
x
2
( )
------------------------------------------- =
V
1
x ( )
4hx 2x
2

2h
2
------------------------ =
V
2
x ( )
x x
o
( ) x x
1
( )
x
2
x
o
( ) x
2
x
1
( )
------------------------------------------- =
V
2
x ( )
x
2
hx
2h
2
----------------- =
CE 341/441 - Lecture 18 - Fall 2004
p. 18.3
Integration rule is obtained by integrating

Simpsons 1/3 Rule


g x ( )
I f x ( )
x
o
x
2

= I g x ( )
x
o
x
2

dx E + =
I f
o
x
2
3hx 2h
2
+
2h
2
------------------------------------ f
1
4hx 2x
2

2h
2
------------------------ f
2
x
2
hx
2h
2
----------------- + +

' ;

x E + d
x
o
=0
x
2
=2h

=
I
1
2h
2
-------- f
o
x
3
3
-----
3hx
2
2
------------ 2h
2
x +
,
_
f
1
4hx
2
2
------------
2x
3
3
--------
,
_
f
2
x
3
3
----- h
x
2
2
-----
,
_
+ +
2h
0
E + =
I
1
2h
2
-------- f
o
8
h
3
3
-----
12h
3
2
----------- 4h
3
0 +
,
_
f
1
8h
3
16
3
------h
3

,
_
f
2
8h
3
3
-------- h
4h
2
2
--------
,
_
+ + E + =
I
h
3
--- f
o
4 f
1
f
2
+ + [ ] E + =
CE 341/441 - Lecture 18 - Fall 2004
p. 18.4
Evaluation of the Error for Simpsons 1/3 Rule
Error is dened as:

We develop Taylor series expansions for , , and about
E I
h
3
-- - f
o
4 f
1
f
2
+ + ( ) =
E f x ( ) x
h
3
--- f
o
4 f
1
f
2
+ + ( ) d
0
2h

=
f x ( ) f
o
f
1
f
2
x
1
h =
f x ( ) f
1
x h ( ) f
1 ( )
1
1
2
--- x h ( )
2
f
2 ( )
1
1
6
-- - x h ( )
3
f
3 ( )
1
1
24
------ + + + + x h ( )
4
f
4 ( )
1
O x h ( )
5
+ =
f
o
f
1
h f
1 ( )
1

1
2
-- -h
2
f
1
2 ( )
h
3
6
----- f
3 ( )
1
1
24
------h
4
f
4 ( )
1
O h ( )
5
+ + + =
f
1
f
1
=
f
2
f
1
h f
1 ( )
1
1
2
---h
2
f
2 ( )
1
h
3
6
----- f
3 ( )
1
1
24
------h
4
f
4 ( )
1
O h ( )
5
+ + + + + =
CE 341/441 - Lecture 18 - Fall 2004
p. 18.5
Substituting into the expression for

E
E f
1
x h ( ) f
1 ( )
1
1
2
--- x h ( )
2
f
2 ( )
1
1
6
--- x h ( )
3
f
3 ( )
1
1
24
------ x h ( )
4
f
4 ( )
1
O x h ( )
5
+ + + + +
,
_
x d
0
2h

=
h
3
--- f
1
h f
1 ( )
1

1
2
---h
2
f
2 ( )
1
h
3
6
----- f
3 ( )
1
+
1
24
------h
4
f
1
4 ( )
O h ( )
5
4 f
1
f
1
h f
1
1 ( )
1
2
---h
2
f
1
2 ( )
+ + + + + +

h
3
6
----- f
3 ( )
1
1
24
------h
4
f
4 ( )
1
O h ( )
5
+ + +
,
_
E 2h ( ) f
1
1
2
-- - h
2
h
2
( ) f
1 ( )
1
1
6
--- h
3
h
3
+ ( ) f
2 ( )
1
1
24
------ h
4
h
4
( ) f
3 ( )
1
+ + + =
1
120
--------- h
5
h
5
+ ( ) f
4 ( )
1
O h ( )
6
h
3
--- 6 f
1
h
2
f
2 ( )
1
1
12
------h
4
f
4 ( )
1
O h ( )
5
+ + + + +
CE 341/441 - Lecture 18 - Fall 2004
p. 18.6
Error for Simpsons 1/3 Rule
This is the error for integration over one sub-interval of width !
Fifth order accurate.
Simpsons 1/3 Rule is exact for any cubic polynomial function
We note that E can also be derived by
Estimating the error for Lagrange quadratic interpolation, , in
series form
Integrating e(x) over the integration interval
E 2h 2h ( ) f
1
2
6
---h
3
h
3
3
-----
,
_
f
2 ( )
1
h
5
60
------
h
5
36
------
,
_
f
4 ( )
1
O h ( )
6
+ + + =
E
1
90
------ h
5
f
4 ( )
1
=
2h
e x ( ) f x ( ) g x ( ) =
x
o
x
2
, [ ]
E e x ( ) x d
x
o
=0
x
2
=2h

=
CE 341/441 - Lecture 18 - Fall 2004
p. 18.7
Extended Simpsons 1/3 Rule
Simply add up integrated values obtained using Simpsons 1/3 rule over each sub-
interval.
80
Sub-interval size =
Number of sub-intervals =
Sub-interval width is 2h while the integration point to integration point spacing is
equal to
a
f
0
f
1
f
2
f
N
b
x
f(x)
f
3
f
4
f(x)
sub-
int. 1
h h
sub-
int. 2
2h
N
2
----
h
b a
N
------------ =
CE 341/441 - Lecture 18 - Fall 2004
p. 18.8
Again we integrate over points (the same as extended trapezoidal rule). Therefore


In general we can write
N
I f x ( ) x d
a
b

=
I
h
3
--- f
o
4 f
1
f
2
+ + ( ) f
2
4 f
3
f
4
+ + ( ) f
4
4 f
5
f
6
+ + ( ) + + ( =
f
N 4
4 f
N 3
f
N 2
+ + ( ) f
N 2
4 f
N 1
f
N
+ + ( ) ) E
a b , [ ]
+ + + +
I
h
3
--- f
o
4 f
1
2 f
2
4 f
3
2 f
4
4 f
5
2 f
N 2
4 f
N 1
f
N
+ + + + + + + + + [ ] E
a b , [ ]
+ =
I
h
3
--- f a ( ) f b ( ) 4 f a ih + ( ) 2 f a ih + ( )
i 2 2 , =
N 2

+
i 1 2 , =
N 1

+ + E
a b , [ ]
+ =
CE 341/441 - Lecture 18 - Fall 2004
p. 18.9
Note that the total number of integration points must be odd and therefore must
be even!
The error term is also summed over the sub-intervals and each sub-interval term is eval-
uated at the mid node of the sub-interval.


where = average of the 4th derivative over each sub-interval in the interval .
N 1 + N
E
a b , [ ]
-
h
5
90
------ f
4 ( )
2i 1 ,
_
i 1 =
N
2
----

E
a b , [ ]
-
h
5
90
------
N
2
----
,
_
2
N
---- f
4 ( )
2i 1
i 1 =
N
2
----

,


_

E
a b , [ ]
-
h
5
90
------
N
2
---- f
4 ( )

f
4 ( )
a b , [ ]
CE 341/441 - Lecture 18 - Fall 2004
p. 18.10
However we wish dependence on error to be expressed in terms of , not in terms of the
number of integration points.
Noting that for the interval

Therefore

Overall the error is 4th order
h
a b , [ ]
h
b a
N
------------ = N
b a
h
------------ =
E
a b , [ ]
-
h
5
90
------
b a
h
------------
1
2
--- f
4 ( )
=
E
a b , [ ]
-
h
4
180
--------- b a ( ) f
4 ( )

CE 341/441 - Lecture 18 - Fall 2004


p. 18.11
Newton Cotes Closed Formulae
Derived by integrating Lagrange approximating polynomials (or equivalently Newton
Interpolating formulae) using equispaced integration points (interpolating points,
nodes, etc.) over the sub-interval dened by the interpolating data points
81
The general form of Newton-Cotes closed formulae:
where
f
0
f
1
f
2
f
N
h
= x
0
x
s
x
1
x
2
= x
N
x
E
g(x)
f x ( ) x d
x
S
x
E

h w
o
f
o
w
1
f
1
w
2
f
2
w
N
f
N
+ + + + [ ] E + =
f
i
f x
i
( ) = x
i
x
S
ih + = h
x
N
x
o

N
-----------------
CE 341/441 - Lecture 18 - Fall 2004
p. 18.12
Closed formulae: The sub-interval is closed by the rst and last integration points.
,
1 1 1 Trapezoidal Rule
2 1 4 1
Simpsons Rule
3 1 3 3 1
Simpsons Rule
4 7 32 12 32 7
10 16067 106300 -48525
272400 -260550 427368
-260550 272400 -48525
106300 16067
- 0.00412
Round off error tends to
become a serious
problem!
N w
i
i 0 1 2 N , , , , = E Note
1
2
---
1
12
------ h
3
f
2 ( )
1
3
---
1
90
------ h
5
f
4 ( )
1
3
---
3
8
---
3
80
------ h
5
f
4 ( )
3
8
---
2
45
------
8
945
--------- h
7
f
6 ( )
5
299376
------------------
h
13
f
12 ( )
CE 341/441 - Lecture 18 - Fall 2004
p. 18.13
Notes
All these formulae integrate over one sub-interval only. They can be extended over
simply by summing up integrals over each sub-interval.
In addition the error is summed resulting in one less order of accuracy than the error
over the individual sub-interval!
Accuracy for Simpsons rule is very similar to accuracy of Simpsons rule.
In general each formula will be exact for polynomials of one degree less than the
order of the derivatives in the error terms.
1 linear linear
2 quadratic cubic
3 cubic cubic
4 quartic quintic
a b , [ ]
3
8
---
1
3
---
N g x ( ) E Exact for
f
2 ( )
f
4 ( )
f
4 ( )
f
6 ( )
CE 341/441 - Lecture 18 - Fall 2004
p. 18.14
It appears that for even, the integration is exact for polynomials one degree greater
than the interpolation function.
For Simpsons 1/3 Rule:
It turns out that if is a cubic and is quadratic,
82
The errors cancel over the interval due to the location of point !
We can actually improve the accuracy of integration formulae by locating integration
points in special locations!
We do not experience any improvement in accuracy for N = odd.
N
f x ( ) g x ( ) E
x
o
x
1
, [ ]
E
x
1
x
2
, [ ]
=
f
0
f
1
f
2
x
0
x
1
x
2
g(x)
N = 2
f(x)
E[x
0
,x
1
]
E[x
1
,x
2
]
x
1
CE 341/441 - Lecture 18 - Fall 2004
p. 18.15
Newton-Cotes Open Formulae
Derived by integrating Lagrange approximating formulae (or equivalently Newton Inter-
polating formulae) using equispaced data points/nodes/integration points over the sub-
interval dened by the interpolating data points and extended to the left and right by .
83
Note that and
Note that does not generally pass through or through
h
f
0
f
1
f
2
f
N
h
x
0
x
1
x
2
x
N
x
E
g(x)
x
s
h
x
f(x)
region of
extrapolation
region of
extrapolation
x
S
x
o
h = x
E
x
N
h + = h
x
N
x
o

N
----------------- =
g x ( ) f x
S
( ) f x
E
( )
CE 341/441 - Lecture 18 - Fall 2004
p. 18.16
Newton Cotes open formula:
Error compared to closed
interval
Interval size compared to
closed interval
1 3/2 1 1
2 4/3 2 -1 2
3 5/24 11 1 1 11
f x ( ) x d
x
S
x
E

h w
0
f
0
w
1
f
1
w
N
f
N
+ + + [ ] E + =
N w
i
i 0 1 N , , , = E
1
4
-- -h
3
f
2 ( )
3 3
28
90
------h
5
f
4 ( )
28 2
95
144
---------h
5
f
4 ( )
18 1.7
CE 341/441 - Lecture 18 - Fall 2004
p. 18.17
Notes
Each formula and error is for one sub-interval with data/node/integration
points. We can extend the interval to by summing integrals and errors (error
increases by one order).
Sub-interval errors are greater than closed formulae since
sub-interval is larger
the error in the interpolation functions tended to be greater near the ends and
especially outside of the interpolating region!
Higher order formulae involve large coefcients with +/- signs. This leads to
roundoff problems.
Open formulae can be used when functional values are not available at the inte-
grating limits.
N 1 +
a b , [ ]

Potrebbero piacerti anche