0
$\begingroup$

$x^x = 2^{1000}$

I have tried newton-raphson but equation gets more complex as we progress. Is there any more simpler method to solve this?

$\endgroup$

3 Answers 3

4
$\begingroup$

The Lambert W function solves all your problems.

You can rewrite the problem as :

$x^x =2^{1000}$

$x\ln(x) =1000\cdot\ln(2)$

$e^{\ln(x)}\ln(x) = 1000\cdot \ln(2)$

$\ln(x) = W\bigg(1000\cdot \ln(2)\bigg)$

$x= e^{W\big(1000\cdot \ln(2)\big)}$

This can equivalently be written as :

$x= \dfrac{1000\cdot\ln(2)}{W(1000\cdot\ln(2))}$

$\endgroup$
0
$\begingroup$

Rewrite the question as $$x\log(x) = 1000 \log(2)$$

and your Newton-Raphson recurrence becomes $$x_{n+1} = x_n - \dfrac{x_n\log(x_n) - 1000 \log(2)}{\log(x_n)+\log(e)}$$

using whatever logarithm base is most convenient for you ($e$, $2$ or $10$ are obvious possibilities)

Clearly $x_0=1$ is too low and $x_0=1000$ is too high but using either as a starting point will get you close to the answer in a handful of steps

$\endgroup$
2
  • $\begingroup$ The best possible answer i get is $140.2216669915292$, and error in this answer is $$140.2216669915292^{140.2216669915292} - 2^{1000} = 1.90464*10^{287}$$ is there any way to reduce this error? $\endgroup$
    – user573082
    Jun 29, 2018 at 18:35
  • $\begingroup$ This is in fact close as $2^{1000} \approx 10^{301}$. You can try more digits. An online calculator suggests using 140.22166699152919700913934001173270084067982524793545930222190049630706334539560077498783079493975672770208341808697927320562923322403510168142075028679965453944175988093471839741064068784960761535753924946416754955713154016327592929615909287626145434741193994100543034551951446506827645488741083666973723 will give a difference less than $0.002$ $\endgroup$
    – Henry
    Jun 29, 2018 at 21:47
0
$\begingroup$

From a programming point of view, you just want to find the one number that, when raised to itself, is $2^{1000}$ or at least in the neighborhood. So forget the Newton-Raphson method, just take a simple while loop and iterate the number $x$ until $2^{1000}-x^x\leq 0$.

x = 128;
dx = 0.1;
while 2^1000 - x^x > 0
    x = x + dx;
end

$x=128$ is chosen because it is clear that $128=2^7$ so $(2^7)^{2^7}=2^{7\cdot128}$ and $7\cdot128<1000$

More precision on $x$ is acquired by making $dx$ smaller.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .