Absolute, Relative and Percentage errors in Numerical Analysis
Last Updated :
27 Sep, 2024
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 certain degrees of accuracy. Like the value of π is 3.1416 if we want a 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 ways digits that 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 the 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×10
7,
8.7456 ×10
4,
5.4×10
6 have 4, 5 and 2 significant digits respectively.
Introduction to Errors in Numerical Analysis
Numerical analysis involves developing algorithms to solve mathematical problems approximately rather than exactly. When dealing with real-world problems, exact solutions are often impossible due to the complexity of the equations involved, the limitations of computational resources, or inherent approximations in the model. These approximations lead to errors.
Absolute Error
Absolute Error is used to measure the accuracy of a measurement by comparing it to the true or exact value. It shows how far off a measurement is from the actual value, without considering whether the measured value is greater or less than the true value. It is always non-negative. The absolute error has the same units as the measured and true values. Absolute error does not tell us just how much significant the error is relative to the true value.
Definition: Absolute error is the absolute difference between the measured value and the true value.
The formula to calculate absolute error is:
Absolute Error = Ea = | Xtrue - Xapprox |
- Xtrue is the true or exact value.
- Xapprox is the approximate or measured value.
- The vertical bars "| |" denote the absolute value, ensuring error is always non-negative.
Calculation of Absolute Error
- Identify the True Value: Determine the exact value of the quantity. This might be a known constant, a value from a theoretical model, or the most accurate measurement available.
- Identify the Approximate Value: Determine the approximate or measured value. This could be a value obtained through experimentation, estimation, or numerical approximation.
- Subtract the Approximate Value from the True Value: Find the difference between the true value and the approximate value.
- Take the Absolute Value: Ensure the error is expressed as a non-negative quantity by taking the absolute value of the difference.
Relative Error
Relative error is a measure of the accuracy of an approximation in relation to the true value. It expresses the absolute error as a fraction of the true value, providing the error's significance compared to the magnitude of the quantity being measured. Relative error is particularly useful when comparing errors across different units because it is a dimensionless quantity.
Definition: Relative Error is the ratio of the Absolute Error to the true or exact value.
The relative error Er = Ea / | Xtrue | = | Xtrue - Xapprox | / | Xtrue |
Calculation of Relative Error
- Determine the Absolute Error: Calculate the absolute error using the formula.
- Divide by the True Value: Divide the absolute error by the true value to obtain the relative error.
- Express as a Fraction or Percentage: The result can be left as a fraction or multiplied by 100 to express it as a percentage.
Percentage Error
Percentage error quantifies the accuracy of a measured or estimated value by expressing the error as a percentage of the true or exact value. It provides a way to compare the error relative to the magnitude of the true value, making it easier to understand the significance of the error in context. A small percentage error means the measurement is close to the true value while a large percentage error indicates that the measurement is far from the true value.
Definition: Percentage Error is the ratio of the Absolute Error to the true value multiplied by 100, it can also be defined as Relative Error multiplied by 100.
Percentage Error (Ep) = Er x 100% = ( | Xtrue - Xapprox | x 100% ) / | Xtrue |
Calculation of Percentage Error
- Determine the Absolute Error: Calculate the absolute error using the formula.
- Divide by the True Value: Divide the absolute error by the true value to obtain the relative error.
- Multiply by 100: Convert the relative error to a percentage by multiplying the result by 100.
Comparison of Absolute, Relative, and Percentage Errors
Absolute Error
- It is the absolute difference between the true value and the approximate value.
- Has same unit as the true value.
- Provides measure of the magnitude of the error.
- Useful when the scale of measurement is consistent and when comparing errors of the same unit.
- Tells you how far off a measurement is from the true value, without considering the size of the true value.
Relative Error
- It is the ratio of the absolute error to the true value, providing a measure of the error relative to the size of the true value.
- It is dimensionless.
- Useful for comparing errors across different scales, as it normalizes the error by the size of the true value.
- Helps put the absolute error into context by showing how large the error is compared to the true value.
Percentage Error
- It is the relative error expressed as a percentage.
- Expressed as a percentage (%).
- Provides a clear understanding of the error's magnitude relative to the true value.
- Commonly used in reporting to provide an easy to understand figure that represents the error's size relative to the true value.
- Converts the relative error into a more familiar and interpretable percentage, making it easy to compare the accuracy of different measurements.
Solved Examples
Example 1: Calculating Absolute, Relative, and Percentage Errors
Problem: We are given an approximate value of π as 22/7 = 3.1428571 and the true value as 3.1415926. Calculate the absolute, relative, and percentage errors.
Solution:
- True Value (X): 3.1415926
- Approximate Value (X1): 3.1428571
Absolute Error (EA): EA = |X - X1| = |3.1415926 - 3.1428571| = 0.0012645
Relative Error (ER): ER = EA / |X| = 0.0012645 / 3.1415926 = 0.000402
Percentage Error (EP): EP = ER × 100% = 0.000402 × 100% = 0.0402%
Example 2: Finding the Best Approximation
Problem: Given approximate values of 1/3 as 0.30, 0.33, and 0.34, find out the best approximation.
Solution: True Value (X): 1/3 ≈ 0.333333
Absolute Errors:
- |0.333333 - 0.30| = 0.033333
- |0.333333 - 0.33| = 0.003333
- |0.333333 - 0.34| = 0.006667
The value 0.33 has the smallest absolute error, so it is the best approximation.
Example 3: Finding the Difference
Problem: Compute the difference between √5.35 and √4.35.
Solution:
- √5.35 ≈ 2.31300
- √4.35 ≈ 2.08566
Difference: 2.31300 - 2.08566 = 0.22734
Example 4: Comparing Errors in Numerical Approximations
Problem: Given the true value of a physical quantity as 8.76 and approximate values as 8.70, 8.80, and 8.75, find and compare the absolute, relative, and percentage errors.
Solution:
Approximate Values:
- For 8.70:
- Absolute Error = |8.76 - 8.70| = 0.06
- Relative Error = 0.06 / 8.76 = 0.00685
- Percentage Error = 0.00685 × 100% = 0.685%
- For 8.80:
- Absolute Error = |8.76 - 8.80| = 0.04
- Relative Error = 0.04 / 8.76 = 0.00456
- Percentage Error = 0.00456 × 100% = 0.456%
- For 8.75:
- Absolute Error = |8.76 - 8.75| = 0.01
- Relative Error = 0.01 / 8.76 = 0.00114
- Percentage Error = 0.00114 × 100% = 0.114%
Best Approximation: 8.75, having the smallest errors in all cases.
Example 5: Significant Digits in Scientific Notation
Problem: Determine the number of significant digits in the following scientific notations:
- 2.345 × 10^7
- 8.7456 × 10^4
- 5.4 × 10^6
Solution:
- 2.345 × 10^7: 4 significant digits
- 8.7456 × 10^4: 5 significant digits
- 5.4 × 10^6: 2 significant digits
Practice Problems (Unsolved)
- Calculate Absolute, Relative, and Percentage Errors:
- Approximate value of e (Euler's number) is 2.718 and the true value is 2.71828.
- Find the Best Approximation:
- Given approximate values of √2 as 1.41, 1.414, and 1.415, determine which is the best approximation.
- Find the Difference:
- Compute the difference between √7 and √6.
- Compare Errors in Numerical Approximations:
- Given a true value of 50.0, find and compare the errors for approximate values of 49.9, 50.1, and 50.05.
- Significant Digits in Scientific Notation:
- Determine the number of significant digits in 4.500 × 10^3, 9.00 × 10^2, and 1.003 × 10^5.
- Determine Absolute and Relative Errors:
- Approximate value of log10(100) is 2.01, with the true value being 2.00.
- Percentage Error Calculation:
- For a true value of 12.345 and an approximate value of 12.30, calculate the percentage error.
- Absolute Error in Measurements:
- True value of a length is 15.76 cm, and the measured length is 15.80 cm. Calculate the absolute error.
- Best Approximation of 1/7:
- Approximate values of 1/7 are 0.142, 0.143, and 0.140. Find the best approximation.
- Difference Calculation:
- Compute the difference between 3.5 × 10^2 and 3.4 × 10^2.
Summary / Conclusion
In numerical analysis, understanding errors is crucial for evaluating the accuracy of approximations. Exact numbers are rare in real-world computations, so approximate values often come with errors. Absolute error measures the raw difference between true and approximate values, while relative error normalizes this difference relative to the true value. Percentage error provides a clearer understanding by expressing relative error as a percentage. By comparing these errors, one can assess the quality of numerical approximations and select the most accurate results.
Related Articles:
- How to Find the Slope of a Line From Its Graph
- Coordinate Geometry
Similar Reads
Decorators in Python
In Python, decorators are a powerful and flexible way to modify or extend the behavior of functions or methods, without changing their actual code. A decorator is essentially a function that takes another function as an argument and returns a new function with enhanced functionality. Decorators are
10 min read
AVL Tree Data Structure
An AVL tree defined as a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees for any node cannot be more than one. The absolute difference between the heights of the left subtree and the right subtree for any node is known as the balance factor of
4 min read
Sliding Window Technique
Sliding Window Technique is a method used to solve problems that involve subarray or substring or window. The main idea is to use the results of previous window to do computations for the next window. This technique is commonly used in algorithms like finding subarrays with a specific sum, finding t
13 min read
What is a Neural Network?
Neural networks are machine learning models that mimic the complex functions of the human brain. These models consist of interconnected nodes or neurons that process data, learn patterns, and enable tasks such as pattern recognition and decision-making.In this article, we will explore the fundamenta
14 min read
ArrayList in Java
Java ArrayList is a part of the collections framework and it is a class of java.util package. It provides us with dynamic-sized arrays in Java. The main advantage of ArrayList is that, unlike normal arrays, we don't need to mention the size when creating ArrayList. It automatically adjusts its capac
9 min read
Read JSON file using Python
The full form of JSON is JavaScript Object Notation. It means that a script (executable) file which is made of text in a programming language, is used to store and transfer the data. Python supports JSON through a built-in package called JSON. To use this feature, we import the JSON package in Pytho
4 min read
Multithreading in Python
This article covers the basics of multithreading in Python programming language. Just like multiprocessing , multithreading is a way of achieving multitasking. In multithreading, the concept of threads is used. Let us first understand the concept of thread in computer architecture. What is a Process
8 min read
Two Pointers Technique
Two pointers is really an easy and effective technique that is typically used for Two Sum in Sorted Arrays, Closest Two Sum, Three Sum, Four Sum, Trapping Rain Water and many other popular interview questions. Given a sorted array arr (sorted in ascending order) and a target, find if there exists an
11 min read
Python Match Case Statement
Introduced in Python 3.10, the match case statement offers a powerful mechanism for pattern matching in Python. It allows us to perform more expressive and readable conditional checks. Unlike traditional if-elif-else chains, which can become unwieldy with complex conditions, the match-case statement
7 min read
Regression in machine learning
Regression in machine learning refers to a supervised learning technique where the goal is to predict a continuous numerical value based on one or more independent features. It finds relationships between variables so that predictions can be made. we have two types of variables present in regression
5 min read