Recently, I am trying to derive an algorithm where one step requires me to solve the equation of the form $axe^x+bx+c=0$ where $a, b, c$ are all constant and $x$ is a scalar variable.
Any help would be appreciated.
Recently, I am trying to derive an algorithm where one step requires me to solve the equation of the form $axe^x+bx+c=0$ where $a, b, c$ are all constant and $x$ is a scalar variable.
Any help would be appreciated.
In the most general case, there is no explicit solution to this equation except the generalized Lambert equation since you can write $$e^{-x}=-\frac{a x}{b x+c}$$ (have a look at equation $(4)$ in the linked paper.
This being said, it is nice but not very useful from a practical point of view; so, numerical methods are required and, as a consequence, reasonable starting points.
Without any loss of generality, assuming $a \neq 0$ we can divide all coefficient by $a$ or , simpler, let $a=1$. Now, consider that we look for the zero('s) of function $$f(x)=xe^x+bx+c$$ for which $$f'(x)=e^x (x+1)+b \qquad \text{and} \qquad f''(x)=e^x (x+2)$$ The first derivative cancels at $$x_1=W(-eb)-1$$ where appears Lambert function. In the real domain, this point exists if $b \leq \frac 1{e^2}$.
At this point, we have $$f(x_1)=b W(-e b)+\frac{b}{W(-eb)}-2 b+c $$ $$f''(x_1)= - b \left(1+\frac{1}{W(-eb)}\right)$$ We must notice that $$f(x_1)-c=b W(-e b)+\frac{b}{W(-eb)}-2 b$$ is always negative.
So, if $c <0$, no root. If $c=0$, two possible roots located at $x=0$ and $x=-\log(-b)$ (if the last does exist). If $c<0$, two roots.
There is also an inflection point at $$x_2=-2 \implies f(x_2)=-2 b+c-\frac{2}{e^2}$$ So, if $c<2b+\frac{2}{e^2}$, another possible root.
There two roots that we can locate more or less since the will be on each side of $x_1$. Building a Taylor series around $x_1$, we have as estimates $$x_\pm=x_1 \pm \sqrt{-2 \frac {f(x_1)}{f''(x_1)}}$$
For example, let us try for $b=-0.1$ and $c=-1$. This will give $x_+=1.36$ and $x_-=-2.92$. So, using Newton method, the following iterates $$\left( \begin{array}{cc} 0 & -2.92363 \\ 1 & -7.17566 \\ 2 & -9.92501 \\ 3 & -10.0045 \end{array} \right)$$ $$\left( \begin{array}{cc} 0 & 1.36058 \\ 1 & 0.90268 \\ 2 & 0.65533 \\ 3 & 0.59170 \\ 4 & 0.58807 \\ 5 & 0.58806 \end{array} \right)$$
Not an answer, just a hint.
The equation can be written in the form
$$xe^x=mx+p,$$ which represents the intersection between a transcendental curve and an arbitrary straight line. The curve has an inflection point and there can be up to three solutions.
To discuss the number of roots, you can rely on the tangents that have the slope $m$. Unfortunately, this leads to a nasty equation,
$$(x+1)e^x=m$$ that requires the Lambert function, with
$$x=W(em)-1.$$ There can be two solutions. The intercept of the tangent is then
$$xe^x-mx$$ which you compare to your $p$ to determine the number of solutions and to isolate them between the contact points.