factory-0.3.0.0: Rational arithmetic in an irrational world.

Safe HaskellNone
LanguageHaskell2010

Factory.Math.Pi

Contents

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
Defines the classes of Pi-algorithm which have been implemented.

Synopsis

Type-classes

class Algorithmic algorithm where Source #

  • Defines the methods expected of a Pi-algorithm.
  • Most of the implementations naturally return a Rational, but the spigot-algorithms naturally produce a [Int]; though representing Pi as a big integer with the decimal point removed is clearly incorrect.
  • Since representing Pi as either a Rational or promoted to an Integer, is inconvenient, an alternative decimal String-representation is provided.

Minimal complete definition

openR

Methods

openR :: algorithm -> DecimalDigits -> Rational Source #

openI :: algorithm -> DecimalDigits -> Integer Source #

openS :: algorithm -> DecimalDigits -> String Source #

Instances

Algorithmic Algorithm Source # 
Algorithmic Algorithm Source # 
Algorithmic squareRootAlgorithm => Algorithmic (Algorithm squareRootAlgorithm) Source # 

Methods

openR :: Algorithm squareRootAlgorithm -> DecimalDigits -> Rational Source #

openI :: Algorithm squareRootAlgorithm -> DecimalDigits -> Integer Source #

openS :: Algorithm squareRootAlgorithm -> DecimalDigits -> String Source #

(Algorithmic squareRootAlgorithm, Algorithmic factorialAlgorithm) => Algorithmic (Algorithm squareRootAlgorithm factorialAlgorithm) Source # 

Methods

openR :: Algorithm squareRootAlgorithm factorialAlgorithm -> DecimalDigits -> Rational Source #

openI :: Algorithm squareRootAlgorithm factorialAlgorithm -> DecimalDigits -> Integer Source #

openS :: Algorithm squareRootAlgorithm factorialAlgorithm -> DecimalDigits -> String Source #

(Algorithmic squareRootAlgorithm, Algorithmic factorialAlgorithm) => Algorithmic (Algorithm squareRootAlgorithm factorialAlgorithm) Source # 

Methods

openR :: Algorithm squareRootAlgorithm factorialAlgorithm -> DecimalDigits -> Rational Source #

openI :: Algorithm squareRootAlgorithm factorialAlgorithm -> DecimalDigits -> Integer Source #

openS :: Algorithm squareRootAlgorithm factorialAlgorithm -> DecimalDigits -> String Source #

(Algorithmic agm, Algorithmic bbp, Algorithmic borwein, Algorithmic ramanujan, Algorithmic spigot) => Algorithmic (Category agm bbp borwein ramanujan spigot) Source # 

Methods

openR :: Category agm bbp borwein ramanujan spigot -> DecimalDigits -> Rational Source #

openI :: Category agm bbp borwein ramanujan spigot -> DecimalDigits -> Integer Source #

openS :: Category agm bbp borwein ramanujan spigot -> DecimalDigits -> String Source #

Types

Data-types

data Category agm bbp borwein ramanujan spigot Source #

Categorises the various algorithms.

Constructors

AGM agm

Algorithms based on the Arithmetic-geometric Mean.

BBP bbp

https://en.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%93Plouffe_formula.

Borwein borwein

https://en.wikipedia.org/wiki/Borwein%27s_algorithm.

Ramanujan ramanujan

http://www.pi314.net/eng/ramanujan.php.

Spigot spigot

Algorithms from which the digits of Pi slowly drip, one by one.

Instances

(Eq spigot, Eq ramanujan, Eq borwein, Eq bbp, Eq agm) => Eq (Category agm bbp borwein ramanujan spigot) Source # 

Methods

(==) :: Category agm bbp borwein ramanujan spigot -> Category agm bbp borwein ramanujan spigot -> Bool #

(/=) :: Category agm bbp borwein ramanujan spigot -> Category agm bbp borwein ramanujan spigot -> Bool #

(Read spigot, Read ramanujan, Read borwein, Read bbp, Read agm) => Read (Category agm bbp borwein ramanujan spigot) Source # 

Methods

readsPrec :: Int -> ReadS (Category agm bbp borwein ramanujan spigot) #

readList :: ReadS [Category agm bbp borwein ramanujan spigot] #

readPrec :: ReadPrec (Category agm bbp borwein ramanujan spigot) #

readListPrec :: ReadPrec [Category agm bbp borwein ramanujan spigot] #

(Show spigot, Show ramanujan, Show borwein, Show bbp, Show agm) => Show (Category agm bbp borwein ramanujan spigot) Source # 

Methods

showsPrec :: Int -> Category agm bbp borwein ramanujan spigot -> ShowS #

show :: Category agm bbp borwein ramanujan spigot -> String #

showList :: [Category agm bbp borwein ramanujan spigot] -> ShowS #

Default bbp => Default (Category agm bbp borwein ramanujan spigot) Source # 

Methods

def :: Category agm bbp borwein ramanujan spigot #

(Algorithmic agm, Algorithmic bbp, Algorithmic borwein, Algorithmic ramanujan, Algorithmic spigot) => Algorithmic (Category agm bbp borwein ramanujan spigot) Source # 

Methods

openR :: Category agm bbp borwein ramanujan spigot -> DecimalDigits -> Rational Source #

openI :: Category agm bbp borwein ramanujan spigot -> DecimalDigits -> Integer Source #

openS :: Category agm bbp borwein ramanujan spigot -> DecimalDigits -> String Source #