NAME
Math::NumSeq::SqrtContinued  continued fraction expansion of a square root
SYNOPSIS
use Math::NumSeq::SqrtContinued;
my $seq = Math::NumSeq::SqrtContinued>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[0] + 
a[1] + 1

a[2] + 1

a[3] + ...
The first term a[0] is the integer part of the root, leaving a remainder 0 < r < 1 which is expressed as r=1/R with R > 1
1
sqrt(S) = a[0] + 
R
Then a[1] is the integer part of that R, and so on recursively.
Values a[1] onwards are always a fixedperiod repeating sequence. For example sqrt(14) is a[0]=3 and then 1,2,1,6 repeating. For some roots a single value repeats. For example sqrt(2) is a[0]=1 then 2 repeating. See SqrtContinuedPeriod for just the length of the period.
FUNCTIONS
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::SqrtContinued>new (sqrt => $s)

Create and return a new sequence object giving the Continued expansion terms of
sqrt($s)
. $value = $seq>ith ($i)

Return the i'th term in the continued fraction, starting from i=0 for the integer part of the sqrt.
$i = $seq>i_start ()

Return 0, the first term in the sequence being i=0.
SEE ALSO
Math::NumSeq, Math::NumSeq::SqrtContinuedPeriod, Math::NumSeq::SqrtDigits, Math::NumSeq::SqrtEngel
Math::Pell, Math::ContinuedFraction
HOME PAGE
http://user42.tuxfamily.org/mathnumseq/index.html
LICENSE
Copyright 2011, 2012, 2013 Kevin Ryde
MathNumSeq is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
MathNumSeq is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with MathNumSeq. If not, see <http://www.gnu.org/licenses/>.