In practice, given a function and a desired accuracy ,
we would like know which degree to choose for the
Taylor polynomial approximation, such that
The following formula from Calculus is exactly what we need to estimate the error.
Let have continuous derivatives for
.
Construct the Taylor polynomial
that approximates around . The difference between
the function value and the polynomial value
is
To prove the formula, we use repeated integrations by parts.
The remainders can then be brought from the integral form to
the standard form using the mean value theorem
For example, let and . We want to find the Taylor
polynomial which approximates within
for .
The problem can be formulated as follows: find such that
According to the Taylor remainder formula
When computing functions, or other mathematical objects (e.g. integrals) we are forced to make certain algorithmic approximations. In our case, we cannot evaluate the infinite Taylor series; we need to truncate it, i.e. to stop the computations after a finite number of terms. The resulting error is a first example of truncation error in numerical computing. Truncation is a second source of numerical errors, after roundoff. While roundoff is due to inexact computer arithmetic, truncation errors are due to ``inexact mathematical formulas'', i.e. to the algorithmic approximations we make in order to keep the computations feasible.