Round-off error and exponential function

466 Views Asked by At

Trying to understand why the exponential function e^x is sensitive to round-off error. Googled a ton, did not find a clear answer for me. Please recommend some readings/videos.

1

There are 1 best solutions below

3
On BEST ANSWER

Imagine you're trying to calculate $e^x$ for some $x$, but you round off $x$ to some other number $y$ and compute $e^y$ instead. Sensitivity comes down to trying to understand the following question.

If your error in the input is small, is the error in your output also small?

In other words, if $y$ is close to $x$, does that mean $e^y$ is close to $e^x$?

In order to nail this down, we need to nail down a definition of "close". When talking about rounding errors, a natural thing to look at is relative error (percentagewise error). For example, suppose that you round up and $y$ ends up being $1$ percent larger than $x$. We can express this as $y=1.01x$, or as $\frac{y}{x}=1.01$. What sort of error does this lead to in the exponential? The ratio between our answer and the correct answer is $$\frac{e^y}{e^x}=\frac{e^{1.01 x}}{e^x}=e^{1.01x-0.01x}=e^{0.01x}.$$

And here we see the problem: If $x$ is at all large, this ratio can be much larger than $1.01$. Even if $x$ is, say, $10$, the error in the output is already about $10$ times larger than the $1$ percent error in our input. This magnification of error is what is being referred to by sensitivity.