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

Max Alekseyev maxale at gmail.com
Fri Dec 28 18:41:23 CET 2007


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:
http://upload.wikimedia.org/math/8/0/5/805cbffdd561d9f567b02f3a7f8380e3.png
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:
http://upload.wikimedia.org/math/a/c/3/ac36499053d43d4ecd46a4624c0a05b2.png
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





More information about the SeqFan mailing list