NAME
Math::NumSeq::MathImageSqrtContinued -- continued fraction expansion of a square root
SYNOPSIS
use Math::NumSeq::MathImageSqrtContinued;
my $seq = Math::NumSeq::MathImageSqrtContinued->new (sqrt => 2);
my ($i, $value) = $seq->next;
DESCRIPTION
This is terms in the continued fraction expansion of a square root. It approaches the root by
1
sqrt(s) = a[1] + -----------
a[2] + 1
-----------
a[3] + 1
----------
a[4] + ...
The first term a[1] is the integer part of the root, leaving a remainder 0 < r < 1 which is expressed as r=1/R with R > 1. Then a[2] is the integer part of that R, and so on recursively.
Values a[2] onwards always repeat in a fixed sequence. For example sqrt(14) is a[1]=3 and then 1,2,1,6 repeating. For some a single value repeats, for example sqrt(2) is a[1]=1 then 2 repeating.
FUNCTIONS
See "FUNCTIONS" in Math::NumSeq for the behaviour common to all path classes.
$seq = Math::NumSeq::MathImageSqrtContinued->new (sqrt => $s)
-
Create and return a new sequence object giving the Continued expansion terms of
sqrt($s)
.
SEE ALSO
Math::NumSeq, Math::NumSeq::SqrtEngel, Math::NumSeq::SqrtDigits