第n个根算法算法

2023-09-11 04:58:25 作者:不浪不人生

什么是计算的 N 的-th一些根本的最快方法?

What is the fastest way to calculate the n-th root of a number?

我知道的尝试和失败的方法,但我需要一个更快的算法。

I'm aware of the Try and Fail method, but I need a faster algorithm.

推荐答案

该规范的方式做,这是牛顿法。如果你不知道,出现x N 是NX N-1 的衍生物。这会派上用场。 1是一个很好的第一个猜测。你想将它应用到功能 - X N

The canonical way to do this is Newton's Method. In case you don't know, the derivative of xn is nxn-1. This will come in handy. 1 is a good first guess. You want to apply it to the function a - xn

IIRC,它的超收敛于形式的功能 - X N ,但无论哪种方式,这是相当快的。此外,IIRC,在它没有收敛也适用于更复杂的功能有,你有兴趣缺乏好的功能特性维基警告。

IIRC, it's superconvergent on functions of the form a - xn, but either way, it's quite fast. Also, IIRC, the warning in the wiki about it failing to converge would apply to more complex functions that have properties that the 'nice' functions you are interested in lack.