In numerical analysis and scientific computing, truncation error is an error caused by approximating a mathematical process.[1]
A summation series for
ex
In reality, we can only use a finite number of these terms as it would take an infinite amount of computational time to make use of all of them. So let's suppose we use only three terms of the series, then
In this case, the truncation error is
x3 | + | |
3! |
x4 | |
4! |
+ …
Example A:
Given the following infinite series, find the truncation error for if only the first three terms of the series are used.
Solution
Using only first three terms of the series gives
The sum of an infinite geometrical series is given by
For our series, and, to give
The truncation error hence is
The definition of the exact first derivative of the function is given by
However, if we are calculating the derivative numerically,
h
h
Example A:
Find the truncation in calculating the first derivative of
f(x)=5x3
x=7
h=0.25
Solution:
The first derivative of
f(x)=5x3
x=7
The approximate value is given by
The truncation error hence is
The definition of the exact integral of a function
f(x)
a
b
Let
f:[a,b]\to\Reals
[a,b]
\Reals
\Deltaxi=xi-xi-1
* | |
x | |
i |
\in[xi-1,xi]
This implies that we are finding the area under the curve using infinite rectangles. However, if we are calculating the integral numerically, we can only use a finite number of rectangles. The error caused by choosing a finite number of rectangles as opposed to an infinite number of them is a truncation error in the mathematical process of integration.
Example A.
For the integralfind the truncation error if a two-segment left-hand Riemann sum is used with equal width of segments.
Solution
We have the exact value as
Using two rectangles of equal width to approximate the area (see Figure 2) under the curve, the approximate value of the integral
Occasionally, by mistake, round-off error (the consequence of using finite precision floating point numbers on computers), is also called truncation error, especially if the number is rounded by chopping. That is not the correct use of "truncation error"; however calling it truncating a number may be acceptable.
Truncation error can cause
(A+B)+C ≠ A+(B+C)
A=-1025,B=1025,C=1
(A+B)+C=(0)+C=1
A+(B+C)=A+(B)=0
A+(B+C)