quadratic-irrational: An implementation of quadratic irrationals

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

Warnings:

• 'ghc-options: -O2' is rarely needed. Check that it is giving a real benefit and not just imposing longer compile times on your users.

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]

Properties

Versions 0.0.1, 0.0.2, 0.0.3, 0.0.3, 0.0.4, 0.0.5, 0.0.6 ChangeLog.md arithmoi (==0.4.*), base (>=4.6 && <4.8), containers (==0.5.*), mtl (==2.1.*), transformers (==0.3.*) [details] MIT Copyright © 2014 Johan Kiviniemi Johan Kiviniemi Johan Kiviniemi Math, Algorithms, Data https://github.com/ion1/quadratic-irrational https://github.com/ion1/quadratic-irrational/issues head: git clone https://github.com/ion1/quadratic-irrational.git Tue Mar 25 23:59:15 UTC 2014 by ion

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for quadratic-irrational-0.0.3

[back to package description]

`quadratic-irrational`

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, …]
``````