Solve Lambert
1. The problem is to solve the equation $n^2 = 7^n$ for $n$ using the Lambert W function.
2. Rewrite the equation: $n^2 = 7^n$ implies $n^2 = e^{n \ln 7}$.
3. Rearrange to isolate terms: $n^2 = e^{n \ln 7}$ can be written as $e^{-n \ln 7} n^2 = 1$.
4. Define $x = n \ln 7$ so that $n = \frac{x}{\ln 7}$. Substitute to get:
$$e^{-x} \left(\frac{x}{\ln 7}\right)^2 = 1$$
5. Multiply both sides by $e^{x}$ to get:
$$\left(\frac{x}{\ln 7}\right)^2 = e^{x}$$
6. Rewrite as:
$$x^2 = (\ln 7)^2 e^{x}$$
7. Rearranged to isolate $x$:
$$\frac{x^2}{e^{x}} = (\ln 7)^2$$
8. Multiply both sides by $e^{-x}$:
$$x^2 e^{-x} = (\ln 7)^2$$
9. Set $y = -x$, so:
$$x^2 e^{-x} = (-y)^2 e^{y} = y^2 e^{y} = (\ln 7)^2$$
10. Now focus on solving:
$$y^2 e^{y} = (\ln 7)^2$$
11. Make substitution $z = y e^{y/2}$. Then $z^2 = y^2 e^{y} = (\ln 7)^2$, so $z = \pm \ln 7$.
12. From $z = y e^{y/2} = \pm \ln 7$, express as:
$$y e^{y/2} = \pm \ln 7$$
13. Let $w = \frac{y}{2}$, then:
$$2 w e^{w} = \pm \ln 7$$
14. So:
$$w e^{w} = \pm \frac{\ln 7}{2}$$
15. By definition of Lambert W function, $w = W_k\left( \pm \frac{\ln 7}{2} \right)$ where $k$ denotes the branch.
16. Recall $w = \frac{y}{2} = \frac{-x}{2}$, so:
$$x = -2 W_k\left( \pm \frac{\ln 7}{2} \right)$$
17. Finally, recall $n = \frac{x}{\ln 7}$, hence:
$$n = \frac{-2}{\ln 7} W_k\left( \pm \frac{\ln 7}{2} \right)$$
18. Therefore, the solutions for $n$ are:
$$n = \frac{-2}{\ln 7} W_k\left( \frac{\ln 7}{2} \right) \quad \text{and} \quad n = \frac{-2}{\ln 7} W_k\left( -\frac{\ln 7}{2} \right)$$
where $W_k$ is the Lambert W function on the appropriate branch(s).
These values give the solutions of the original equation $n^2 = 7^n$ using the Lambert W function.