fitting a 1d function with an asymptote

59 Views Asked by At

I am trying to fit a positive function $f(x)$ , $0 < x\leq 1$, with the following properties:

$$f(0) =\infty$$

$$f(1) = 1$$

$$\frac{df}{dx}(1) > 0$$

$$f(x) > 0,\text{ }\forall\text{ }x\in(0,1)$$

So, briefly, the function dips down from +infinity to some value and climbs back to $1$ at $x = 1$.

I have numerical values for $f(x)$ and $x$. What would be a good choice of basis function here ? I tried something like $\frac{a_1}{z} + a_2 + a_3z + a_4z^2 + ...$, but that did not work.

1

There are 1 best solutions below

1
On

Let $(x_k,y_k)$, $k=1,\cdots n$ be the data.

Three answering levels :

A) Here is a "starter function"

$$y=f_1(x)=\dfrac{2x}{3}+\dfrac{1}{3x}$$

fulfilling the different constraints (with $df/dx(1)=1/3>0$).

B) From here, there is a degree of freedom allowing a better initial fit obtained by taking a power of this function, an operation preserving all the constraints :

$$y=f_n(x)=\left(\dfrac{2x}{3}+\dfrac{1}{3x}\right)^n$$

$n$ being a positive number ($n=1/2,3/2,2,...$), not necessarily integer, providing a better fit to your data, taking a particular attention to the initial data (close to the asymptote) are correctly represented. It remains to "tune" this answer by a

replacement of $y_k$ data by the "gaps" $y_k-f_n(x_k)$ followed by a fitting process on them (a polynomial basis is indeed a good idea).

C) The issue is that you cannot expect a very good fit when you have an asymptote. Said otherwise : I imagine you data have, say, $2$ order of magnitude between them (for example having at the same time $(x_1,y_1)=(0.05, 150)$ whereas $(x_5,y_5)=(0.95, 0.98)$). Therefore, I advise you, from the beginning, to operate

Transformation of your data $y_k$ into $\ln(y_k)$, find a fit, then comme back to your initial data by taking the exponential of your "best fit" function.

(it is a little the idea I have used in part B).

Remark : The curve of $f_1$ is a hyperbola with a vertical asymptote $x=0$ and a slant asymptote $y=\dfrac{2x}{3}$. Its minimum has the following coordinates : $(\dfrac{\sqrt{2}}{2},\dfrac{2\sqrt{2}}{3})$.