HaskellForMaths-0.4.9: Combinatorics, group theory, commutative algebra, non-commutative algebra

Safe Haskell | None
Language | Haskell98

Math.NumberTheory.QuadraticField

Description

A module for arithmetic in quadratic number fields. A quadratic number field is a field of the form Q(sqrt d), where d is a square-free integer. For example, we can perform the following calculation in Q(sqrt 2):

    (1 + sqrt 2) / (2 + sqrt 2)

It is also possible to mix different square roots in the same calculation. For example:

    (1 + sqrt 2) * (1 + sqrt 3)

Square roots of negative numbers are also permitted. For example:

    i * sqrt(-3)

Synopsis

- data QNFBasis
  - = One
  - | Sqrt Integer
- type QNF = Vect Q QNFBasis
- sqrt :: Integer -> QNF
- sqrt2 :: QNF
- sqrt3 :: QNF
- sqrt5 :: QNF
- sqrt6 :: QNF
- sqrt7 :: QNF
- i :: QNF
- newtype XVar = X Int

# Documentation

data QNFBasis Source #

A basis for quadratic number fields Q(sqrt d), where d is a square-free integer.

Constructors

One |
Sqrt Integer |

#### Instances

Instances details

Eq QNFBasis Source # |
Instance details Defined in Math.NumberTheory.QuadraticField Methods (==) :: QNFBasis -> QNFBasis -> Bool (/=) :: QNFBasis -> QNFBasis -> Bool
Fractional QNF Source # |
Instance details Defined in Math.NumberTheory.QuadraticField Methods (/) :: QNF -> QNF -> QNF recip :: QNF -> QNF fromRational :: Rational -> QNF
Ord QNFBasis Source # |
Instance details Defined in Math.NumberTheory.QuadraticField Methods compare :: QNFBasis -> QNFBasis -> Ordering (<) :: QNFBasis -> QNFBasis -> Bool (<=) :: QNFBasis -> QNFBasis -> Bool (>) :: QNFBasis -> QNFBasis -> Bool (>=) :: QNFBasis -> QNFBasis -> Bool max :: QNFBasis -> QNFBasis -> QNFBasis min :: QNFBasis -> QNFBasis -> QNFBasis
Show QNFBasis Source # |
Instance details Defined in Math.NumberTheory.QuadraticField Methods showsPrec :: Int -> QNFBasis -> ShowS show :: QNFBasis -> String showList :: [QNFBasis] -> ShowS
(Eq k, Num k) => Algebra k QNFBasis Source # |
Instance details Defined in Math.NumberTheory.QuadraticField Methods unit :: k -> Vect k QNFBasis Source # mult :: Vect k (Tensor QNFBasis QNFBasis) -> Vect k QNFBasis Source #

type QNF = Vect Q QNFBasis Source #

The type for elements of quadratic number fields

sqrt :: Integer -> QNF Source #

Although this has the same name as the Prelude.sqrt function, it should be thought of as more like a constructor for creating elements of quadratic fields.

Note that for d positive, sqrt d means the positive square root, and sqrt (-d) should be interpreted as the square root with positive imaginary part, that is i * sqrt d. This has the consequence that for example, sqrt (-2) * sqrt (-3) = - sqrt 6.

sqrt2 :: QNF Source #

sqrt3 :: QNF Source #

sqrt5 :: QNF Source #

sqrt6 :: QNF Source #

sqrt7 :: QNF Source #

i :: QNF Source #

newtype XVar Source #

Constructors

X Int |

#### Instances

Instances details

Eq XVar Source # |
Instance details Defined in Math.NumberTheory.QuadraticField Methods (==) :: XVar -> XVar -> Bool (/=) :: XVar -> XVar -> Bool
Ord XVar Source # |
Instance details Defined in Math.NumberTheory.QuadraticField Methods compare :: XVar -> XVar -> Ordering (<) :: XVar -> XVar -> Bool (<=) :: XVar -> XVar -> Bool (>) :: XVar -> XVar -> Bool (>=) :: XVar -> XVar -> Bool max :: XVar -> XVar -> XVar min :: XVar -> XVar -> XVar
Show XVar Source # |
Instance details Defined in Math.NumberTheory.QuadraticField Methods showsPrec :: Int -> XVar -> ShowS show :: XVar -> String showList :: [XVar] -> ShowS