NM Chap 5.2
NM Chap 5.2
APPLICATIONS
(MEC500)
Assoc. Prof. Dr. Wan Nurshazwani WZ
School of Mechanical Engineering
Office: T1-A11-14A
e-mail: [email protected]
Learning outcome for Chapter 5
Other than Newton Cotes formula, two techniques that are designed to
integrate functions / discrete data:
• Romberg integration (based on Richardson extrapolation)
• Gauss quadrature
Richardson’s Extrapolation
• Uses two estimates of an integral to compute a third and more accurate
approximation
Romberg Integration
ℎ!"
𝐸 ℎ! ≅ 𝐸 ℎ" (3) I = exact value of integral
ℎ"" I(h) = the approximation from an n segment application
of trapezoidal rule with step size h
E(h) = the truncation error
Romberg Integration
%! " 𝐼 ℎ" − 𝐼 ℎ!
𝐼 ℎ! + 𝐸 ℎ" %"
≅ 𝐼 ℎ" + 𝐸(ℎ" ) 𝐼 = 𝐼 ℎ" + "
ℎ!
−1
" ℎ"
ℎ!
𝐸 ℎ" − 𝐸 ℎ" ≅ 𝐼 ℎ" − 𝐼 ℎ!
ℎ" Improved estimate of the integral
"
ℎ!
𝐸 ℎ" − 1 ≅ 𝐼 ℎ" − 𝐼 ℎ!
ℎ"
𝐼 ℎ" − 𝐼 ℎ!
𝐸 ℎ" ≅ "
(4)
ℎ!
−1
ℎ"
Romberg Integration
• For the cases where there are two 𝑂(ℎ!) estimates 𝐼(ℎ") and 𝐼(ℎ!) using step sizes of ℎ" and
ℎ!, respectively, an improved 𝑂(ℎ#) estimate may be formed for the special case where the
$
interval is halved (ℎ! = !!), this becomes:
4 1
𝐼= 𝐼 ℎ" − 𝐼 ℎ!
3 3
$
• For the cases where there are two 𝑂(ℎ#) estimates and the interval is halved (ℎ% = !"), an
improved 𝑂(ℎ&) estimate may be formed using:
16 1
𝐼= 𝐼& − 𝐼
15 15 '
$
• For the cases where there are two 𝑂(ℎ&) estimates and the interval is halved (ℎ% = !"), an
improved 𝑂(ℎ') estimate may be formed using:
64 1
𝐼= 𝐼& − 𝐼
63 63 '
Romberg Integration
Example 1
The estimates for one and two segments can be combined to give;
4 1
𝐼= 1.0688 − 0.1728 = 1.367467 𝜀* = 16.6%
3 3
The estimates for two and four segments can be combined to give;
4 1
𝐼 = 1.4848 − 1.0688 = 1.623467 𝜀* = 1.0%
3 3
The estimates can then be used for further iteration to give;
16 1
𝐼= 1.623467 − 1.367467 = 1.640533 𝜀* = 0.0%
15 15
Example 2
Integrate 𝒇 𝒙 = 𝟎. 𝟐 + 𝟐𝟓𝒙 − 𝟐𝟎𝟎𝒙𝟐 + 𝟔𝟕𝟓𝒙𝟑 − 𝟗𝟎𝟎𝒙𝟒 +
𝟒𝟎𝟎𝒙𝟓 from 𝒂 = 𝟎 to 𝒃 = 𝟎. 𝟖. Calculate the true error, 𝜀% (True value
1.640533)
f(0) = 0.2
f(0.4) = 2.456
f(0.8) = 0.232
Romberg Integration
Algorithm
• Note that the weighting factors for the Richardson extrapolation add up to 1
and that as accuracy increases, the approximation using the smaller step size is
given greater weight.
• In general,
4-.! 𝐼+/!,-.! − 𝐼+,-.!
𝐼+,- =
4-.! − 1
• where 𝑖"#$,&'$ and 𝑖",&'$ are the more and less accurate integrals, respectively,
and 𝑖",& the new approximation. 𝑘 is the level of integration and j is used to
determine which approximation is more accurate.
• The process by which lower-level integrations are combined to produce more
accurate estimates
• In general, Romberg integration is more efficient than the trapezoidal and
Simpson’s rule. Simpson’s 1/3 requires 256-segment to yield I = 1.640533
Gauss Quadrature
• Gauss quadrature describes a class of techniques
for evaluating the area under a straight line by
joining any two points on a curve rather than simply
choosing the endpoints.
• The key is to choose the line that balances the
positive and negative errors.
• The integral estimates are of the form:
𝐼 ≅ 𝑐0 𝑓 𝑥0 + 𝑐! 𝑓 𝑥! + ⋯ + 𝑐1.! 𝑓(𝑥1.! )
!
𝑐0 𝑓 𝑥0 + 𝑐! 𝑓 𝑥! = B 1 𝑑𝑥 = 2
.!
!
𝑐0 𝑓 𝑥0 + 𝑐! 𝑓 𝑥! = B 𝑥 𝑑𝑥 = 0
.!
!
2
𝑐0 𝑓 𝑥0 + 𝑐! 𝑓 𝑥! = B 𝑥 " 𝑑𝑥 =
.! 3
!
𝑐0 = 𝑐! = 1
𝑐0 𝑓 𝑥0 + 𝑐! 𝑓 𝑥! = B 𝑥 $ 𝑑𝑥 = 0
.! 1 1
𝑥0 = − 𝑥! =
3 3
1 1
𝐼=𝑓 − +𝑓
3 3
Gauss Quadrature
Gauss Legendre Formula
b + a + b − a 𝑥2
𝑥= = 0.4 + 0.4x3
2
𝑑𝑦 𝑓 𝑥: + ∆𝑥 − 𝑓 𝑥:
= lim
𝑑𝑥 ∆7→0 ∆𝑥
Numerical Differentiation
Rearrange
𝑓(𝑥:/! ) − 𝑓(𝑥: )
Forward difference 𝑓 ; (𝑥: ) = + Θ(ℎ)
ℎ
𝑓 𝑥:/! − 𝑓 𝑥:.!
Centered difference 𝑓 ; (𝑥: ) = + Θ(ℎ" )
2ℎ
Numerical Differentiation
• Notice that the error for the central different method is of the order of h2
as compared to h for the forward and backward difference methods.
• Therefore, central difference method gives better approximation of the
derivative than the other two methods.
Higher Accuracy Numerical Differentiation
• More accurate differentiation formulas (i.e. finite divided difference) can
be developed by including more terms from the TSE.
• This is achieved using linear algebra to combine the expansion around
several points.
• Three categories for the formula include forward finite-difference,
backward finite-difference, and centered finite-difference.
Higher Accuracy Numerical Differentiation
𝑓 ;; 𝑥: "
𝑓 𝑥:/! = 𝑓 𝑥: + 𝑓;
𝑥: ℎ + ℎ + Θ(ℎ" )
2!
;;
𝑓 𝑥:/! − 𝑓 𝑥: 𝑓 𝑥:
𝑓 ; 𝑥: = + ℎ + Θ(ℎ" ) (1)
ℎ 2!
𝑓 𝑥:/" − 2𝑓 𝑥:/! + 𝑓 𝑥:
𝑓 ;; 𝑥: = + Θ(ℎ) (2)
ℎ"
Richardson Extrapolation
• Combine two lower-accuracy estimates of the derivative to produce
a higher-accuracy estimate.
Richardson Extrapolation
'@
• For two 𝑂(ℎ. ) estimates and ℎ. = > an improved 𝑂(ℎ/ ) estimate
.
may be formed using:
4 1
𝐷= 𝐷 ℎ" − 𝐷 ℎ!
3 3
'@
• For two 𝑂(ℎ/ ) estimates and ℎ. = > an improved 𝑂(ℎ+ ) estimate
.
may be formed using:
16 1
𝐷= 𝐷 ℎ" − 𝐷 ℎ!
15 15
'@
• For two 𝑂(ℎ+ ) estimates and ℎ. = > an improved 𝑂(ℎ0 ) estimate
.
may be formed using:
64 1
𝐷= 𝐷 ℎ" − 𝐷 ℎ!
63 63
Question 3
Determine the estimate of first derivative at 𝑥 = 3 using Richardson
Extrapolation based on the values calculated in Question 2. Then,
calculate the percent relative true error, 𝜀% .
𝑦 = 𝑥 $ + 4𝑥 − 15