An iterative method that iterates is said to converge with order with , if there exists a positive constant such that
Newton's method, when started with a good initial value, has order , and for certain problems, even . Newton's method when applied to the problem gives the following iteration scheme:
Which converges cubically; that is, q = 3.
This implies that the number of correct digits triples from iteration to iteration. To demonstrate cubic convergence and to numerically determine the constant is hardly possible with the standard 16-digit float data type.
The following code uses SymPy together with high-precision evaluation instead and takes the study on cubic convergence to the extreme:
import sympy as sym
x = sym.Rational(1,2)
xns=[x]
for i in range(1,9):
x = (x - sym.atan(x)*(1+x**2)).evalf(3000)
xns.append(x)
The result...