Truncation error

From testwiki
Revision as of 02:06, 13 February 2025 by imported>JakobJ87 (Brief explanation for the origin of "truncation" taken from Numerical error)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Short description Template:Other uses In numerical analysis and scientific computing, truncation error is an error caused by approximating a mathematical process.[1][2] The term truncation comes from the fact that these simplifications often involve the truncation of an infinite series expansion so as to make the computation possible and practical.

Examples

Infinite series

A summation series for ex is given by an infinite series such as ex=1+x+x22!+x33!+x44!+

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 ex1+x+x22!

In this case, the truncation error is x33!+x44!+

Example A:

Given the following infinite series, find the truncation error for Template:Math if only the first three terms of the series are used. S=1+x+x2+x3+,|x|<1.

Solution

Using only first three terms of the series gives S3=(1+x+x2)x=0.75=1+0.75+(0.75)2=2.3125

The sum of an infinite geometrical series S=a+ar+ar2+ar3+, r<1 is given by S=a1r

For our series, Template:Math and Template:Math, to give S=110.75=4

The truncation error hence is TE=42.3125=1.6875

Differentiation

The definition of the exact first derivative of the function is given by f(x)=limh0f(x+h)f(x)h

However, if we are calculating the derivative numerically, h has to be finite. The error caused by choosing h to be finite is a truncation error in the mathematical process of differentiation.

Example A:

Find the truncation in calculating the first derivative of f(x)=5x3 at x=7 using a step size of h=0.25

Solution:

The first derivative of f(x)=5x3 is f(x)=15x2, and at x=7, f(7)=735.

The approximate value is given by f(7)=f(7+0.25)f(7)0.25=761.5625

The truncation error hence is TE=735761.5625=26.5625

Integration

The definition of the exact integral of a function f(x) from a to b is given as follows.

Let f:[a,b] be a function defined on a closed interval [a,b] of the real numbers, , and P={[x0,x1],[x1,x2],,[xn1,xn]}, be a partition of I, where a=x0<x1<x2<<xn=b. abf(x)dx=i=1nf(xi*)Δxi where Δxi=xixi1 and xi*[xi1,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 integral 39x2dx find 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 39x2dx=[x33]39=[93333]=234

Using two rectangles of equal width to approximate the area (see Figure 2) under the curve, the approximate value of the integral

39x2dx(x2)|x=3(63)+(x2)|x=6(96)=(32)3+(62)3=27+108=135

Truncation Error=Exact ValueApproximate Value=234135=99.

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.

Addition

Truncation error can cause (A+B)+CA+(B+C) within a computer when A=1025,B=1025,C=1 because (A+B)+C=(0)+C=1 (like it should), while A+(B+C)=A+(B)=0. Here, A+(B+C) has a truncation error equal to 1. This truncation error occurs because computers do not store the least significant digits of an extremely large integer.

See also

References

Template:Reflist