quadratic-irrational
Version 0.1.0 revision 0 uploaded by Bodigrim.
Package meta
- Synopsis
- An implementation of quadratic irrationals
- Description
A library for exact computation with quadratic irrationals with support for exact conversion from and to (potentially periodic) simple continued fractions.
A quadratic irrational is a number that can be expressed in the form
(a + b √c) / d
where
a
,b
andd
are integers andc
is a square-free natural number.Some examples of such numbers are
7/2
,√2
,(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 expressed in the form
a + 1/(b + 1/(c + 1/(d + 1/(e + …))))
or alternatively written as
[a; b, c, d, e, …]
where
a
is an integer andb
,c
,d
,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, …]
- Author
- Johan Kiviniemi <devel@johan.kiviniemi.name>
- Bug reports
- https://github.com/ion1/quadratic-irrational/issues
- Category
- Math, Algorithms, Data
- Copyright
- Copyright © 2014 Johan Kiviniemi
- Homepage
- https://github.com/ion1/quadratic-irrational
- Maintainer
- Andrew Lelechenko andrew dot lelechenko at gmail dot com
- Package URL
- n/a
- Stability
- provisional