In a case such as $x^x=27$ we can solve by inspection that $x=3$.
But how can we solve this algorithmically in general, given that $N\in Q$ where $Q\subset\Bbb Z$ and $Q=[1,10^{10}]$ and $x\in\Bbb R$?
In a case such as $x^x=27$ we can solve by inspection that $x=3$.
But how can we solve this algorithmically in general, given that $N\in Q$ where $Q\subset\Bbb Z$ and $Q=[1,10^{10}]$ and $x\in\Bbb R$?
To find $x$, you have to solve the equation
$$x\ln(x) = \ln(N)$$
This equation does not have a closed form solution using only the functions we usually use. However, using Lambert's function, which is the inverse of the function $$x\mapsto x\ln x,$$ you can still express the solution exactly, since $W(\ln N) = W(x\ln x)=x$
Newton's method has the fastest convergence that I know of.
For solving 0 = f(x)
The idea is to
1.) guess a solution $x_0$
2.) put it into the function you want to find the zero solution of (ie: calculate $f(x_0)$ )
3.) calculate the derivative at that point $f'(x_0)$
4.) Use this information to find the equation of a straight line with slope $f'(x_0)$ and passing through $f(x_0)$
5.) find where this line hits zero
6.) use this as your next guess for x
Which ends up being $x_0 - (f(x_0)/f'(x_0))$
Repeat this over and over.
So you end up iterating
$x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}$
in our case $f(x) = x^x -27$
since we want to know when this is zero
or
f(x) = x^x - c
if you prefer
See here for finding the derivative of $x^x$
So the final iteration scheme will be
$x_{n+1} = x_n -[\frac{{x_n}^{x_n} - C}{ln(x_n + 1){x_n}^{x_n}}]$