On Thu, Apr 24, 2008 at 7:35 AM, bill.p <[EMAIL PROTECTED]> wrote:
>
>  I needed to derive some continued fractions and a quick search of the
>  index suggests that the Pari-GP function 'contfrac' might be what I
>  needed.
>  A simple test in the notebook:
>
>       gp('contfrac(sqrt(6))')
>
>  produced
>
>                 [2, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4,
>  2, 4, 2, 4, 2,
>                  4, 2, 4, 2, 4, 2]
>
>  which is not exactly what I expected. I'd expect either:
>
>                 [2;2,4]
>  or
>                 [2,2,4,2,4,2,4,2,4,....]
>
>  the latter implying that the expansion continues. Does the result
>  given mean that
>  Pari is using a limited precision evaluation of sqrt(6)?

Yes.

> I'd prefer
>  the first of my expected
>  results, giving a simple infinite continued fraction.

There is no such functionality in pari or as far as I know in Sage.

By the way, Sage also has a continued_fraction command.

sage: a = continued_fraction(sqrt(6),200); a
[2, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4,
2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2,
4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4]
[2, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 2, 1]

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to