How to find all the roots of $xe^{-x}=A$

128 Views Asked by At

I am trying to find all the roots of the equation $xe^{-x}=A$.

I tried using LambdertW function. I used $-xe^{-x}=-A$

Solution is $x = -LW(-A)$, where $LW$ is the Lambertw finction.

As $-xe^{-x}$ is negative, decreases intially and then increases close to zero, there will two roots corresponding to -A.

When I use the lambertW function in matlab, I am only able to get one root out of the two roots.

Is there any way to get both the roots?

2

There are 2 best solutions below

1
On BEST ANSWER

According to the documentation: https://www.mathworks.com/help/symbolic/lambertw.html, the syntax for both roots should be lambertw(0,k) and lambertw(-1,k), as the description says:

lambertw(k,x) is the kth branch of the Lambert W function. This syntax returns real values only if k = 0 or k = -1.

2
On

You look for the zero(s) of $$f(x)=x\,e^{-x}-A$$ Its derivative cancels for $x=1$ and the second derivative test shows this is a maximum. So,

  • if $A > \frac 1e$, no solution
  • if $A =\frac 1e$, one double root
  • if 0 < $A < \frac 1e$, two solutions $x_1=-W_0(-A)$ and $x_2=-W_{-1}(-A)$
  • if $A=0$, the trivial solution
  • if $A<0$, one solution $x=-W_0(-A)$