Numerical Teaching-557-2141-1573542168

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

‫ دالوةر رؤوف معزوف‬.

‫م‬

‫كؤليَذى ئةنداسيارى \ بةشى كارةبا‬

3rd year E/E & E/C -2019

Numerical Analysis
CHAPTER ONE
Approximations and Errors
The difference between exact solution and numerical solution is that
numerical solution gives the answer with some "error", because numerical solution
involved an approximation.
For many engineering problems, we cannot obtain analytical solution;
therefore, we cannot compute the errors associated with numerical solution.
In professional practice, errors can be costly and sometimes catastrophic. If
a structure or device fails, lives can be lost.

1. Types of Errors: There are two major types of errors:

1. Round off error: which is due to computers, (e.g. π = 3.14160


instead of π = 3.14159253589…..
2. Truncation error is the difference between a truncated value and the
actual value. A truncated quantity is represented by a numeral with a
fixed number of allowed digits, with any excess digits.

As an example of truncation error, consider the speed of light in a


vacuum. The official value is 299,792,458 meters per second.
In scientific (power-of-10) notation, that quantity is expressed as
2.99792458 x 108. Truncating it to two decimal places yields 2.99 x
108. The truncation error is the difference between the actual value
and the truncated value, or 0.00792458 x 108. Expressed properly in
scientific notation, it is 7.92458 x 105.
1. Significant digits: They are the number of digits that can be
used with confidence. They correspond to the certain digits
plus one estimated digit. The figure shows a car speedometer
that reads 48.5 km/h, where (48) are significant digits and (5)
is estimated.

2. Accuracy and Precision:


1. Accuracy refers to how closely a computed or measured values
agrees with true value.

2. Precision refers to how closely measured values agree with each


other (i.e. how many significant digits). Numerical methods should
be significantly accurate to meet requirements, and precise enough for
good engineering design.

accurate accurate
precise
(the average is accurate) and
not accurate
not precise precise

1. Absolute Error (or true error):It is the relationship


between the exact result (or true value) and approximate
value.
i.e. Approximate value = True value + Error (Et)
Where (Et) is the exact value of error.

2. Relative Error: It is the normalized error to the true value


as in : Relative error (Єr) = True error (Et) / True value
Or in %, Єr% = (True error (Et) / True value) * 100%
3. Approximate Error (Єa): If we do not know the true
value, and the true error also unknown, then we use an
approximate error (Єa), which can be defined as:
Єa = (Approximate error / approximate value) * 100%
Where, [Ea =Approximate error = Present value – Previous value]
This definition is used mainly with iterative methods. If a specified value of
error (Єs) is wanted, then the computation is generally repeated until |Єa| <Єs.
4. Absolute error in algebraic operations:
1. Absolute error in summation and subtraction: If the absolute
error (Ea), then if two numbers are added or subtracted, then the
magnitude of total absolute error is equal to the sum of individual
errors. i.e.
Ea = Ea1 ± Ea2 ± Ea3 ± . . .
2. Absolute error in product: If we have two numbers "A" and "B".
Let the absolute error in "A" is "Ea", and absolute error in "B" is "Eb",
then
Approximate value of "A" = A + Ea,
and approximate value of "B" = B + Eb
Then abs. error in product (Eap) = (A + Ea) * (B + Eb) - AB
= AB + A*Eb + B*Ea + Ea*Eb – AB
≈ A*Eb + B*Ea
3. Absolute error in division: For the same above example, the
absolute error will be:
𝐴+E a 𝐴 𝐵∗E a−𝐴∗E b
Absolute error in division (Ead) = − ≈ 2
𝐵+E b 𝐵 𝐵

1. Error propagation: When error is introduced in a variable,


it propagates in other variables because of computations. This
amount of error depends upon the mathematical or numerical
operation performed. Consider the function,
1
f(x) =
1−𝑥 2
Let's calculate f(x) for x=0.9. Then exact value will be (5.2631579).
Let's assume that approximate value of (x) is (0.900005,i.e. an error of 5*10 -6).
With this value of (x), the approximate value of f(x) will be (5.2634072), so the
error will be (0.000025,i.e. an error of 25*10-6). This is called error magnification
(or error propagation since the error propagate from the 6th digit to the 5th digit.
Under such condition, the numerical method or computation procedure is said to
be (numerically unstable). To avoid this instability, the numerical process is
rearranged or some other method is used.
2. Solved examples:

Example1.1- Calculate the absolute and relative error in the following cases:
a)True value = 1 x 10-6, Approximate value = 0.5 x 10-6
b)True value = 1 x 106, Approximate value = 0.99 x 106

Solution:

1. Absolute error = 𝑇𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒 − 𝐴𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑒 𝑣𝑎𝑙𝑢𝑒


