Status: Valid
Owner: ----
Labels: Type-Enhancement Priority-Medium NumberTheory

New issue 3937 by thilina....@gmail.com: Enhancements on continued fractions
http://code.google.com/p/sympy/issues/detail?id=3937

Currently SymPy only provides functionalities to find continued fraction representation of rational fractions.

from sympy.physics.quantum.shor import continued_fraction
continued_fraction(4, 3)
[1,3]

It gives wrong results when a quadratic irrationality is given as an input.

continued_fraction(sqrt(5), 3)
[0,1,2]

But the correct answer should be 0,1,[2,1,12,1,2,2] with the terms inside the bracket repeating forever. I think this is due to the fact that current implementation
assumes input is a rational fraction.

However it's good if we can create a class (or any abstraction) which can find the continued fraction representation of any rational or irrational number and handle all the arithmetic associated with continued fractions. At least we should implement
this for quadratic irrationalities since they are very frequently used.

Lots of references can be found here:
http://www.numbertheory.org/ntw/N4.html#continued_fractions

Set of slides below gives a good introduction:
http://www.numbertheory.org/pdfs/CFquadratic.pdf

Here is an online calculator that can be used to verify the results:
http://www.numbertheory.org/php/surd.html


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy-issues+unsubscr...@googlegroups.com.
To post to this group, send email to sympy-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy-issues.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to