How can I derive this exponential function given its form and some points?

32 Views Asked by At

This is for a silly simulation I am working on. The details of why I want this function are not important for this question but if you are interested you can follow the link.

I want a function $f$ that satisfies the following properties $$p1:f(1)=0$$ $$p2:f(0)=a; a >> 1$$ $$p3:f(b)=1$$

What I want is a line that starts steep at $f(0) = a$ and transitions smoothly to being less steep at $f(1)=0$. I figure if I take an exponential function with an appropriate base and translate it vertically and horizontally that would work well.

So I am looking for a function of the form $$f(x)=c^{x+d}+e$$

So given $a,b$, solve for $c,d,e$. My attempts at solving this analytically have not gone well. I suppose I could solve this using some sort of gradient decent, but is it possible in closed form? Lambert's product log and similar are permitted. Does this specification result in a unique solution. I suspect it does.

1

There are 1 best solutions below

3
On

Write $$ f(x) = \exp(px + q) + d. $$ From $f(0) = a$, get $$ a = \exp(q) + d. $$ From $f(1) = 0$, get $$ \exp(p + q) + d= 0 $$ so that $$ d = -\exp(p+q). $$ So now your formula is $$ f(x) = \exp(px + q) - \exp(p + q), $$ and the fact about $a$ now reads $$ a = \exp(q) - \exp(p + q) = \exp(\frac{p}{p+q}) \tag{A} $$

From $f(b) = 1$, you get $$ 1 = \exp(pb + q) - \exp(p+q) $$ Taking the difference of these last two gives $$ a-1 = \exp(q) - \exp(pb + q) = \exp(\frac{q}{pb + q}) $$ so that $$ \ln (a-1) = \frac{q}{pb+q}. $$ and from formula A, we have $$ \ln(a) = \frac{p}{p+q} $$ Knowing $a$ and $b$, this amounts to a pair of linear equations in $p$ and $q$, which you can (generally) solve. Of course, it makes no sense if either $a < 0$ or $a -1 < 0$, for in that case, the logarithms on the LHS are undefined.

Of course, not every pair of simultaneous linear equations in two unknowns has a solution (example: $x + y = 1 ; x + y = 2$), and it's possible that for some values of $a$ and $b$, your equations will be unsolvable as well.