Hi, on the public bug tracker I got this one:
http://spreadsheets.google.com/ver?key=pCwvGVwSMxTzT6E2xNdo5fA&t=1232807032283000&pt=1232807012283000&diffWidget=true&s=AJVazbXBr2D7KZ6E3qJBWICjRrHj5pKG-Q&pli=1

quote:
"""
A simple call to the function with an irrational number returns a list
for the infinite continued fractions, with the last digit or two
incorrect.

For exapmle:

continued_fraction(sqrt(2))
[1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1]

the last two digits are incorrect

continued_fraction(sqrt(109))
[10, 2, 3, 1, 2, 4, 1, 6, 6, 1, 4, 2, 1, 3, 2, 20, 3]

the last digit (3) is incorrect
"""

Interestingly, the doctests in
http://hg.sagemath.org/sage-main/file/b0aa7ef45b3c/sage/rings/arith.py
/ continued_fraction_list(...)
clearly state that this is correct.

If i read the code correctly, the symbolic expression is evaluated
with limited precision. I think it should stated in the doctests that
it is an approximation (line #2676 ->  "# if x is a
SymbolicExpression, try coercing it to a real number") - or I'm wrong
or is this a bug?


Note: Mathematica does it this way:
dIn[1]:= ContinuedFraction[Sqrt[2], 20]
Out[1]= {1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}


H
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to