yap-examples-0.1: examples of the algebraic classes in the yap package
Copyright(c) Ross Paterson 2011
LicenseBSD-style (see the file LICENSE)
MaintainerR.Paterson@city.ac.uk
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.YAP.Quadratic.Dirichlet

Description

An example instance of the algebraic classes: Dirichlet integers (a real quadratic integer ring).

Synopsis

Documentation

data Dirichlet a Source #

D a b represents \(a + b\phi\), where \(\phi = {1 + \sqrt 5 \over 2}\) (the golden ratio). When \(a\) and \(b\) are integers, this is equivalent to the ring \({\Bbb Z}(\phi)\) of algebraic integers of the real quadratic field \({\Bbb Q}(\sqrt 5)\).

Constructors

D a a 

Instances

Instances details
Functor Dirichlet Source # 
Instance details

Defined in Data.YAP.Quadratic.Dirichlet

Methods

fmap :: (a -> b) -> Dirichlet a -> Dirichlet b #

(<$) :: a -> Dirichlet b -> Dirichlet a #

Show a => Show (Dirichlet a) Source # 
Instance details

Defined in Data.YAP.Quadratic.Dirichlet

Eq a => Eq (Dirichlet a) Source # 
Instance details

Defined in Data.YAP.Quadratic.Dirichlet

Methods

(==) :: Dirichlet a -> Dirichlet a -> Bool #

(/=) :: Dirichlet a -> Dirichlet a -> Bool #

AbelianGroup a => AbelianGroup (Dirichlet a) Source # 
Instance details

Defined in Data.YAP.Quadratic.Dirichlet

Methods

(-) :: Dirichlet a -> Dirichlet a -> Dirichlet a #

negate :: Dirichlet a -> Dirichlet a #

gtimes :: (AbelianGroup b, ToInteger b) => b -> Dirichlet a -> Dirichlet a #

AdditiveMonoid a => AdditiveMonoid (Dirichlet a) Source # 
Instance details

Defined in Data.YAP.Quadratic.Dirichlet

Methods

(+) :: Dirichlet a -> Dirichlet a -> Dirichlet a #

zero :: Dirichlet a #

atimes :: ToInteger b => b -> Dirichlet a -> Dirichlet a #

Field a => DivisionRing (Dirichlet a) Source # 
Instance details

Defined in Data.YAP.Quadratic.Dirichlet

Field a => DivisionSemiring (Dirichlet a) Source # 
Instance details

Defined in Data.YAP.Quadratic.Dirichlet

Methods

recip :: Dirichlet a -> Dirichlet a #

Integral a => Euclidean (Dirichlet a) Source #

If y is non-zero, mod x y has a smaller absolute norm than y.

Instance details

Defined in Data.YAP.Quadratic.Dirichlet

Field a => Field (Dirichlet a) Source # 
Instance details

Defined in Data.YAP.Quadratic.Dirichlet

FromRational a => FromRational (Dirichlet a) Source # 
Instance details

Defined in Data.YAP.Quadratic.Dirichlet

Ring a => Ring (Dirichlet a) Source # 
Instance details

Defined in Data.YAP.Quadratic.Dirichlet

Field a => Semifield (Dirichlet a) Source # 
Instance details

Defined in Data.YAP.Quadratic.Dirichlet

Methods

(/) :: Dirichlet a -> Dirichlet a -> Dirichlet a #

Semiring a => Semiring (Dirichlet a) Source # 
Instance details

Defined in Data.YAP.Quadratic.Dirichlet

(Ring a, ToInteger a) => StandardAssociate (Dirichlet a) Source #

Units have the form \( \pm\phi^n \) for integer \(n\) (possibly negative). If x is non-zero, stdAssociate x has the form D a b where 0 <= b < a.

Instance details

Defined in Data.YAP.Quadratic.Dirichlet

Construction

inject :: AdditiveMonoid a => a -> Dirichlet a Source #

Inject the rational part.

phi :: Semiring a => Dirichlet a Source #

The golden ratio \(\phi = {1 + \sqrt 5 \over 2}\), which is the fundamental unit of \({\Bbb Z}(\phi)\).

phiPower :: (Ring a, Integral n) => n -> Dirichlet a Source #

The \(n\)th power of \(\phi\), satisfying \( \phi^n = F_{n-1} + F_n \phi \), where \(F_n\) is the \(n\)th Fibonacci number.

sqrt5 :: Ring a => Dirichlet a Source #

The Dirichlet integer representing \( \sqrt 5 = 2\phi - 1 \).

Queries

stdUnitParts :: (Ord a, Ring a) => Dirichlet a -> (Bool, Int) Source #

stdUnit x decomposed as a sign (True means negative) and a power of \(\phi\).

toReal :: Floating a => Dirichlet a -> a Source #

The corresponding real number

norm :: Ring a => Dirichlet a -> a Source #

The norm of a Dirichlet integer, obtained by multiplying it by its conjugate. It satisfies

Conjugate

conjugate :: AbelianGroup a => Dirichlet a -> Dirichlet a Source #

Conjugate of a Dirichlet integer, satisfying