Errors in Numerical Methods - Computer Oriented Numerical Methods

Hey there! Welcome to KnowledgeKnot! Don't forget to share this with your friends and revisit often. Your support motivates us to create more content in the future. Thanks for being awesome!

Errors are an inevitable part of numerical computations. Understanding these errors is crucial for assessing the accuracy and reliability of our calculations. This guide provides a comprehensive overview of errors in numerical methods, complete with both simple and advanced examples and explanations.

Types of Errors

Errors in numerical methods can be broadly categorized into two main types:

  1. Input Data Errors
  2. Computational Errors

1. Input Data Errors

Input data errors occur during the measurement or input of data. These errors are often due to limitations in measurement devices or human error.

Simple Example of Input Data Error:

Measuring the length of a room with a tape measure marked in centimeters. If the actual length is 5.23 m, but you read and record it as 5.2 m, the input data error is:

Input Data Error=Actual ValueMeasured Value=5.23 m5.2 m=0.03 m\text{Input Data Error} = \text{Actual Value} - \text{Measured Value} = 5.23 \text{ m} - 5.2 \text{ m} = 0.03 \text{ m}

Advanced Example of Input Data Error:

Measuring the temperature of a room using a thermometer with 0.1°C precision. If the actual temperature is 22.73°C, but you read and record it as 22.7°C, the input data error is:

Input Data Error=Actual ValueMeasured Value=22.73°C22.7°C=0.03°C\text{Input Data Error} = \text{Actual Value} - \text{Measured Value} = 22.73°C - 22.7°C = 0.03°C

2. Computational Errors

Computational errors arise during numerical calculations. They can be further divided into three types:

  1. Truncation Errors
  2. Round-off Errors
  3. Data Errors

Truncation Errors

Truncation errors occur when we approximate an infinite process by a finite one. This often happens when we use a limited number of terms from an infinite series to approximate a function.

Simple Example: Approximating π

If we approximate π as 3.14 (using only two decimal places), the truncation error is:

Truncation Error=π3.143.14159...3.140.00159\text{Truncation Error} = π - 3.14 ≈ 3.14159... - 3.14 ≈ 0.00159

Advanced Example: Taylor Series Approximation

Consider the Taylor series expansion of exe^x around x = 0:

ex=1+x+x22!+x33!+x44!+e^x = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \cdots

If we use only the first three terms to approximate e0.5e^{0.5}:

e0.51+0.5+0.522=1.625e^{0.5} \approx 1 + 0.5 + \frac{0.5^2}{2} = 1.625

The actual value of e0.5e^{0.5} is approximately 1.6487. The truncation error is:

Truncation Error=1.64871.625=0.0237\text{Truncation Error} = 1.6487 - 1.625 = 0.0237

Advanced Example: Numerical Integration

When using the trapezoidal rule to approximate the integral of f(x)=x2f(x) = x^2 from 0 to 1 with just two subintervals:

01x2dx12(02+2(0.52)+12)0.5=0.3125\int_0^1 x^2 dx \approx \frac{1}{2}(0^2 + 2(0.5^2) + 1^2) \cdot 0.5 = 0.3125

The actual value of the integral is 13\frac{1}{3}. The truncation error is:

Truncation Error=130.3125=0.02083\text{Truncation Error} = \frac{1}{3} - 0.3125 = 0.0208\overline{3}

Round-off Errors

Round-off errors occur due to the finite precision of floating-point arithmetic in computers. These errors can accumulate in long computations or when subtracting nearly equal numbers.

Simple Example: Division with Limited Precision

Consider dividing 1 by 3 on a calculator that displays only 4 decimal places:

1÷3=0.3333 (on calculator)1 \div 3 = 0.3333 \text{ (on calculator)}

The true value is 0.3333... (repeating). The round-off error in this case is:

Round-off Error=0.3333...0.33330.0000333...\text{Round-off Error} = 0.3333... - 0.3333 \approx 0.0000333...

Advanced Example: Subtracting Nearly Equal Numbers

Consider calculating (10.999999)(1 - 0.999999) in a computer with 6 decimal digits of precision:

1.0000000.999999=0.0000011.000000 - 0.999999 = 0.000001

The result has only one significant digit, even though both input numbers had 6 significant digits.

Advanced Example: Accumulation of Round-off Errors

Add 0.1 to 0 ten times in a computer that uses binary floating-point arithmetic:

0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1=0.999999999999999890.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 = 0.99999999999999989

The result is not exactly 1 due to the accumulation of round-off errors in binary representation of 0.1.

Measures of Accuracy

To quantify the accuracy of numerical computations, we use two primary measures:

  1. Absolute Error
  2. Relative Error

Absolute Error

Absolute error is the magnitude of the difference between the exact value and the approximation:

Absolute Error=Exact ValueApproximate Value\text{Absolute Error} = |\text{Exact Value} - \text{Approximate Value}|

Relative Error

Relative error is the ratio of the absolute error to the magnitude of the exact value:

Relative Error=Exact ValueApproximate ValueExact Value\text{Relative Error} = \frac{|\text{Exact Value} - \text{Approximate Value}|}{|\text{Exact Value}|}

Simple Example: Approximating π

Let's say we approximate π as 3.14. The actual value of π to 5 decimal places is 3.14159.

Absolute Error:

Absolute Error=3.141593.14=0.00159\text{Absolute Error} = |3.14159 - 3.14| = 0.00159

Relative Error:

Relative Error=0.001593.141590.000506 or about 0.0506%\text{Relative Error} = \frac{0.00159}{3.14159} \approx 0.000506 \text{ or about } 0.0506\%

Advanced Example: Approximating π

Let's say we approximate π as 3.14159. The actual value of π to 10 decimal places is 3.1415926535.

Absolute Error:

Absolute Error=3.14159265353.14159=0.0000026535\text{Absolute Error} = |3.1415926535 - 3.14159| = 0.0000026535

Relative Error:

Relative Error=0.00000265353.14159265358.446×107 or about 0.00008446%\text{Relative Error} = \frac{0.0000026535}{3.1415926535} \approx 8.446 \times 10^{-7} \text{ or about } 0.00008446\%

Propagation of Errors

In complex calculations involving multiple operations, errors can propagate and compound. Understanding how errors propagate is crucial for assessing the reliability of numerical results.

Simple Example: Adding Numbers with Errors

Suppose we measure two lengths: 5.2 ± 0.1 m and 3.8 ± 0.1 m. When we add these lengths:

Total Length=(5.2±0.1)+(3.8±0.1)=9.0±0.2 m\text{Total Length} = (5.2 \pm 0.1) + (3.8 \pm 0.1) = 9.0 \pm 0.2 \text{ m}

The errors add up, resulting in a larger uncertainty in the final result.

Advanced Example: Error Propagation in Multiplication

Now, let's calculate the area of a rectangle using these measurements:

A=(5.2±0.1)×(3.8±0.1)=19.76±0.82 m2A = (5.2 \pm 0.1) \times (3.8 \pm 0.1) = 19.76 \pm 0.82 \text{ m}^2

The relative error in the area is:

0.8219.764.15%\frac{0.82}{19.76} \approx 4.15\%

Note how the relative errors in length (1.92%) and width (2.63%) compound to a larger relative error in the area.

Conclusion

Understanding errors in numerical methods is crucial for anyone working with computational mathematics or scientific computing. By recognizing the sources of errors and how to quantify them, we can better assess the accuracy and reliability of our numerical results.

Remember that while we strive to minimize errors, they are an inherent part of numerical computations. The goal is not to eliminate errors entirely, but to understand and manage them effectively in the context of our specific applications.

Suggetested Articles