If we want to evaluate $$f(x)=\frac{e^x-1-x}{x^2}$$ then we have to observe its large relative error as $x\to 0$. My question is that how can we find a method so that we can compute $f(x)$ to full machine precision for all $|x|<1$?
$\begingroup$
$\endgroup$
6
-
1$\begingroup$ en.wikipedia.org/wiki/Pad%C3%A9_approximant $\endgroup$– Steve HuntsmanCommented Jan 25, 2016 at 17:59
-
$\begingroup$ the relative error of the ratio will be the sum of the relative errors of numerator and denominator, so you'll just have to make sure these are small. $\endgroup$– Carlo BeenakkerCommented Jan 25, 2016 at 17:59
-
$\begingroup$ @SteveHuntsman How does Padé Approximate help us here? I am failing to see how this would help. $\endgroup$– user85729Commented Jan 25, 2016 at 18:07
-
$\begingroup$ This is a standard exercise in using Taylor's theorem with remainder. I've voted to close. $\endgroup$– Andy PutmanCommented Jan 25, 2016 at 18:10
-
1$\begingroup$ @user85729 Step 1, use a method to compute a Padé (or min-max) approximant with sufficiently low error on all of [-1,1]. Take as much time as needed, this is a precomputation step. Step 2, store its coefficients, and write a function that applies this rational function to $x$. $\endgroup$– Federico PoloniCommented Jan 25, 2016 at 18:12
|
Show 1 more comment