I'm writing my own RealNumber class in Python, where I need to get the $ n $-th root of $ M $. Here, $ n, M \in \mathbb{Z}^+. $
I'm trying to follow the Newton-Raphson method for calculation of the $ n $-th root.
Input to my function: M - a positive integer, n - root needs to find of M.
$ f(x) = x^n - M $, $ f'(x) = nx^{n-1} $
Now I need to first calculate the $ x_0 $, so that, $ x_{i+1} = x_i - \frac{x_i^n - M}{nx_i^{n-1}} $.
But, how can I assume the $ x_0 $ for every $ n $ and $ M $ provided?
In a general manner, when you use Newton method for the solution of $f(x)=0$, provided that its second derivative does not change sign, if you want the smoothest path to solution (that is to say no overshoot), select $x_0$ such that $$f(x_0)\times f''(x_0) ~> ~0$$
This is Darboux theorem
For your case, since $f''(x)>0$, start above the solution.
Take the example where $M=123456789$ and $n=5$ with two different starting points
$$\left( \begin{array}{cc} k & x_k \\ 0 & 20.0000 \\ 1 & 170.321 \\ 2 & 136.286 \\ 3 & 109.100 \\ 4 & 87.4547 \\ 5 & 70.3858 \\ 6 & 57.3147 \\ 7 & 48.1399 \\ 8 & 43.1094 \\ 9 & 41.6367 \\ 10 & 41.5250 \\ 11 & 41.5244 \\ 12 & 41.5244 \\ \end{array} \right)$$
$$\left( \begin{array}{cc} k & x_k \\ 0 & 60.0000 \\ 1 & 49.9052 \\ 2 & 43.9049 \\ 3 & 41.7689 \\ 4 & 41.5272 \\ 5 & 41.5244 \\ 6 & 41.5244 \\ \end{array} \right)$$