chapter 5.1
DESCRIPTION
yusTRANSCRIPT
-
Numerical Integration & Differentiation
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.
Knowing how to implement the following single application Newton-Cotes formulas: Trapezoidal rule Simpsons 1/3 rule Simpsons 3/8 rule
Knowing how to implement the following composite Newton-Cotes formulas: Trapezoidal rule Simpsons 3/8 rule
Recognizing that even-segment-odd-point formulas like Simpsons 1/3 rule achieve higher than expected accuracy.
Knowing how to use the trapezoidal rule to integrate unequally spaced data.
-
Introduction Differentiation?
Process of finding derivative (dy/dx) - rate of change of a dependent variable with respect to an independent variable.
Integration? Process of finding integral, I - the area under a function plotted on a graph.
dx xfIAArea,b
a
x
)f(xx)f(xlim
dx
dy
x
)f(xx)f(x
x
y
ii
0x
ii
f(x)
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.
What can be differentiated and integrated?1. Simple continuous function such as polynomial, exponential and trigonometry
Analytical approach2. Tabulated values (discrete data) Numerical approach3. Continuous complicated functions (difficult or impossible) Numerical
approach.
-
Non-computer method for differentiation and integrationEqual-area graphical differentiation Given - (x,y) are tabulated data
a) Find divided difference (y/x) for each interval.b) Plot y/x as stepped curve versus xc) Draw smooth curve to approximate area under the curve.
Read from the curve
-
Non-computer method for differentiation and integrationUsing grid to approximate an integral Given - (x, y) are tabulated data.
a) Plot the curveb) Count the number of boxes that approximate the area.
better approximation is achieved using finer grid or thinner strips(Form the basis for computer methods)
A = (heights x widths)
-
Numerical integrationNumerical Integration (i.e. QUADRATURE)
f(x) = integrandx = variablea, b = integration limits
Methods of numerical integration Newton-Cotes integration formula
1. Trapezoidal rule2. Simpsons rule
Simpsons 1/3rule Simpsons 3/8 rule
Romberg integration Gauss quadrature
dx xfAI Integral,b
af(x)
A
-
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
fn(x) is an nth order interpolating polynomial.
The integrating function can be polynomials for any order, e.g. a) straight lines 1st orderb) parabolas 2nd orderc) Cubic 3rd order
nn
1n1n10n
b
a
n
b
a
xaxaxaa(x)f
(x)dxff(x)dxI
Integrating function i.e. interpolating
polynomial
Newton-Cotes closed formula
I = (b-a) x (Average Height)
-
Newton-Cotes Integration FormulaMethods of application
Single application less accurate if a & b are widely spaced
Multiple-application repeatedly apply single integral for each
sub-interval of data points higher accuracy
Note: Higher order polynomial can be used for higher accuracy
dx xfIb
a
n321
b
aI....IIIdx f(x)I
-
1.a Trapezoidal rule The trapezoidal rule uses a first order
polynomial as the integrating function.
xaa(x)f
(x)dxff(x)dxI
101
b
a
1
b
a
2
f(b)f(a)a)(bI
Trapezoidal for single integral
(Height)2
sides Parallel
trapezoidof Area(x)dxfb
a1
Newton-Cotes closed formula
I = (b-a) x (Average Height)
-
1.a Trapezoidal rule - Error the truncation error of a single application
of the trapezoidal rule is:
Where, is somewhere between aand b.
error is dependent upon the second-derivative of the actual function
It is 1st order accurate give exact result if the actual function is linear.
error is dependent on the third power of the step size
Error can thus be reduced by breaking the curve into parts Use multiple-application/composite
3t abf12
1E
-
1.a Trapezoidal rule - ExampleIntegrate f(x)=0.2 + 25x - 200x + 675x3 - 900x4 + 400x5 from a=0 to b=0.8.True value 1.640533.
f(0) = 0.2f(0.8) = 0.232
1728.02
0.2322.0)08.0(
2
f(b)f(a)a)(bI
%5.89 t
-
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)
Apply single integral method to every segment, total integral is
Substitute trapezoidal rule to each integral gives,
n0 xbxan
abh
n
1n
2
1
1
0
x
x
x
x
x
x
f(x)dxf(x)dxf(x)dxI
2
)f(x)f(xh
2
)f(x)f(xh
2
)f(x)f(xhI n1n2110
-
1.b Multiple application of Trapezoidal rule Multiple-application Trapezoidal rule
Error = the sum of the individual error for each segment
Problem For high accuracy, need more segments more computations more
round-off errors! Solution
Use higher-order polynomial as the integrating function!
1n
1i
nio )f(x)f(x2)f(x2
hI
f12n
a)(bE
2
3
a
Average value of second derivative
- Error is inversely related to n2
-
1.b Multiple application of Trapezoidal rule - ExampleIntegrate 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.2f(0.4) = 2.456f(0.8) = 0.232
0688.14
0.232)456.2(22.0)08.0(I
%9.34 t
-
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.
a) Simpsons 1/3 rule use 2nd-order interpolating polynomialb) Simpsons 3/8 rule use 3rd-order interpolating polynomial
-
2.a Simpsons 1/3 Rule General form;
Using the Lagrange form for a quadratic fit of three points:
Integration over the three points simplifies to:
Where, x0 = a , x1=(a+b)/2 & x2 = b
Called 1/3 because h is divided by 3
22102
b
a
2
b
a
xaxaa(x)f
(x)dxff(x)dxI
212
1
02
01
21
2
01
00
20
2
10
1n xf
xx
xx
xx
xxxf
xx
xx
xx
xxxf
xx
xx
xx
xxxf
210
x
x2
xfx4fxf3
hI
dx xfI2
0
simpsons 1/3 rulefor single integral
2
abh
Sub-interval is equally spaced
Newton-Cotes closed formula
I = (b-a) x (Average Height)
-
2.a Simpsons 1/3 Rule - Error Truncation error of a single application of Simpsons 1/3 rule is:
where is somewhere between a and b.
error is dependent upon the fourth-derivative of the actual function
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).
f2880
abE 4
5
t
-
2.b Multiple-Application Simpsons 1/3 Rule A way to improve the accuracy of the Simpsons
1/3 rule
Sub-divide the interval [a,b] into n segment (sub-interval)
Apply single integral method over every two segment n must be even!, total integral is
Substitute Simpsons 1/3 rule to each integral gives
nxb
0xa
n
abh
n
2n
4
2
2
0
x
x
x
x
x
x
f(x)dxf(x)dxf(x)dxI
n1n2n432210 xfx4fxf3
hxfx4fxf
3
hxfx4fxf
3
hI
-
2.b Multiple-Application Simpsons 1/3 Rule Multiple-application Simpsons 1/3 rule;
Error = the sum of the individual error for each segment
Very accurate superior than Trapezoidal
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!
n
2n
even j,2j
i
1n
odd i,1i
i0 xfxf2xf4xf3
hI
Average value of 4th derivative)4(
4
5
180
)(f
n
abEa
-
2.b Multiple-Application Simpsons 1/3 Rule Multiple-application Simpsons 1/3 rule;
Error = the sum of the individual error for each segment
Very accurate superior than Trapezoidal
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!
n
2n
even j,2j
i
1n
odd i,1i
i0 xfxf2xf4xf3
hI
Average value of 4th derivative)4(
4
5
180
)(f
n
abEa
-
2.c Simpsons 3/8 Rule General form;
Using the Lagrange form for a 3rd-order polynomial to fit of four points: Integration over the three points simplifies to:
Where, x0 = a , x1=(a+b)/3, x2=(2a+2b)/3 & x2 = b
33
22103
b
a
3
b
a
xaxaxaa(x)f
(x)dxff(x)dxI
3210
x
x3
xfx3fx3fxf8
3hI
dx xfI2
0
3ab
h
SIMPSONS 3/8 RULEfor single integral
Sub-interval is equally spaced
-
2.c Simpsons 3/8 Rule Truncation error of a single application of Simpsons 3/8 rule is:
where is somewhere between a and b.
error is dependent upon the fourth-derivative of the actual function
Simpsons 3/8 is still third-order accurate though it is derived from 3rd order polynomial Give exact result for cubic polynomial.
error is dependent on the fifth power of the step size
f6480
abE 4
5
t
-
2.c Simpsons 3/8 RuleREMARKS
Simpsons 1/3 is usually the preferred method because it attains third-order accuracy with 3 points rather than the 4 points required for the 3/8 version.
Simpsons 3/8 rule is generally used in tandem with Simpsons 1/3 rule when the number of segments is odd.
-
2.d Multiple-Apllication Simpsons 3/8 Rule Sub-divide the interval [a, b] into n segment (sub-
interval)
Apply single integral method over every THREE segment n must be divisible by three!, total integral is
Substitute Simpsons 3/8 rule to each integral gives,
n0 xbxan
abh
n
3n3
3
0
x
x
x6
x
x
x
f(x)dxf(x)dxf(x)dxI
n
2n
4,7,10...j
i1i
1n
2,5,7..i
i0 xfxf2)xfx(f3xf8
3hI
-
2. Simpsons RuleFINAL 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
Simpsons rules are sufficient for most applications.
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 RuleFINAL 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
Simpsons rules are sufficient for most applications.
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
Where hi = the width of segment i
Same approach as multiple-application trapezoidal rule but h is the width of the unequal segments.
2
)f(x)f(xh
2
)f(x)f(xh
2
)f(x)f(xhI n1nn
212
101
-
Newton-Cotes integration formula Final remark Numerical integration for;
1. Tabulated values (discrete data). 2. Continuous complicated functions (difficult or impossible).
Concept: Replace tabulated data and complicated function (i.e. integrand) with an nth
order integrating polynomial across the integration interval
Accuracy; Higher order polynomial more accurate
Method of application: Single application not accurate Multiple application more accurate (need more data values!)
b
an
b
a
(x)dxff(x)dxI