An implementation of quadratic irrationals https://github.com/ion1/quadratic-irrational
|Latest on Hackage:||0.0.5|
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
A quadratic irrational is a number that can be expressed in the form
(a + b √c) / d
d are integers and
c is a square-free natural number.
Some examples of such numbers are
(1 + √5)/2(the golden ratio),
solutions to quadratic equations with rational constants – the quadratic formula has a familiar shape.
A simple continued fraction is a number in the form
a + 1/(b + 1/(c + 1/(d + 1/(e + …))))
or alternatively written as
[a; b, c, d, e, …]
a is an integer and
e, … are positive integers.
Every finite SCF represents a rational number and every infinite, periodic SCF represents a quadratic irrational.
3.5 = [3; 2] (1+√5)/2 = [1; 1, 1, 1, …] √2 = [1; 2, 2, 2, …]
- Make the description more precise.
- Add continuedFractionApproximate for rational partial evaluations of continued fractions.
Add a more verbose description of the library.
- Add doctests.
- Fix qiModify potentially constructing
qi 1 0 5 1instead of the equivalent but simpler
qi 1 0 0 1.
- Add lenses.
- Initial release.