In a recent piece of homework I needed to solve an equation of the form $ae^x + bx +c = 0$ where $a,b$ and $c$ are constants. I could not do it; no matter how I tried I either went in circles or hit a brick wall. Can someone demonstrate a general method for solving equations of this form? Please show every step in your answers.
-
1$\begingroup$ This article on exponential-linear equations focuses on these type of equations. $\endgroup$– ArpanApr 17, 2015 at 7:10
-
$\begingroup$ See there : math.stackexchange.com/questions/479776/solving-aebxcxd-0?rq=1 Short answer, there are no easy solution. $\endgroup$– Paul PicardApr 17, 2015 at 7:10
-
$\begingroup$ @PaulPicard Hmm. Well the solution can't be a complex number (since that wouldn't make sense in the context of the question), so I guess I've done something wrong. Thanks anyway :) $\endgroup$– imulsionApr 17, 2015 at 7:13
-
1$\begingroup$ See Lambert W function. $\endgroup$– LucianApr 17, 2015 at 7:33
-
1$\begingroup$ @imulsion: Who said that there's only one solution ? And why, pray tell, can't at least some of them be complex ? And how on earth would you even know their nature, since the values of the three parameters are not even given ? $\endgroup$– LucianApr 17, 2015 at 7:41
2 Answers
\begin{align} a e^{x}+b x+c&=0 \end{align} Substitute $bx+c=y$: \begin{align} a e^{((-c+y)/b)}+y &= 0 \\ -y &= ae^{-c/b}e^{y/b} \\ \frac{-y}{b}e^{-y/b} &= \frac ab e^{-c/b} \end{align} The last equation is in the form $u\exp(u)=w$, which has a solution in terms of Lambert $W$ function: \begin{align} u&=W(w). \end{align} Hence \begin{align} \frac{-y}{b}&=W(\frac ab e^{(-c/b)}) \\ y&=-b W(a/b e^{\frac{-c}{b})} \\ x&=-W(\frac ab e^{-c/b})- \frac cb. \end{align} In particular, equation $88\exp(x)+12x-5=0$ with $a=88,b=12,c=-5$ has one real root, since the argument of $W$ is positive: \begin{align} x&=-W_0(\frac{22}{3} e^\frac{5}{12}))+\frac{5}{12} \approx-1.3970513. \end{align}
Edit:
Lambert's W function is included in the Gnu Scientific Library (GSL) and is freely available by means of many computer systems and packages (wolframalpha, R, Asymptote, python scipy.special to name a few).
As said, there is an analytical solution in terms of Lambert function $$x=-W(d)-\frac{c}{b}$$ where $$d=\frac{a }{b}e^{-\frac{c}{b}}$$ If you do not want to (or cannot) use Lambert function, then numerical methods are the way to go.
Probably the simplest should be Newton method which, starting from a "reasonable" guess $x_0$, will update it according to $$x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$$ For the example you give in comments $$f(x)=5-12x - 88e^x$$ $$f'(x)=-12-88e^x$$ A look at the graph of the function shows that the solution is close to $-1.5$. So, let start iterating at $x_0=-1.5$; the method will generates the following iterates : $-1.393646353$, $-1.397047564$, $-1.397051301$ which is the solution for ten significant figures.
-
$\begingroup$ I've definitely done it wrong then - my solution has to be positive to make sense in the context of the question. thanks anyway though :) $\endgroup$– imulsionApr 17, 2015 at 8:51
-
$\begingroup$ May be, there was a typo in the equation. In any manner, you are very welcome ! $\endgroup$ Apr 17, 2015 at 8:53