2 ms·
Looks like grandparent probably meant g(x) = x/√(1+x²) Looks like f(x)=x+x^3/5 gets you two decimal digits everywhere [1], and you could improve that with more
by jwmerrill 9y ago
Looks like grandparent probably meant g(x) = x/√(1+x²)
Looks like f(x)=x+x^3/5 gets you two decimal digits everywhere [1], and you could improve that with more terms in the polynomial.
Edit: you can derive f(x) by doing a series expansion of tanh(x)/√(1-tanh(x)²) about x=0, and Mathematica tells me the first few terms are
f(x) = x + x^3/6 + x^5/120 + x^7/5040 + O(x^9)
[1] https://www.desmos.com/calculator/zbyll5oeqk https://www.desmos.com/calculator/zbyll5oeqk
- raphlinus 9y agoOops, yes, you're correct, I was typing from memory and didn't double-check. And yes, the Taylor series is pretty good but you can usually squeeze a bit more accuracy-over-range by, eg, using an optimizer for the coefficients. Also, note that in your notebook you have x^3/5 but x^3/6 is probably what you wanted.