Part 5: Integration and Differentiation
Part 5: Integration and Differentiation
Part 5: Integration and Differentiation
ENG-307
2 Objectives
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
Simpson’s 1/3 rule
Simpson’s 3/8 rule
f x dx
b
I a
f n ( x) a0 a1 x an 1 x n 1 an x n
f b f a
x a dx
b
I f (a)
a
ba
f a f b
I b a
2
7 The Trapezoidal Rule
12
where is somewhere between a
and b.
This formula indicates that the
error is dependent upon the
curvature of the actual function
as well as the distance between
the points.
Error can thus be reduced by
breaking the curve into parts.
8 The Trapezoidal Rule
Where:
Note:
9 The Trapezoidal Rule
Example:
Use trapezoidal rule to estimate the integral of:
f x0 f x1 f x1 f x2 f xn 1 f xn
I x1 x0 x2 x1 xn xn 1
2 2 2
h n 1
I f x0 2 f xi f xn
2 i 1
1
1
The Trapezoidal Rule
(b a )3
Ea 2
f
12n
Example:
Use the two-segment (composite) trapezoidal rule to estimate the integral of:
h ba
2 2n
14 The Trapezoidal Rule – MATLAB
Simpson’s Rules
f(x)
x0 x1 x2 x
h h
17 Simpson’s 1/3 Rule
Using 2nd order Lagrange polynomial:
Note:
19 Simpson’s 1/3 Rule
• Example
Integrate the function
AA AA AA AA AAAA
21 Simpson’s 1/3 Rule
Multiple-applications of Simpson’s 1/3 rule (Text 21.2):
c. For uniform spacing (equal segments):
AA A AA A
, ,.. , ,.. AAA AA A
AA A AAAA AAAA AA A
, ,.. , ,..
Where:
22 Simpson’s 1/3 Rule
Note:
a. We need an even number of segments, , for multiple
applications of Simpson’s 1/3 rule because we need 2
segments (i.e. 3 points) for each application of the rule.
it is limited to situations where there are an even number of
segments and odd number of points
b. Simpson’s rule is superior to trapezoidal rule for most
applications.
c. However, it is limited to cases where values are equal spaced
data.
23 Simpson’s 1/3 Rule
← 2 segments.
Multiple
application
, ,.. , ,..
24 Simpson’s 1/3 Rule
• Example
Integrate the function
AA
AA
← Simpson’s
3/8 Rule
Note:
28 Simpson’s 3/8 Rule
• Example
Integrate the function
a) The error for the Simpson’s 3/8 rule is same as that for the
Simpson’s 1/3 rule except that we have a larger denominator in the
Simpson’s 3/8 rule (6,480 compared to 2,880). The Simpson’s
3/8 rule is somewhat more accurate than the Simpson’s 1/3 rule.
Rule Rule
31 Simpson’s 3/8 Rule
32 Quick Review
1. The trapezoidal rule: Linear
a. 2 points: 1 segment
b. Multiple-applications:
b. Multiple-applications:
, ,.. , ,..
4 points 3 segments:
33 Integration with Unequal Segments
All the previous discussion is for closed integrals with
equally spaced data.
Sometimes experimental data are not equally spaced.
For non-equally spaced data, we apply Trapezoidal
rule to each segment and then sum the results.
xn x1 x2 xn
I fn x dx fn x dx fn x dx fn x dx
x0 x0 x1 x n1
Analytical