= 1 x 10-6 – 0.5 x 10-6 =0.5x10-6
𝐴𝑏𝑠𝑜𝑙𝑢𝑡𝑒 𝑒𝑟𝑟𝑜𝑟 −6
Relative error(Єr) = = 0.5𝑥10
1𝑥10 −6
= 0.5
𝑇𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒

Percentage relative error (Єr%) = Єr x 100% = 0.5x100


=50%
2. Absolute error = 𝑇𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒 − 𝐴𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑒 𝑣𝑎𝑙𝑢𝑒
= 1 x 106 – 0.99 x 106 =0.01x106 =10000
𝐴𝑏𝑠𝑜𝑙𝑢𝑡𝑒 𝑒𝑟𝑟𝑜𝑟 10000
Relative error (Єr) = = 1𝑥10 6 = 0.01
𝑇𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒

(Єr%) = Єr x 100% = 0.01x100 = 1%

Example1.2- f (x=0.4000) is correct to 4 significant digits, find the relative


error.

Solution:
(x) is correct to 4 significant digits, this means there will be error in the
(fifth) digit. The maximum value of this error will be: Et = 0.00005 (5 is
the max. value of the 5th digit)
𝐴𝑏𝑠𝑜𝑙𝑢𝑡𝑒 𝑒𝑟𝑟𝑜𝑟 0.00005
Relative error (Єr) = = = 0.000125
𝑇𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒 0.4000

Example1.3-
Find the approximate maximum error in (5.43 x 27.2).
Solution:
Here we have to calculate error in product.
Let A= 5.43 and B= 27.2
The error in A is Ea = 0.005, and error in B is Eb = 0.05
∴ Product absolute error (Eap) = A * Eb + B * Ea
= 5.43 * 0.05 + 27.2 * 0.005 = 0.4075
Example1.4- Determine the value of (e0.5) correct to three significant digits
𝑥2 3
using the expansion ex = 1 + x + 2! + 𝑥3! + ……, if true value = 1.648720.
Solution:
No. of Total value Absolute error Relative error (Єr)
terms
1 ex = e0.5 = 1 1.64872 – 1 = 𝟎.𝟔𝟒𝟖𝟕𝟐
= 0.393
𝟏.𝟔𝟒𝟖𝟕𝟐
0.64872
2 ex= 1+x =1+0.5 =1.5 1.64872-1.5 = 𝟎.𝟏𝟒𝟖𝟕𝟐
= 0.090
𝟏.𝟔𝟒𝟖𝟕𝟐
0.14872
3 ex=1+x+x2/2! 1.64872-1.625= 𝟎.𝟎𝟐𝟑𝟕𝟐
= 0.01438
𝟏.𝟔𝟒𝟖𝟕𝟐
=1+0.5+(0.5)2/2! 0.02372
= 1.625
4 e =1+x+x2/2! +x3/3!
x
1.64872-1.645833= 𝟎.𝟎𝟎𝟐𝟖𝟖𝟕
==0.001751
2 𝟏.𝟔𝟒𝟖𝟕𝟐
=1+0.5+(0.5) /2! + 0.002887
(0.5)3/3!
= 1.64583
x 𝟎.𝟎𝟎𝟎𝟐𝟖𝟐𝟓
5 e = 1.6484375 1.64872-1.6484375= = 0.0001486
0.0002825 𝟏.𝟔𝟒𝟖𝟕𝟐

∴ 𝑓𝑖𝑣𝑒 𝑡𝑒𝑟𝑚𝑠 𝑎𝑟𝑒 𝑛𝑒𝑒𝑑𝑒𝑑 𝑓𝑜𝑟 𝑑𝑒𝑡𝑒𝑟𝑚𝑖𝑛𝑒 𝑡𝑕𝑒 𝑣𝑎𝑙𝑢𝑒 𝑜𝑓 𝐞𝟎.𝟓 𝑐𝑜𝑟𝑟𝑒𝑐𝑡 𝑓𝑜𝑟
𝑡𝑕𝑟𝑒𝑒 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡𝑠
25.4
Example1.5: The quotient gives the result 2.05335489. Find the maximum
12.37
error.

Solution: Let a=25.4, then max. absolute error 𝐸𝑎 =0.05.


Let b=12.37, then max. absolute error 𝐸𝑏 =0.005.
The absolute error in division is given as,
𝐵 ∗ 𝐸𝑎 − 𝐴 ∗ 𝐸𝑏
𝐸𝑑 =
𝑏2
Putting the values in above equation,
𝜀𝑑 = (12.37 ∗ 0.05 − 25.4 ∗ 0.005)/(12.37)2
= 0.003212
Hence the true quotient will have the value of: (2.053±0.003212)

You might also like