Root of the function $f(x)=xe^x-R$ How can we find the root of the function $f(x)=xe^x - R$ for a general R where $R>=-1/e.$ I don't have any idea as to how to even approach this. Came across this problem during my self-study in numerical methods but have no one to ask help from.
 A: Newton's method will work fairly well here. In particular, letting $f(x) = xe^x - R$, then $f'(x) = xe^x + e^x$, so our iteration step will be
$$x_{n + 1} = x_n - \frac{x_ne^{x_n} - R}{(x_n + 1) e^{x_n}}$$
So if we choose, for example, $R = 1$ and $x_0 = 0$, we find that
\begin{align}
x_0 &= 0 \\
x_1 &= 1 \\
x_2 &\approx 0.6839 \\
x_3 &\approx 0.5775 \\
x_4 &\approx 0.5672 \\
x_5 &\approx 0.5671433 \\
x_6 &\approx 0.5671433
\end{align}
So it converges pretty quickly. Checking this in our original function, we find that
$$f(0.5671433) \approx 2.22 \times 10^{-16}$$
So it's pretty good.
A: I think that T. Bongers method is good, but in my opinion this is classic Lambert W Function solution and actually faster one.
First $R$ has domain of $\left[-\frac 1e, +\infty\right)$, which is the exact domain of the Lambert W function.
Another reason is that if we set $f(x) = 0$, we have:
$$xe^x - R = 0$$
$$R = xe^x$$
And actually this is the basic look of the Lambert W function, which is:
$$z = W(z)e^{W(z)}$$
So our solution will be:
$$x = W(R)$$
To get an actual value you can search the Internet for a generating fomula, but I recommend a calulcator like this one
