Transcendental Equation with Quadratic Part (Can it be solved via Lambert W function)? There I hope to minimize an optimization problem:
$$ \min_{x \in \mathbb{R}_+} f(x) = x^2 -ye^{-x^2} + r(x -d )^2,$$ where $y, d \in \mathbb{R}$ and $r \in \mathbb{R}_+$. 
For this equation, the most natural idea is to find the critical point $x_0$ where $f'(x_0) = 0$. That is, $(r+1)x + yxe^{-x^2}  = r$. 
But this form is not  similar with Lambert W function since quadratic term is involved. Is there any method to find the analytic/ numerical solution of this equation? Thanks in advance!
 A: Considering that you look for the zero of function
$$g(x)=(r+1)x + yxe^{-x^2}  - r$$ Its derivative
$$g'(x)=(r+1)+y\,e^{-x^2} \left(1-2 x^2 \right)$$ cancels at 
$$x_*=\frac 1{\sqrt 2}\sqrt{1-2 W\left(-\frac{\sqrt{e} (r+1)}{2 y}\right)}$$ (since you look for ${x \in \mathbb{R}_+}$).
Now, two possibilities :


*

*$x_*$ does not exist in $\mathbb{R}_+$ and then $g'(x)$ does not change sign and Newton method would not face any trouble (more or less iterations depending on $x_0$). What we know is that $g(0)=-r$, $g'(0)=1+r+y$, $g''(0)=0$. There is a solution only if $(1+r+y >0$; if not, no solution. If yes, start with $x_0=0$ or better $x_0=\frac{r}{r+y+1}$ which is the result of the first iteration of Newton method.

*$x_*$ does exist in $\mathbb{R}_+$.  Now, we can build a Taylor series around $x_*$ which would give as initial estimate
$$x_0=x_*+\sqrt{-2\frac{g(x_*)}{g''(x_*)}}$$ with
$$g(x_*)=\frac{\sqrt{2} (r+1) x_*^3-2 r x_*^2+r}{2 x_*^2-1}\qquad \text{and}\qquad g''(x_*)=\sqrt{2} (r+1) x_* \left(\frac{2}{1-2 x_*^2}+1\right)$$
