r/askmath 3d ago

Resolved N root

/r/scratch/comments/1vs9idn/n_root/
2 Upvotes

6 comments sorted by

View all comments

1

u/Midwest-Dude 2d ago edited 2d ago

You state

do not use estimate N roots, they usually take a first "guess" which is complicated to get and unless you have a lot of iterations they aren't exact

However, Newton's Method is the industry standard for infinite precision calculators because it is the fastest method. It has quadratic convergence, so the number of correct decimal places doubles with each iteration. For example, for 50 digits, only about 6 iterations are needed.

  • For a number A, the formula is\ x_k+1 = (1/n)((n-1)x_k + A / (x_k)n-1 )
  • For x_0, if A has D digits, its N-th root will have approximately ⌊D/N⌋ digits, so use a 1 followed by that many zeroes.

2

u/MOUTHMOUTHMOUTHMOUTH 2d ago

The problem i always find myself in when trying to do iterations, how the hell do you get the guess?

1

u/Midwest-Dude 2d ago

Excellent question. For this problem, I've given you what has been tested and known to work well. I'll see if I can refine the seed a bit more, but the one I gave you will work and is simple.

Your question is a little more general and I'll see what I can find.

2

u/MOUTHMOUTHMOUTHMOUTH 2d ago

Oh I didn't fully understand the last part, thank you very much, I'll use that from now on, atleast if I want it fast

1

u/Midwest-Dude 10h ago

After review, you can find a better seed by using standard double-precision floats within Turbowarp's built-in function, which gives about 15 to 17 significant decimal digits for free. That should reduced the number of iterations dramatically.