With "extension" I mean as likeZ1202 wrote: ↑Mon Mar 04, 2019 11:24 am I'm not sure what you're referring to as "extension of the base function", maybe because I didn't read the entire thread, also not sure to which phenomenon you're referring to. However, since your relative error seems to increase towards the right, I would assume that you did the basic Remez with equal absolute error. You can do a equal relative error Remez, for functions passing through 0, e.g. for 2^x-1 by approximatig f(x)/x with an equal absolute error and then multiplying the result by x (that's IIRC what 2DaT did).
- mystran's tanh(x) approximation suggestion (tanh(sqrt(x))/sqrt(x)) few pages earlier here,
- 2Dat's tanh(0.5*ln(2)*x) in his tanh() -thread,
- using sqrt() in my example here and
-OP's suggestion to use 0.25x as input for pade approximation with result raised to ^4 on page 2 ...
(and many more which ones I have bumped to).
and with "base function" the standard function found in math library ... exp(x) as for an example.
Many of those "extensions" may manipulate just the input value but as my example shows, taking sqrt() from exp() before approximation improves the accuracy (inside selected range) a bit. I've tested this with many approximation methods.
What comes to error measures , sollya gives these :
Code: Select all
f=exp(x);
p=remez(f,5,[-0.5;0.5]);
accurateinfnorm(p-f,[-0.5;0.5],20); 6.85118720866739749908447265625e-7
dirtyinfnorm(f-p,[-0.5;0.5]); 6.8511871736519530567224004924030262426642803963291e-7
Code: Select all
f=sqrt(exp(x));
p=remez(f,5,[-0.5;0.5]);
accurateinfnorm(p^2-exp(x),[-0.5;0.5],20); 2.72815441348939202725887298583984375e-8
dirtyinfnorm(exp(x)-p^2,[-0.5;0.5]); 2.72815398477066347610026190423265159037885082468976e-8