maths.free › Numerical Methods › Error › Truncation error
Truncation error
In numerical analysis and scientific computing, truncation error is an error caused by approximating a mathematical process.
Truncation error
In numerical analysis and scientific computing, truncation error is an error caused by approximating a mathematical process. 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.
Infinite series
A summation series for \(e^x\) is given by an infinite series such as \[e^x=1+ x+ \frac{x^2}{2!} + \frac{x^3}{3!}+ \frac{x^4}{4!}+ \cdots\]
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 \[e^x\approx 1+x+ \frac{x^2}{2!}\]
In this case, the truncation error is \(\frac{x^3}{3!}+\frac{x^4}{4!}+ \cdots\)
Example A:
Given the following infinite series, find the truncation error for x = 0.75 if only the first three terms of the series are used. \[S = 1 + x + x^2 + x^3 + \cdots, \qquad \left|x\right|<1.\]
Solution
Using only first three terms of the series gives \[\begin{aligned} S_3 &= \left(1+x+x^2\right)_{x=0.75} \\ & = 1+0.75+\left(0.75\right)^2 \\ &= 2.3125 \end{aligned}\]
Condensed: the full section is in Wikipedia.
Differentiation
The definition of the exact first derivative of the function is given by \[f'(x) = \lim_{h \to 0} \frac{f(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)=5x^3\) at \(x=7\) using a step size of \(h=0.25\)
Solution:
The first derivative of \(f(x)=5x^3\) is \[f'(x) = 15x^2,\] and at \(x=7\), \[f'(7) = 735.\]
The approximate value is given by \[f'(7) = \frac{f(7+0.25)-f(7)}{0.25} = 761.5625\]
Condensed: the full section is in Wikipedia.
Integration
The definition of the exact integral of a function \(f(x)\) from \(a\) to \(b\) is given as follows.
Let \(f: [a,b] \to \Reals\) be a function defined on a closed interval \([a,b]\) of the real numbers, \(\Reals\), and \[P = \left \{[x_0,x_1], [x_1,x_2], \dots,[x_{n-1},x_n] \right \},\] be a partition of I, where \[a = x_0 < x_1 < x_2 < \cdots < x_n = b.\] \[\int_{a}^b f(x) \, dx = \sum_{i=1}^{n} f(x_i^*)\, \Delta x_i\] where \(\Delta x_i = x_i - x_{i-1}\) and \(x_i^* \in [x_{i-1}, x_i]\).
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 \[\int_{3}^{9}x^{2}{dx}\] 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 \[\begin{aligned} \int_{3}^{9}{x^{2}{dx}} &= \left[ \frac{x^{3}}{3} \right]_{3}^{9} \\ & = \left[ \frac{9^{3} - 3^{3}}{3} \right] \\ & = 234 \end{aligned}\]
Condensed: the full section is in Wikipedia.
Addition
Truncation error can cause \((A+B)+C \neq A+(B+C)\) within a computer when \(A = -10^{25}, B = 10^{25}, 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.
ตอนนี้คุณ ไม่มีเครื่องคิดเลขที่จะคำนวณคำถามนี้ได้ แต่บางส่วนของคำถามนี้สามารถคำนวณได้ ลองใช้ตัวอย่างด้านล่างนี้ หรือพิมพ์คำถามของคุณเอง
สัญลักษณ์ที่ใช้ที่นี่
คลิกสัญลักษณ์ใดก็ได้ เพื่อดูคำอธิบาย รูปภาพ และความหมายของตัวอักษร
คำถามที่คนถาม
Why not just solve exactly?
Most equations have no closed-form solution at all, and many that do are unusable in practice. A numerical method delivers as many correct digits as you need, and a good one tells you how many that is.
Why can Newton's method fail?
If it starts where the tangent is nearly flat it shoots far away; near a repeated root it slows to a crawl; and with several roots it may land on the wrong one. A bracketing method like bisection is slower but cannot fail.
ส่วนหนึ่งของหน้านี้ถูกปรับแต่งจาก Wikipedia (CC BY-SA 4.0). คำอธิบายที่อธิบายใหม่ ความผิดพลาดเป็นของเรา
เพิ่มเติมใน Numerical Methods
Root finding: bisection and Newton's methodNumerical integration: trapezoid and SimpsonInterpolation and Taylor approximationFloating point and error