Given a function f, we want to find its roots. Namely, the values of x such that:
We choose an arbitrary initial value
and from it we calculate a new
value
which is the point where the tangent of f, at
, passes
through the
axis:
We now repeat the process recursively:
In an interval where the function is continuous and increasing, that sequence will approach the nearest root on the left of the starting value. If the function is continuous and decreasing, the sequence will approach the nearest root on the right.
Compute the square root of 5, using Newton's method.
The number we want to compute is:
let us rewrite that equation as
Thus, our problem is equivalent to finding the roots of the function
The recurrence relation becomes:
Using Maxima (http://maxima.sourceforge.net), and an initial value of 1, we can find the first terms in the sequence:
x : 1; for i thru 10 do (x: float((x + 5/x)/2), print(x));
The sequence seems to converge rather fast:
3.0 2.333333333333334 2.238095238095238 2.236068895643363 2.236067977499978 2.23606797749979 2.23606797749979 2.23606797749979 2.23606797749979 2.23606797749979