3
$\begingroup$

I am stuck in trying to solve the following:

Given two points $(x_{1}; y_{1})$ and $(x_{2}; y_{2})$, to determine the parameters $a$ and $b$ in the equation:
$$y=\frac{e^{a+bx} - e^{a}}{1+e^{a+bx}}.$$
In other words, I have two unknowns and two set of points, so there's for sure a solution, but how can the following system of equation be rewritten explicitly on $a$ and $b$?

$$\left\{\begin{matrix} y_{1}&=\frac{e^{a+bx_{1}} - e^{a}}{1+e^{a+bx_{1}}}\\ y_{2}&=\frac{e^{a+bx_{2}} - e^{a}}{1+e^{a+bx_{2}}} \end{matrix}\right.$$

Should I implement an equation solver instead? In which case, do you have any suggestion on the method?

Thanks very much, I hope it's not a too stupid question :)

  • 0
    oops misread your question, never mind2010-12-06
  • 0
    can you figure out good initial estimates for $a$ and $b$, should you choose the iterative route? Then Newton-Raphson should do the job.2010-12-07

1 Answers 1

4

I don't know how to solve exactly (or even if it's possible) but maybe this will help: Let $A = e^a$ and $B = e^b$. It suffices to find $A$ and $B$ and then take logarithms. Your two equations can be written as $$y_1 = {A(B^{x_1} - 1) \over 1 + AB^{x_1}}$$ $$y_2 = {A(B^{x_2} - 1) \over 1 + AB^{x_2}}$$ You can solve each of these equations for $A$ via some algebra: $$A = {y_1 \over B^{x_1}(1 - y_1) - 1}$$ $$A = {y_2 \over B^{x_2}(1 - y_2) - 1}$$ So the reciprocals of the right-hand sides are the same (the original equation ensures that $y_1$ and $y_2$ are nonzero): $${B^{x_1}(1 - y_1) - 1 \over y_1} = { B^{x_2}(1 - y_2) - 1 \over y_2}$$ In other words, $${1 - y_1 \over y_1}B^{x_1} - {1 - y_2 \over y_2}B^{x_2} = {1 \over y_1} - {1 \over y_2}$$ This doesn't have a general solution you can write out (for example if $x_1$ and $x_2$ are large positive integers it's a polynomial equation of large degree). But it shouldn't be too hard to deal with numerically. Once you know what $B$ is (or have a good enough approximation) you can plug back in above to get $A$.

  • 0
    Thanks, is there any particular method you can suggest to solve/approximate the last equation?2010-12-06
  • 0
    Even something like Newton's method should converge to a solution pretty quickly. I plugged a few examples into Wolfram Alpha and it was able to come up with approximations to solutions.2010-12-07
  • 0
    Ok thanks, I checked and implemented a simple Newton-Raphson solver. However, take this case: (2; 0.2) and (20; 0.8). It doesn't seem to have real solutions: http://bit.ly/hXOvSq2010-12-07
  • 0
    See here for a simple javascript implementation: http://vps.minux.it/newton.htm [here 'low-end' and 'high-end' are the two points (x1;y1) and (x2;y2)].2010-12-07