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

Max Alekseyev maxale at gmail.com
Fri Dec 28 21:11:48 CET 2007


On Dec 28, 2007 12:01 PM, Rainer Rosenthal <r.rosenthal at web.de> wrote:

> Here is another error in the references:
>
> 1813 Karl Friedrich Gauss, Werke, Vol. 3, pp. 134-138 ...
>     ^^^
>      C
>
> The name is Carl Friedrich Gauss. It would be nice if you could add this
> correction too.

Karl and Carl seem to be just different spellings of the same name
(supposedly in different languages/countries).
Take a look at http://www.nordicnames.de/pojk_k/Karl.html

Anyway, there no harm is spelling "Karl Friedrich Gauss" in wikipedia
as the corresponding link simply redirects to "Carl Friedrich Gauss"
article.

> ( I didn't change a wikipedia entry so far and I'm not sure how to.)

That's simple. Just click "edit this page" at the top and follow your
intuition ;)

Regards,
Max




MUCH older.  Search on [continued fraction history] and according to 
http://archives.math.utk.edu/articles/atuyl/confrac/history.html

"The first president of the Royal Society, Lord Brouncker (1620-1684) 
transformed" Wallis's product for pi (published in 1655) into this 
continued fraction.

(But Ramanujan did come up with some cool CFs--check 'em out)


Yes it is.  Morover let me recommend "continued representations" as a 
rich vein of interesting sequences ready for strip mining by 
interested seqfans using today's power tools (following Gosper et al).

Recall how you can extract the simple continued fraction from some 
quantity X: you remove the integer part [X] and output it, leaving 
the "residue" X-[X], that you reciprocate to get a new X, with which 
you then repeat the process...

If we view the source X as a kind of generator, then numbers can be 
implemented as sequences in a modern, computer-friendly, "stream oriented" way.

The simple continued fraction stream algorithm takes any generator 
that supports [], - and 1/.

By varying these operations you can get sequences for different 
representations:

Replace 1/X with n^2/X to get the "spectarecular" representation.

Replace 1/X with 10*X to get the (boo<;-) decimal representation.

Replace 1/X with 2*X to get the (yay<;-) binary representation.

Replace 1/X with 1/X^2 to get the barely-explored "continued surds", 
a0 + sqrt(a1 + sqrt(a2 + ...
(periodic continued surds are roots of cubics, making this the 
natural Origami representation<;-)

Or you could try Fibonacci[n]/X, 2^X, X/(1-X), etc.

When X is implemented as a typical finite flonum the spigot always 
runs dry, but this doesn't happen with streams, so once you have 
contfrac() or the like you can base other things on it.

Representing quantities as generators enables all sorts of 
interesting sequence transformations.  Maybe someone on this list who 
hacks PARI/GP or MMa or Haskell or something...

It'd be *really* fascinating if, say, an exotic representation of 
gamma or zeta(3) turned out to get a "hit" with something already in the OEIS.

(Advertisement: and see 
http://www.research.att.com/~njas/doc/lebrun.pdf about "continued 
transformed into a "continued subscript" comprised of only the 
base-independent symbols 11 and 1.1)




Max's point about the greedy algorithm is well-taken.

But while non-uniqueness is viewed as a bug traditionally, for 
generating more interesting new OEIS sequences it's a feature!






More information about the SeqFan mailing list