Professional Documents
Culture Documents
Numerical Integration & Differentiation Newton-Cotes Integration
Numerical Integration & Differentiation Newton-Cotes Integration
Newton-Cotes Integration
Learning outcome
Recognizing that Newton-Cotes integration formulas are based on the strategy of
replacing a complicated function or tabulated data with a polynomial that is easy to
integrate.
y f(xi x) f(xi )
x x
dy f(xi x) f(xi )
x lim 0
dx x
Integration?
Process of finding integral, I - the area under a function plotted on a graph.
f(x)
Area,A I f x dx
b
a
A
Introduction
Why? engineering deals with systems/processes that are changing.
derivative and integral calculus are used to describe physical worlds such as...
Derivative - finding the velocity of a body from acceleration functions, and
displacement of a body from velocity data.
Integral - finding area under the curves, centroid, moment of inertia, work
by variable force (Hookes Law), electric charge, average value, force by
liquid pressure.
A = (heights x widths)
Integral,I A f x dx
b
a
f(x)
f(x) = integrand
x = variable
a, b = integration limits A
Methods of numerical integration
Newton-Cotes integration formula
1. Trapezoidal rule
2. Simpsons rule
Simpsons 1/3rule
Simpsons 3/8 rule
Romberg integration
Gauss quadrature
Newton-Cotes Integration Formula
Newton-Cotes Formula;
Replace complicated function or tabulated data (i.e. integrand) with an nth
order polynomial across the integration interval
b b
I f(x)dx f n (x)dx
a a
Single application
less accurate if a & b are widely spaced
f x dx
b
I
a
Multiple-application
repeatedly apply single integral for each
sub-interval of data points
higher accuracy
b
I f(x) dx I1 I 2 I3 .... I n
a
I f(x)dx f1 (x)dx
a a
f1 (x) a 0 a 1x
b
f1 (x)dx Area of trapezoid
a
Parallelsides
(Height) Newton-Cotes closed formula
2 I = (b-a) x (Average Height)
E t f b a
1 3
12
Where, is somewhere between a
and b.
f(0) = 0.2
f(0.8) = 0.232
t 89.5%
1.b Multiple application of Trapezoidal rule
A way to improve the accuracy of the trapezoidal
rule
Sub-divide the interval [a, b] into n segment (sub-
interval)
ba
h a x0 b xn
n
h n 1
2 i 1
I f(xo ) 2 f(xi ) f(xn )
Error = the sum of the individual error for each segment
(b a) 3
Average value of second derivative
Ea 2
f - Error is inversely related to n2
12n
Problem
For high accuracy, need more segments more computations more
round-off errors!
Solution
Use higher-order polynomial as the integrating function!
1.b Multiple application of Trapezoidal rule - Example
Integrate f(x)=0.2 + 25x - 200x + 675x3 - 900x4 + 400x5 from a=0 to b=0.8 with n=2.
True value 1.640533.
f(0) = 0.2
f(0.4) = 2.456
f(0.8) = 0.232
t 34.9%
2. Simpsons Rules
More accurate estimate of an integral is obtained if a high-order polynomial is used
to connect the points. The formulas that result from taking the integrals under such
polynomials are called Simpsons rules.
I f(x)dx f 2 (x)dx
a a
f 2 (x) a 0 a 1x a 2 x 2
Using the Lagrange form for a quadratic fit of three points:
f n x
x x1 x x 2 f x x x 0 x x 2 f x x x 0 x x1 f x
x 0 x1 x 0 x 2 0 x1 x 0 x1 x 2 1 x 2 x 0 x 2 x1 2
Integration over the three points simplifies to:
ba Sub-interval is
x2
f 2 x dx h
equally spaced
I 2
x0
I
h
f x 0 4f x1 f x 2 simpsons 1/3 rule
3 for single integral
Where, x0 = a , x1=(a+b)/2 & x2 = b
Newton-Cotes closed formula
Et
b a 4
5
f
2880
where is somewhere between a and b.
Simpsons 1/3 is third-order accurate though it is derived from 2nd order polynomial
more accurate than expected! Give exact result for cubic polynomial.
error is dependent on the fifth power of the step size (rather than the third for the
trapezoidal rule).
2.b Multiple-Application Simpsons 1/3 Rule
A way to improve the accuracy of the Simpsons
1/3 rule
I
h
f x 0 4f x1 f x 2 h f x 2 4f x 3 f x 4 h f x n 2 4f x n 1 f x n
3 3 3
2.b Multiple-Application Simpsons 1/3 Rule
Multiple-application Simpsons 1/3 rule;
n 1 n 2
h
I f x 0 4 f x i 2
3
f x i f x n
i 1 j 2
i, odd j, even
Error = the sum of the individual error for each segment
Problem
Limited to only equi-spaced data!
Must have even number of segments (i.e. odd number of data points)
Solution
For odd number of segment s use Simpsons 3/8 rule!
2.b Multiple-Application Simpsons 1/3 Rule
Multiple-application Simpsons 1/3 rule;
n 1 n 2
h
I f x 0 4 f x i 2
3
f x i f x n
i 1 j 2
i, odd j, even
Error = the sum of the individual error for each segment
Problem
Limited to only equi-spaced data!
Must have even number of segments (i.e. odd number of data points)
Solution
For odd number of segment s use Simpsons 3/8 rule!
2.c Simpsons 3/8 Rule
General form;
b b
I f(x)dx f 3 (x)dx
a a
f 3 (x) a 0 a1x a 2 x 2 a 3 x 3
Using the Lagrange form for a 3rd-order polynomial to fit of four points:
Integration over the three points simplifies to:
Sub-interval is
ba
f x dx h
x2 equally spaced
I 3
x0 3
I f x 0 3f x1 3f x 2 f x 3
3h SIMPSONS 3/8 RULE
8 for single integral
Et
b a 4
5
f
6480
where is somewhere between a and b.
Simpsons 3/8 is still third-order accurate though it is derived from 3rd order
polynomial Give exact result for cubic polynomial.
I f(x)dx f(x)dx
x0 x3
f(x)dx
x n 3
3h n 1 n 2
I f x 0 3
8
(f x i f x i 1 ) 2
i 2,5,7..
f x i f x n
j 4,7,10...
2. Simpsons Rule
FINAL REMARKS
Simpsons 1/3
for EVEN number of segments
3rd order accuracy (although based on 2nd order polynomial) thus it is a
preferred method!
Simpsons 3/8
For ODD number of segments & segment must be divisible by 3.
Can be used in combination with 1/3 rule to solve for ODD number of
segments
Higher-order Newton-Cotes formulas may also be used - in general, the higher the
order of the polynomial used, the higher the derivative of the function in the error
estimate and the higher the power of the step size. more accurate but rarely
used
2. Simpsons Rule
FINAL REMARKS
Simpsons 1/3
for EVEN number of segments
3rd order accuracy (although based on 2nd order polynomial) thus it is a
preferred method!
Simpsons 3/8
For ODD number of segments & segment must be divisible by 3.
Can be used in combination with 1/3 rule to solve for ODD number of
segments
Higher-order Newton-Cotes formulas may also be used - in general, the higher the
order of the polynomial used, the higher the derivative of the function in the error
estimate and the higher the power of the step size. more accurate but rarely
used
2. Simpsons Rule
For unequal segments, one method is to
apply trapezoidal rule to each segment and
sum the results
Concept:
Replace tabulated data and complicated function (i.e. integrand) with an nth
order integrating polynomial across the integration interval
b b
I f(x)dx f n (x)dx
a a
Accuracy;
Higher order polynomial more accurate
Method of application:
Single application not accurate
Multiple application more accurate (need more data values!)