1Math::NumSeq::SqrtContiUnsueerd(C3o)ntributed Perl DocumMeanttha:t:iNounmSeq::SqrtContinued(3)
2
3
4

NAME

6       Math::NumSeq::SqrtContinued -- continued fraction expansion of a square
7       root
8

SYNOPSIS

10        use Math::NumSeq::SqrtContinued;
11        my $seq = Math::NumSeq::SqrtContinued->new (sqrt => 2);
12        my ($i, $value) = $seq->next;
13

DESCRIPTION

15       This is terms in the continued fraction expansion of a square root.  It
16       approaches the root by
17
18                             1
19          sqrt(S) = a[0] + -----------
20                           a[1] +   1
21                                  -----------
22                                  a[2] +   1
23                                         ----------
24                                         a[3] + ...
25
26       The first term a[0] is the integer part of the root, leaving a
27       remainder 0 < r < 1 which is expressed as r=1/R with R > 1
28
29                            1
30          sqrt(S) = a[0] + ---
31                            R
32
33       Then a[1] is the integer part of that R, and so on recursively.
34
35       Values a[1] onwards are always a fixed-period repeating sequence.  For
36       example sqrt(14) is a[0]=3 and then 1,2,1,6 repeating.  For some roots
37       a single value repeats.  For example sqrt(2) is a[0]=1 then 2
38       repeating.  See SqrtContinuedPeriod for just the length of the period.
39

FUNCTIONS

41       See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
42       classes.
43
44       "$seq = Math::NumSeq::SqrtContinued->new (sqrt => $s)"
45           Create and return a new sequence object giving the Continued
46           expansion terms of sqrt($s).
47
48       "$value = $seq->ith ($i)"
49           Return the i'th term in the continued fraction, starting from i=0
50           for the integer part of the sqrt.
51
52       "$i = $seq->i_start ()"
53           Return 0, the first term in the sequence being i=0.
54

SEE ALSO

56       Math::NumSeq, Math::NumSeq::SqrtContinuedPeriod,
57       Math::NumSeq::SqrtDigits, Math::NumSeq::SqrtEngel
58
59       Math::ContinuedFraction
60

HOME PAGE

62       <http://user42.tuxfamily.org/math-numseq/index.html>
63

LICENSE

65       Copyright 2011, 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde
66
67       Math-NumSeq is free software; you can redistribute it and/or modify it
68       under the terms of the GNU General Public License as published by the
69       Free Software Foundation; either version 3, or (at your option) any
70       later version.
71
72       Math-NumSeq is distributed in the hope that it will be useful, but
73       WITHOUT ANY WARRANTY; without even the implied warranty of
74       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
75       General Public License for more details.
76
77       You should have received a copy of the GNU General Public License along
78       with Math-NumSeq.  If not, see <http://www.gnu.org/licenses/>.
79
80
81
82perl v5.36.0                      2023-01-20    Math::NumSeq::SqrtContinued(3)
Impressum