Lecture 8
Lecture 8
Intergrad 2
Figure PT6.1
3
Figure PT6.2 y f ( xi x) f ( xi )
x x
dy f ( xi x) f ( xi )
x lim 0
dx x
b
I f ( x)dx
a
4
NONCOMPUTER METHODS FOR
DIFFERENTIATION AND INTEGRATION
• The function to be differentiated or integrated will
typically be in one of the following three forms:
5
Figure PT6.4: Equal-area differentiation
(a) The (x,y) data are tabulated, and for
each interval, a simple divided
difference ᐃy/ ᐃx is employed to
estimate the slope.
(b) The difference estimates are plotted
as a bar graph (PT6.4). Smooth curve
is superimposed to approximate the
area under the bar graph. This can be
done by drawing the curve so that
equal positive and negative areas are
balanced.
(c) Values of dy/dx can be read off the
smooth curve.
6
Figure PT6.7: Application of a numerical integration method
7
NEWTON-COTES INTEGRATION
FORMULAS
• The Newton-Cotes formulas are the most common
numerical integration schemes. (Open or closed)
f n ( x) a0 a1 x an 1 x n1 an x n
8
Figure 21.1: The approximation of an integral by the area under
(a) a single straight line and (b) a single parabola
9
Figure 21.2: The approximation of an integral by the area under three straight-
line segments.
• Fig. 21.2: Three straight
strips/segments are used
to approximate the
integral. Higher-order
polynomials can be
utilized for the same
purpose.
10
NEWTON-COTES FORMULAS
• Open and closed forms of Newton-Cotes formulas are available.
• Closed – the data points at the beginning and end of the limits of integration are Focus in
this
known. subject
• Open- integration limits that extend the range of the data
THE TRAPEZOIDAL RULE
• The Trapezoidal rule is the first of the
Newton-Cotes closed integration
formulas, corresponding to the case • Derivation: p. 605
where the polynomial is first order: • Equivalent to
b b
approximating the area of
a trapezoid under the
I f ( x)dx f1 ( x)dx straight line connecting
a a f(a) and f(b)
• The area under this first order
polynomial is an estimate of the
integral of f(x) between the limits of a
and b:
f (a) f (b) Trapezoidal rule
I (b a)
2 12
Figure 21.4
Height no.1
Width (b-a)
Trapezoid
Height no.2
𝐴𝑟𝑒𝑎 = 𝐼 ≅ 𝑤𝑖𝑑𝑡ℎ × 𝑎𝑣𝑒𝑟𝑎𝑔𝑒 ℎ𝑒𝑖𝑔ℎ𝑡
All Newton Cotes closed formulas can be expressed in the general format of
ℎ𝑒𝑖𝑔ℎ𝑡 𝑛𝑜. 1 + ℎ𝑒𝑖𝑔ℎ𝑡 𝑛𝑜. 2
𝐴𝑟𝑒𝑎 = 𝐼 ≅ (𝑏 − 𝑎) ×
2
The only difference only in the formulation of the average height
13
The Multiple Application Trapezoidal Rule
f ( x0 ) the
Substituting f ( xtrapezoidal
1) f (for
f ( x1 )rule x2 )each integral 1 ) f ( xn )
f ( xnyields:
I h h h
2 2 2
14
Figure 21.8: Application of multiple-application trapezoidal rule
f ( x0 ) f ( x1 ) f ( x1 ) f ( x2 ) f ( xn1 ) f ( xn )
I h h h
2 2 2
𝑓 𝑥 +2∑ 𝑓 𝑥 +𝑓 𝑥
𝐼 = (𝑏 − 𝑎)
2𝑛
width Average height
15
EXAMPLE 1
Use the two-segment trapezoidal rule to estimate the integral of
𝑓 𝑥 = 0.2 + 25𝑥 − 200𝑥 + 675𝑥 − 900𝑥 + 400𝑥
From a = 0 and b=0.8
Solution:
n=2 ( h = 0.4)
f(0)=0.2
f(0.4)=2.456
. . .
f(0.8)=0.232 𝐼 = 0.8 = 1.0688
SIMPSON’S 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 Simpson’s rules.
17
Figure 21.10
18
𝐼= 𝑓(𝑥)𝑑𝑥 ≅ 𝑓 (𝑥)𝑑𝑥
𝑎=𝑥 𝑏=𝑥
(𝑥 − 𝑥 )(𝑥 − 𝑥 ) (𝑥 − 𝑥 )(𝑥 − 𝑥 ) (𝑥 − 𝑥 )(𝑥 − 𝑥 )
𝐼= 𝑓(𝑥 ) + 𝑓(𝑥 ) + 𝑓(𝑥 ) 𝑑𝑥
(𝑥 − 𝑥 )(𝑥 − 𝑥 ) (𝑥 − 𝑥 )(𝑥 − 𝑥 ) (𝑥 − 𝑥 )(𝑥 − 𝑥 )
ℎ 𝑏−𝑎
𝐼≅ 𝑓(𝑥 ) + 4𝑓(𝑥 ) + 𝑓(𝑥 ) ℎ=
3 2
(𝑏 − 𝑎)
𝐼≅ 𝑓(𝑥 ) + 4𝑓(𝑥 ) + 𝑓(𝑥 )
6
19
EXAMPLE 2
Use the 1/3 Simpson’s rule to estimate the integral of
𝑓 𝑥 = 0.2 + 25𝑥 − 200𝑥 + 675𝑥 − 900𝑥 + 400𝑥
From a = 0 and b=0.8. If the exact integral is 1.640533, what is the absolute error of the solution?
Solution:
n=2 ( h = 0.4)
f(0)=0.2
f(0.4)=2.456
. . .
f(0.8)=0.232 𝐼 = 0.8 = 1.367467
1.640533 − 1.365467
𝐴𝑏𝑠𝑜𝑙𝑢𝑡𝑒 𝑒𝑟𝑟𝑜𝑟 = 100% = 16.6%
1.640533
The Multiple-Application Simpson’s 1/3 Rule
22
Simpson’s 3/8 Rule
• An odd-segment-even-point formula used in conjunction with
the 1/3 rule to permit evaluation of both even and odd numbers
of segments.
𝐼= 𝑓(𝑥)𝑑𝑥 ≅ 𝑓 (𝑥)𝑑𝑥
3ℎ
𝐼≅ 𝑓(𝑥 ) + 3𝑓(𝑥 ) + 3𝑓(𝑥 ) + 𝑓(𝑥 )
8
(𝑏 − 𝑎)
ℎ=
3
𝑓(𝑥 ) + 3𝑓(𝑥 ) + 3𝑓(𝑥 ) + 𝑓(𝑥 )
𝐼 ≅ (𝑏 − 𝑎)
8
23
Figure 21.12
24
EXAMPLE 3
Use the 3/8 Simpson’s rule to estimate the integral of
𝑓 𝑥 = 0.2 + 25𝑥 − 200𝑥 + 675𝑥 − 900𝑥 + 400𝑥
From a = 0 and b=0.8.
Solution:
A single application of Simpson’s 3/8 rule requires four equally spaced points:
f(0)=0.2
f(0.2667)=1.432724
0.2 + 3 1.432724 + 3.487177 + 0.232
f(0.5333)=3.487177 𝐼 = 0.8
8
= 1.519170