# What are the PARI/GP alternatives to contfrac() ?

Alexander Povolotsky apovolot at gmail.com
Fri Dec 28 20:21:59 CET 2007

Dear Max -

>You've got wrong impression.

I don't mind to be corrected but this time I just was quoting what the entry
in the
http://en.wikipedia.org/wiki/Continued_fraction wiki says.
Perhaps you have not looked yourself at it directly
(now I copied ant pasted it below for your viewing pleasure ).

Max -  if you feel that discussed wiki entry incorrect - please do go ahead
and correct it.

Regards,
Alex

PS Could you please show your PARI/GP results in generating last two
variants (as shown /pasted below) using contfrac() with additional argument
?
----------------------------------------------------------------------------------
....

This continued fraction is unpredictable and irregular:
[image: \pi = 3 + \cfrac{1}{7 + \cfrac{1}{15 + \cfrac{1}{1 + \cfrac{1}{292 +
\cfrac{1}{1 + \cfrac{1}{1 + \cfrac{1}{1 + \cfrac{1}{2 +
\cfrac{1}{\ddots}}}}}}}}}]

However, there are perfectly regular generalized continued fractions for π,
such as:
[image: \pi = \cfrac{4}{1 + \cfrac{1}{3 + \cfrac{4}{5 + \cfrac{9}{7 +
\cfrac{16}{9 + \cfrac{25}{11 + \cfrac{36}{13 +
\cfrac{49}{\ddots}}}}}}}}] [image:
\pi=3 + \cfrac{1}{6 + \cfrac{9}{6 + \cfrac{25}{6 + \cfrac{49}{6 +
\cfrac{81}{6 + \cfrac{121}{\ddots\,}}}}}}]

where each of the numerators is an odd
number<http://en.wikipedia.org/wiki/Odd_number>
squared <http://en.wikipedia.org/wiki/Squaring>.

On Dec 28, 2007 12:41 PM, Max Alekseyev <maxale at gmail.com> wrote:

> On Dec 28, 2007 8:01 AM, Alexander Povolotsky <apovolot at gmail.com> wrote:
>
> > http://en.wikipedia.org/wiki/Continued_fraction
> >
> > shows two variants of "regular" continuous (continued)  fraction
> expansion
> > for Pi where numerators in fractions are squares (either all consecutive
> > squares in one variant or consecutive odd squares in another variant).
>
> You've got wrong impression. Regular continued fractions have all
> partial numerators equal 1. All other continued fractions are
> irregular.
>
> > However executing contfrac(Pi) only shows "irregular" continuous
> (continued)
> > fraction expansion for Pi.
>
> That's not true. contfrac(x) returns regular continued fraction of
> given number x.
> For Pi, it is shown on this figure:
>
> You may have been misled by the word "irregular" in its description in
> wikipedia but there this word characterizes not the form of continued
> fraction but the sequence of partial denominators in it. There is not
> obvious rule or formula for them, hence, they appear to be rather
> "irregular".
>
> On the other hand, one of possible irregular continued fractions for Pi
> is:
>
> where the sequence of partial denominators is simply all odd positive
> integers, hence, *this sequence* (not the form of ontinued fractions)
> is somewhat regular.
>
> > Is there a (desirably simple) PARI/GP way to generate desired (as
> mentioned
> > above) "regular" continuous (continued)  fraction expansion for Pi ?
>
> If you want to have a particular sequence of partial numerators,
> simply provide it as a second argument to contfrac().
>
> Regards,
> Max
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.seqfan.eu/pipermail/seqfan/attachments/20071228/4820061e/attachment-0001.htm>