quadratic-irrational: An implementation of quadratic irrationals
An implementation of quadratic irrationals with support for conversion from and to periodic continued fractions.
A quadratic irrational is a number that can be expressed in the form
(a + b √c) / d
where a
, b
and d
are integers and c
is a square-free natural number.
Some examples of such numbers are
7/2
,√2
,(1 + √5)/2
(the golden ratio),solutions to some quadratic equations – the quadratic formula has a familiar shape.
A continued fraction is a number that can be expressed in the form
a + 1/(b + 1/(c + 1/(d + 1/(e + …))))
alternatively expressed using the notation
[a; b, c, d, e, …]
where a
is an integer and b
, c
, d
, e
, … are positive integers.
Every finite continued fraction represents a rational number and every infinite, periodic continued fraction represents a quadratic irrational.
3.5 = [3; 2] (1+√5)/2 = [1; 1, 1, 1, …] √2 = [1; 2, 2, 2, …]
[Skip to Readme]
Modules
[Index]
Downloads
- quadratic-irrational-0.0.3.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
Versions [RSS] | 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.1.0, 0.1.1 |
---|---|
Change log | ChangeLog.md |
Dependencies | arithmoi (>=0.4 && <0.5), base (>=4.6 && <4.8), containers (>=0.5 && <0.6), mtl (>=2.1 && <2.2), transformers (>=0.3 && <0.4) [details] |
Tested with | ghc ==7.6.3 |
License | MIT |
Copyright | Copyright © 2014 Johan Kiviniemi |
Author | Johan Kiviniemi <devel@johan.kiviniemi.name> |
Maintainer | Johan Kiviniemi <devel@johan.kiviniemi.name> |
Category | Math, Algorithms, Data |
Home page | https://github.com/ion1/quadratic-irrational |
Bug tracker | https://github.com/ion1/quadratic-irrational/issues |
Source repo | head: git clone https://github.com/ion1/quadratic-irrational.git |
Uploaded | by ion at 2014-03-25T23:59:45Z |
Distributions | LTSHaskell:0.1.1, NixOS:0.1.1, Stackage:0.1.1 |
Reverse Dependencies | 1 direct, 0 indirect [details] |
Downloads | 5962 total (1 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs uploaded by user [build log] Successful builds reported [all 1 reports] |