Introduction To Errors and Approximations
Introduction To Errors and Approximations
Introduction To Errors and Approximations
and Approximations
Numerical Methods
MATH160
Numerical Methods
Relative Error
𝑡𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒 − 𝑎𝑝𝑝𝑟𝑜𝑥. 𝑣𝑎𝑙𝑢𝑒
𝜀𝑟 =
𝑡𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒
Suppose that you have the task of measuring the lengths of a bridge and a
rivet and come up with 9999 and 9 cm, respectively. If the true values are
10,000 and 10 cm, respectively, the error in both cases is 1 cm.
Bridge Measurement Rivet Measurement
𝜀𝑡 = |Approximation − True value| 𝜀𝑡 = |Approximation − True value|
𝜀𝑡 = |9999cm − 10000cm| 𝜀𝑡 = |9cm − 10cm|
𝜀𝑡 = 1 cm 𝜀𝑡 = 1 cm
10000 − 9999 10 − 9
%𝜀𝑟 = × 100% = 0.01% %𝜀𝑟 = × 100% = 10%
10000 10
Approximate Relative
Error
Approximate Relative Error
𝑝𝑟𝑒𝑠𝑒𝑛𝑡 𝑎𝑝𝑝𝑟𝑜𝑥. −𝑝𝑟𝑒𝑣𝑖𝑜𝑢𝑠 𝑎𝑝𝑝𝑟𝑜𝑥.
𝜀𝑎 =
𝑝𝑟𝑒𝑠𝑒𝑛𝑡 𝑎𝑝𝑝𝑟𝑜𝑥.
𝑥0 = 0.2
𝑥0 = 0.2
Approximation of a
Function
Second-Order Approximation uses terms up to the 2nd degree to
approximate 𝑦.
𝑦 ′ 𝑥0 𝑦 ′′ 𝑥0
𝑇2 𝑥0 = 𝑦 𝑥0 + 𝑥 − 𝑥0 + 𝑥 − 𝑥0 2
1! 2!
𝑇2 𝑥0 = 0.197396 + 0.96153(𝑥 − 0.2) − 0.18491(𝑥 − 0.2)2
𝑥0 = 0.2
Approximation of a
Function
Third-Order Approximation uses terms up to the 3rd degree to
approximate 𝑦.
𝑦 ′ 𝑥0 𝑦 ′′ 𝑥0 2
𝑦 ′′′
𝑥0 3
𝑇3 𝑥0 = 𝑦 𝑥0 + 𝑥 − 𝑥0 + 𝑥 − 𝑥0 + 𝑥 − 𝑥0
1! 2! 3!
𝑇3 𝑥0 = 0.197396 + 0.96153(𝑥 − 0.2) − 0.18491(𝑥 − 0.2)2 −0.26077 𝑥 − 0.2 3
𝑥0 = 0.2
Approximation of a
Function
As we increase the order of approximations, the better the
approximated curve follows the true curve.
Fourth-Order Approximation Fifth-Order Approximation
𝑇4 𝑥0 = 0.197396 + 0.96153 𝑥 − 0.2 𝑇5 𝑥0 = 0.197396 + 0.96153 𝑥 − 0.2
−0.18491 𝑥 − 0.2 2 − 0.26077 𝑥 − 0.2 3 −0.18491 𝑥 − 0.2 2 − 0.26077 𝑥 − 0.2 3
+0.16412 𝑥 − 0.2 4 +0.16412 𝑥 − 0.2 4 + 0.09994 𝑥 − 0.2 5
Approximation of a
Function
We can also use the Taylor series to approximate values at certain
points of the function.
𝑥0 = 0.2
𝐸
ℎ
𝑥𝑖 𝑥𝑖+1
= 𝑥0 + ℎ 𝑥𝑖 = 𝑥0 = 0.2
𝑥𝑖+1 = 𝑥0 + ℎ = 0.2 + ℎ
Approximation of a
Function
When approximating the value of a function 𝑦 @ 𝑥 = 𝑥𝑖+1 = 𝑥0 + ℎ,
the relationship below should be used,
𝑦 ′ 𝑥𝑖 𝑦 ′′ 𝑥𝑖 𝑦 ′′′ 𝑥
𝑖
𝑦 𝑥𝑖+1 = 𝑦 𝑥𝑖 + ℎ + ℎ 2+ ℎ 3
1! 2! 3!
𝑦 𝑖𝑣 𝑥𝑖 𝑛
+⋯+ ℎ + 𝐸𝑟𝑟𝑜𝑟
𝑛!
𝑡𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒−𝑎𝑝𝑝𝑟𝑜𝑥.𝑣𝑎𝑙𝑢𝑒 𝜋
%𝜀𝑟 = × 100% 𝑡𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒= cos =0.5
𝑡𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒 3
0.5 − 0.70710678
%𝜀𝑟 = × 100% = 41.42%
0.5
Solution
4. Evaluate the first-order approximation and the percent relative error.
𝑦 𝑥𝑖+1 = 𝑓𝑖𝑟𝑠𝑡 − 𝑜𝑟𝑑𝑒𝑟 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑖𝑜𝑛 + 𝐸𝑟𝑟𝑜𝑟
𝑦 ′ 𝑥𝑖
𝑦 𝑥𝑖+1 = 𝑦 𝑥𝑖 + ℎ + 𝐸𝑟𝑟𝑜𝑟
1!
𝜋
𝜋 𝜋 sin 𝜋
𝑦 = cos − 4 + 𝑂 ℎ2 = 0.52198666 + 𝑂 ℎ2
3 4 1! 12
𝑡𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒−𝑎𝑝𝑝𝑟𝑜𝑥.𝑣𝑎𝑙𝑢𝑒 𝜋
%𝜀𝑟 = × 100% 𝑡𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒= cos =0.5
𝑡𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒 3
0.5 − 0.52198666
%𝜀𝑟 = × 100% = 4.40%
0.5
Solution
0.5 − 0.49775449
%𝜀𝑟 = × 100% = 0.45%
0.5
Solution
6. Evaluate the third-order approximation and the percent relative error.
𝑦 𝑥𝑖+1 = 𝑡ℎ𝑖𝑟𝑑 − 𝑜𝑟𝑑𝑒𝑟 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑖𝑜𝑛 + 𝐸𝑟𝑟𝑜𝑟
𝑦 ′ 𝑥𝑖 𝑦 ′′ 𝑥𝑖 2
𝑦 ′′′
𝑥𝑖 3
𝑦 𝑥𝑖+1 = 𝑦 𝑥𝑖 + ℎ + ℎ + ℎ + 𝐸𝑟𝑟𝑜𝑟
1! 2! 3!
𝜋 𝜋 𝜋
𝜋 𝜋 sin 𝜋 cos 𝜋 2 sin 𝜋 3
𝑦 = cos − 4 − 4 + 4 + 𝑂 ℎ4
3 4 1! 12 2! 12 3! 12
𝜋
𝑦 = 0.49986915 + 𝑂 ℎ4
3
0.5 − 0.49986915
%𝜀𝑟 = × 100% = 0.03%
0.5
Solution
SUMMARY
Steps:
1. Find the value of h.
ℎ = 𝑥𝑖+1 − 𝑥𝑖 = 1 − 0.25 = 0.75
2. Use the series,
𝑦 ′ 𝑥𝑖 𝑦 ′′ 𝑥𝑖 2
𝑦 ′′′
𝑥𝑖 3
𝑦 𝑥𝑖+1 = 𝑦 𝑥𝑖 + ℎ + ℎ + ℎ
1! 2! 3!
𝑦 𝑖𝑣 𝑥𝑖
+⋯+ ℎ 𝑛 + 𝐸𝑟𝑟𝑜𝑟
𝑛!
to evaluate the nth order approximations.
Solution
3. Evaluate the zero-order approximation and the percent relative error.
𝑦 𝑥𝑖+1 = 𝑧𝑒𝑟𝑜 − 𝑜𝑟𝑑𝑒𝑟 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑖𝑜𝑛 + 𝐸𝑟𝑟𝑜𝑟
𝑦 𝑥𝑖+1 = 𝑦 𝑥𝑖 + 𝐸𝑟𝑟𝑜𝑟
𝑦 1 = 𝑦 0.25 + 𝑂(ℎ0+1 )
𝑦 1 = 𝑒 −2(0.25) + 𝑂 ℎ0+1 = 0.60653066 + 𝑂(ℎ)
𝑡𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒−𝑎𝑝𝑝𝑟𝑜𝑥.𝑣𝑎𝑙𝑢𝑒
%𝜀𝑟 = × 100% 𝑡𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒=𝑒 −2(1) =0.13533528
𝑡𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒
0.13533528 − 0.60653066
%𝜀𝑟 = × 100% = 348.17%
0.13533528
Solution
4. Evaluate the first-order approximation and the percent relative error.
𝑦 𝑥𝑖+1 = 𝑓𝑖𝑟𝑠𝑡 − 𝑜𝑟𝑑𝑒𝑟 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑖𝑜𝑛 + 𝐸𝑟𝑟𝑜𝑟
𝑦 ′ 𝑥𝑖
𝑦 𝑥𝑖+1 = 𝑦 𝑥𝑖 + ℎ + 𝐸𝑟𝑟𝑜𝑟
1!
−2 0.25
𝑒
𝑦 1 = 𝑒 −2(0.25) − 2 0.75 + 𝑂 ℎ2 = −0.30326533 + 𝑂 ℎ2
1!
0.13533528 − 0.37908166
%𝜀𝑟 = × 100% = 180.11%
0.13533528
Solution
6. Evaluate the third-order approximation and the percent relative error.
𝑦 𝑥𝑖+1 = 𝑡ℎ𝑖𝑟𝑑 − 𝑜𝑟𝑑𝑒𝑟 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑖𝑜𝑛 + 𝐸𝑟𝑟𝑜𝑟
𝑦 ′ 𝑥𝑖 𝑦 ′′ 𝑥𝑖 2
𝑦 ′′′
𝑥𝑖 3
𝑦 𝑥𝑖+1 = 𝑦 𝑥𝑖 + ℎ + ℎ + ℎ + 𝐸𝑟𝑟𝑜𝑟
1! 2! 3!
−2 0.25 −2 0.25 −2 0.25
𝑒 𝑒 𝑒
𝑦 1 = 𝑒 −2(0.25) − 2 0.75 + 4 0.75 2−8
0.75 3
+ 𝑂 ℎ4
1! 2! 3!
𝑦 1 = 0.03790817 + 𝑂 ℎ4
0.13533528 − 0.03790817
%𝜀𝑟 = × 100% = 71.99%
0.13533528
Solution
6. Evaluate the fourth-order approximation and the percent relative error.
𝑦 𝑥𝑖+1 = 𝑓𝑜𝑢𝑟𝑡ℎ − 𝑜𝑟𝑑𝑒𝑟 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑖𝑜𝑛 + 𝐸𝑟𝑟𝑜𝑟
𝑦 ′ 𝑥𝑖 𝑦 ′′ 𝑥𝑖 2
𝑦 ′′′ 𝑥𝑖 3
𝑦 𝑖𝑣 𝑥𝑖 4
𝑦 𝑥𝑖+1 = 𝑦 𝑥𝑖 + ℎ + ℎ + ℎ + ℎ + 𝐸𝑟𝑟𝑜𝑟
1! 2! 3! 4!
𝑦 1
𝑒 −2 0.25 𝑒 −2 0.25 𝑒 −2 0.25 𝑒 −2 0.25
= 𝑒 −2(0.25) − 2 0.75 + 4 0.75 2−8 0.75 3 + 16 0.75 4 + 𝑂 ℎ4
1! 2! 3! 4!
𝑦 1 = 0.16584823 + 𝑂 ℎ4
0.13533528 − 0.16584823
%𝜀𝑟 = × 100% = 22.55%
0.13533528
Solution
SUMMARY
n-th order Approximation value Percent Relative Error
approximation
0 0.60653066 348.17%
1 -0.30326533 324.08%
2 0.379081662 180.11%
3 0.037908166 71.99%
4 0.165848227 22.55%
5 0.127466209 5.81%
6 0.137061714 1.28%
7 0.135005534 0.24%
END