Problem:
We replace ex by its Taylor polynomial of degree 60
with center
Solution: We use the
Lagrange form of the remainder.
Consider any
Since the exponential is increasing, the maximum is attained at the right endpoint of I, so we get (recalling that x is at most 20)
Relative error: Relative error is the absolute error
Remark:
1. When we look at the error estimate, it would seem that the
approximation is very bad (error of 22 thousand). However, we know
that the further we approximate from the center a, the worse the
approximation, so those huge errors most likely happen near 20. However,
there also ex is very large, so even such a big
error may not be all that bad. Note that it also works the other way around.
If if we learn that an error of approximation is small, it may not guarantee
that the approximation is good: If the value we approximate is extremely
tiny, then even a seemingly small error of approximation may completely
distort the answer.
To know for sure how good our approximation is we have to ask about the relative error. Indeed, in our example we see that the error of approximation is not even a percentile of the real answer; to put it another way, if we use the approximation as in the question, then the order of magnitude and the first five valid digits in the answer are definitely correct Probably even more, since Lagrange gives the worst case scenario while exponential is quite a nice function. So the approximation is quite good.
Finally, note that it was essential that we knew right from the start how x is restricted. If we allowed x to be arbitrary, then no Taylor polynomial can give consistently good approximations. For instance, if instead of 20 we took 30 as the upper limit, then the relative error would be much worse and we would have to increase the degree to get back to the precision we have here.
2. The above example is closely related to calculator design.
Unfortunately, there is no algebraic formula that would supply
us with values of popular elementary functions like exponential, logarithm,
sine, cosine and in fact all trig functions. How do we get them on our
calculator if its processor can essentially only add and multiply? It is
done by approximating these functions. Note that situation there is similar
to our problem. A calculator has restricted range for x (typically
between −1099 and 1099) and only remembers a certain
number of digits from every number (typically 12 or 13), so all errors that
do not influence these digits are irrelevant (the calculator itself already
makes an error of this magnitude by rounding numbers to the relevant number
of digits). This leads to the following problem: Find the degree
of the Taylor polynomial which approximates the given function in such a way that
the relative error for
However, this is not exactly how this is done in calculators and computers, since calculating such a high degree polynomial takes an enormous amount of time. Thus they use various tricks to cut down on the number of algebraic operations needed. One such trick is to rearrange Taylor polynomials so that they are easier to evaluate. Another trick is to store in memory many values of the given function (this is done only once when designing the calculator so we can wait) and then when somebody wants to use a different argument, the calculator approximates the answer using nearest two values - the approximation need not be that demanding. We encountered here a very complicated and advanced (and obviously useful) part of mathematics, but that is another story