Approximation matching asymptotes

I have a function f: \mathbb{R} \to \mathbb{R} that is expensive to calculate (implicitly defined, needs iterative methods). But otherwise f is well-behaved: continuous, differentiable, and strictly increasing on all the domain.

It would be nice to use an approximation, but I really need the whole domain. I know that the limits converge to an asymptote, ie

\lim_{x\to\infty} \frac{f(x)}{x} = a \quad\text{and}\quad \lim_{x\to-\infty} \frac{f(x)}{x} = b

One thing that occured to me is to define a function g with the same asymptotic behavior that is cheap to evaluate, and approximate f - g with a rational transformation of Chebyshev polynomials to \mathbb{R}.

However, g should be smoothly differentiable because I need derivatives, so eg

g(x) = (x > 0 ? a : b) * x

is not good enough.

Any suggestions for specific forms of g or other approaches would be appreciated.

Sigmoid or tanh can be made to give that.

f(x) = x*((a+b)+(a-b)*tanh(x))/2

Use TransformVariables :wink: On top of a regular approximator that is.

1 Like

If you think a CDF would be appropriate, and particularly if you’re concerned with the rate at which f approaches its asymptotes, the CDF of this distribution is available in this package and could easily be transformed to fit your needs. It is a seven parameter family of univariate distributions that contains a lot of natural special cases like normal and T-distributions as well as covering a very wide range of tail behaviors. The derivative is of course a PDF that is very convenient to use as well. So if any univariate parametric CDF function would work, this is probably a pretty good contender.

1 Like