Solving $e^{x^2}+xe^{x}=5e^{x}$ for $x$ Analytical solution not numerical solution. I tried to solve for $x$ in the equation $e^{x^2}+xe^{x}=5e^{x}$ I  did
$e^{x^2}+xe^{x}=5e^{x}$
$e^{x^2}=(5-x)e^{x}$
$1=(5-x)e^{x-x^2}$
$xe^{4x}=x(5-x)e^{x(5-x)}$
Apply Lambert Function
$W(xe^{4x})=x(5-x)$
but it's wrong, can anyone help.
 A: I do not think that we could have any analytical solution but we can obtain accurate formal approximations  for the zero's of function
$$f(x)=e^{x^2}+e^x (x-5)$$
For the negative solution, use a Taylor expansion around $x=-1$. For example
$$f(x)=\left(e-\frac{6}{e}\right)+\left(-\frac{5}{e}-2 e\right) (x+1)+\left(3
   e-\frac{2}{e}\right) (x+1)^2-\left(\frac{1}{2 e}+\frac{10 e}{3}\right)
   (x+1)^3+O\left((x+1)^4\right)$$
Now perform a series reversion to obtain, as an approximation,
$$x=-\frac{59178+1026 e^2+79470 e^4+3225 e^6+4042 e^8-44 e^{10}}{6 \left(5+2
   e^2\right)^5}$$ which is $-0.924458$ while the numerical solution is $x=-0.924461$.
Simpler would be to consider the function
$$g(x)=x^2-x-\log(5-x)$$ which shows a minimum at
$$x_*=\frac{1}{4} \left(11-\sqrt{89}\right)$$ Performing a series expansion around this point gives
$$x=x_*\pm\sqrt{-2\frac {f(x_*)} {f''(x_*)}}$$ that is to say
$$x=\frac{11-\sqrt{89}}{4} \pm \frac{9+\sqrt{89}}{4} \sqrt{ \frac{9 \sqrt{89}-83+8 \log \left(\frac{1}{4}
   \left(9+\sqrt{89}\right)\right)}{89+9 \sqrt{89}}}$$ which gives $x_1\sim -0.922081$ and  $x_2\sim 1.70509$ while the numerical solution are $x_1=-0.924461$ and  $x_2=1.70145$.
Now, one single iteration of Newton method gives an explicit result (too long to type it) and the numerical values are
$$x_1=-0.9244634\qquad \text{and} \qquad x_2=1.7014554$$ to be compared to the "exact" values
$$x_1=-0.9244612\qquad \text{and} \qquad x_2=1.7014503$$
