Let’s first know some basics about numbers used in floating-point arithmetic or in other words Numerical analysis and how they are calculated.
Basically, all the numbers that we use in Numerical Analysis are of two types as follows.
- Exact Numbers –
Numbers that have their exact quantity, means their value isn’t going to change. For example- 3, 2, 5, 7, 1/3, 4/5, or √2 etc.
- Approximate Numbers –
These numbers are represented in decimal numbers. They have some certain degrees of accuracy. Like the value of π is 3.1416 if we want more precise value, we can write 3.14159265, but we can’t write the exact value of π.
These digits that we use in any approximate value, or in other way digits which represent the numbers are called Significant Digits.
How to count significant digits in a given number :
For example –
In the normal value of π (3.1416), there are 5 significant digits and when we write more precise value of it (3.14159265) we get 9 significant digits.
Let’s say we have numbers: 0.0123, 1.2300, and 0.10234. Now we have 4, 3, and 5 significant digits respectively.
In the Scientific Representation of numbers –
2.345×107, 8.7456 ×104, 5.4×106 have 4, 5 and 2 significant digits respectively.
Absolute Error :
Let the true value of a quantity be X and the approximate value of that quantity be X1. Hence absolute error has defined the difference between X and X1. Absolute Error is denoted by EA.
Hence EA= X-X1=δX
Relative Error :
It is defined as follow.
ER = EA/X = (Absolute Error)/X
Percentage Error :
It is defined as follow.
EP= 100×EP= 100×EA/X
Let’s say we have a number δX = |X1-X|, It is an upper limit on the magnitude of Absolute Error and known as Absolute Accuracy.
Similarly the quantity δX/ |X| or δX/ |X1| called Relative Accuracy.
Now let’s solve some examples as follows.
- Ex-1 :
We are given an approximate value of π is 22/7 = 3.1428571 and true value is 3.1415926. Calculate absolute, relative and percentage errors?
We have True value X= 3.1415926, And Approx. value X1= 3.1428571. So now we calculate Absolute error, we know that EA= X - X1=δX Hence EA= 3.1415926- 3.1428571 = -0.0012645 Answer is -0.0012645 Now for Relative error we’ve (absolute error)/(true value of quantity) Hence ER = EA/X = (Absolute Error)/X, EA=(-0.0012645)/3.1415926 = -0.000402ans. Percentage Error, EP= 100 × EA/X = 100 × (-0.000402) = - 0.0402ans.
- Ex-2 :
Let the approximate values of a number 1/3 be 0.30, 0.33, 0.34. Find out the best approximation.
Our approach is that we first find the value of Absolute Error, and any value having the least absolute will be best. So, we first calculate the absolute errors in all approx values are given.
|X-X1| = |1/3 – 0.30| = 1/30
|1/3 – 0.33| = 1/300
|1/3 – 0.34| = 0.02/3 = 1/500
Hence, we can say that 0.33 is the most precise value of 1/3;
- Ex-3 :
Finding the difference—
√5.35 - √4.35
√5.35 = 2.31300 √4.35 = 2.08566 Hence, √5.35 - √4.35 = 2.31300 – 2.08566 = 0.22734
Here our answer has 5 significant digits we can modify them as per our requirements.