I am trying to fit an exponential function to some data I have. I am trying to reduce my model to a single parameter; which fits to a dependent variable x and independent variable y such that;
$$ x \in (0, 1] \\ y \in (0, 1] $$
The function I'm fitting I wanted to be bound between (0, 0) and (1, 1). This is the only form I came up with;
$$ f(x) = \frac{e^{\lambda x}-1}{e^{\lambda}-1} $$
It fits my data fine, with one exception. I would like the parameter to be able to range between positive and negative values without the function becoming singular. I know that
$$ \lim_{\lambda \to 0} \frac{e^{\lambda x}-1}{e^{\lambda}-1} = x $$
But I am doing the functional fit computationally; so I am gettings NaN errors as the parameter approaches 0. I was wondering if there is an equivelant functional form (or some other exponential function with the same bounds) that can smoothly vary along the same shape of the function, but also avoiding the singularity at $\lambda=0$. I considered few things.
- Replacing $\tau=1/\lambda$; but the transition between positive and negative $\lambda$ is seperated by positive and negative infinity with tau; which means the initialized sign of the parameter cannot change.
- Add an $\epsilon$ to the denumerator to regulate the 0 division does not work, as $lim_{\lambda\to 0} f(1) = \frac{\lambda}{\epsilon} \neq 1$
- Expanding around $\lambda$ proven not fruitful for me.
I do fit a multiple parameter function right now, but I would love being able to switch to a regular single parameter.
I just ended up handwriting the exception; and feed the new function into a numeric solver; for which the parameter derivative is always defined.