Search This Blog

Thursday, November 10, 2011

A general continuing fraction recursion algorithm for square roots



A very minor result that happens to please me:


The continuing real fraction

J + 1/(J + 1/(J + 1/(J + 1/ ...

= J + [(J^2 + 4)^.5]/2

is a special case of a recursion function yielding that limit. That general function is

Xsub(n+1) = (Xsub(n) + C)^(-1) + C

Setting Xo = 0 and C = J, we see (where sub(-1) is not an initial value but a designation for the constant prior to application of the function):


Convergent ; Our function; Continued fraction

0 ; Xsub(-1) = J; J

1 ; Xsub(1) = (J^-1) + J; J + J^-1

2 ; Xsub(2) = (J + J^-1)^-1 + J; as above


Of course, we needn't set Xo = 0. In fact, the curious thing is that this recursion function arrives at the same limit no matter what real initial value is chosen (other than Xo = -C, which must be excluded).

That is, (lim n-->inf)Xsub(n+1) = (lim n-->inf)Ysub(n+1)

when Xsub(1) = (Xo + C)^-1 + C and Ysub(1) = (Yo + C)^-1 + C. It is the constant C that determines the limit, which is the limit of the continuing fraction

1 + 1/C...

That is, beginning with any real but -C for Xo and any real but -C for Yo, we obtain the limit above because we find that

(lim n-->inf)(Xsub(n) - Ysub(n)) = 0,

where (Xsub(n) - Ysub(n)) alternates sign by n.

A bit of perfunctory algebra, which I omit, establishes these facts.

So, this algorithm yields an infinity of approaches to any square root. That is, Xsub(n) =/= Ysub(n) for finite n.

An example: (lim n-->inf)X(sub n) = (2 + 8^.5)/2 = 1 + 2^.5


For Xo = 1 and C = 2, some recursive (calculator) values are:

3

2.333...

2.428571429

2.411764706

2.414634146

For Xo = 1/2 and C = 2

2.5 2.4 2.416...6...

2.413793103

2.414285714

For Xo = -31 and C = 2

-29.0

1.965517241

2.50877193

2.398601399

2.416909621

For Xo = 31 and C = 2

33.0

2.03...03...

2.492537313

2.401197605

2.416458853

For Xo = 1/31 and C = 2 2.032258065

2.492063492

2.401273885

2.416445623

2.413830955

For Xo = -1/31 and C = 2

1.967741935

2.508196721

2.39869281

2.416893733


Note the pattern of alternately too high--too low.

No comments:

Post a Comment