halg-algebraic-0.6.0.0: Algebraic reals, part of halg computational algebra suite.
Safe HaskellNone
LanguageHaskell2010

Algebra.Field.AlgebraicReal

Description

Algebraic Real Numbers for exact computation

Since 0.4.0.0

Synopsis

Documentation

data Algebraic Source #

Algebraic real numbers, which can be expressed as a root of a rational polynomial.

Instances

Instances details
Eq Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Fractional Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Num Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Ord Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Show Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

ZeroProductSemiring Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

UnitNormalForm Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Ring Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Rig Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

DecidableZero Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Methods

isZero :: Algebraic -> Bool #

DecidableUnits Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

DecidableAssociates Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Unital Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Methods

one :: Algebraic #

pow :: Algebraic -> Natural -> Algebraic #

productWith :: Foldable f => (a -> Algebraic) -> f a -> Algebraic #

TriviallyInvolutive Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

InvolutiveMultiplication Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Division Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Commutative Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Semiring Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Multiplicative Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Methods

(*) :: Algebraic -> Algebraic -> Algebraic #

pow1p :: Algebraic -> Natural -> Algebraic #

productWith1 :: Foldable1 f => (a -> Algebraic) -> f a -> Algebraic #

Monoidal Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Methods

zero :: Algebraic #

sinnum :: Natural -> Algebraic -> Algebraic #

sumWith :: Foldable f => (a -> Algebraic) -> f a -> Algebraic #

Group Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Additive Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Methods

(+) :: Algebraic -> Algebraic -> Algebraic #

sinnum1p :: Natural -> Algebraic -> Algebraic #

sumWith1 :: Foldable1 f => (a -> Algebraic) -> f a -> Algebraic #

Abelian Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

RightModule Integer Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Methods

(*.) :: Algebraic -> Integer -> Algebraic #

RightModule Natural Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Methods

(*.) :: Algebraic -> Natural -> Algebraic #

LeftModule Integer Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Methods

(.*) :: Integer -> Algebraic -> Algebraic #

LeftModule Natural Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Methods

(.*) :: Natural -> Algebraic -> Algebraic #

RightModule (Fraction Integer) Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

RightModule (Scalar (Fraction Integer)) Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

LeftModule (Fraction Integer) Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

LeftModule (Scalar (Fraction Integer)) Algebraic Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

algebraic :: Unipol Rational -> Interval Rational -> Maybe Algebraic Source #

Smart constructor. algebraic f i represents the unique root of rational polynomial f in the interval i. If no root is found, or more than one root belongs to the given interval, returns Nothing.

Operations

nthRoot :: Int -> Algebraic -> Maybe Algebraic Source #

nthRoot n r tries to computes n-th root of the given algebraic real r. It returns Nothing if it's undefined.

See also nthRoot'.

nthRoot' :: Int -> Algebraic -> Algebraic Source #

Unsafe version of nthRoot.

improve :: Algebraic -> Algebraic Source #

improve r returns the same algebraic number, but with more tighter bounds.

approximate :: Rational -> Algebraic -> Rational Source #

approximate eps r returns rational number r' close to r, with abs (r - r') < eps.

approxFractional :: Fractional r => Rational -> Algebraic -> r Source #

Same as approximate, but returns Fractional value instead.

Equation solver

realRoots :: Unipol Rational -> [Algebraic] Source #

realRoots f finds all real roots of the rational polynomial f.

complexRoots :: Unipol Rational -> [Complex Algebraic] Source #

realRoots f finds all complex roots of the rational polynomial f.

CAUTION: This function currently comes with really naive implementation. Easy to explode.

Interval arithmetic

data Interval r Source #

Constructors

Interval 

Fields

Instances

Instances details
Eq r => Eq (Interval r) Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Methods

(==) :: Interval r -> Interval r -> Bool #

(/=) :: Interval r -> Interval r -> Bool #

Ord r => Ord (Interval r) Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Methods

compare :: Interval r -> Interval r -> Ordering #

(<) :: Interval r -> Interval r -> Bool #

(<=) :: Interval r -> Interval r -> Bool #

(>) :: Interval r -> Interval r -> Bool #

(>=) :: Interval r -> Interval r -> Bool #

max :: Interval r -> Interval r -> Interval r #

min :: Interval r -> Interval r -> Interval r #

Show r => Show (Interval r) Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Methods

showsPrec :: Int -> Interval r -> ShowS #

show :: Interval r -> String #

showList :: [Interval r] -> ShowS #

(Ord r, Multiplicative r, Monoidal r) => Multiplicative (Interval r) Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Methods

(*) :: Interval r -> Interval r -> Interval r #

pow1p :: Interval r -> Natural -> Interval r #

productWith1 :: Foldable1 f => (a -> Interval r) -> f a -> Interval r #

Group r => Additive (Interval r) Source # 
Instance details

Defined in Algebra.Field.AlgebraicReal

Methods

(+) :: Interval r -> Interval r -> Interval r #

sinnum1p :: Natural -> Interval r -> Interval r #

sumWith1 :: Foldable1 f => (a -> Interval r) -> f a -> Interval r #

representative :: (Additive r, Division r, Num r) => Interval r -> r Source #

Choose representative element of the given interval.

includes :: Ord a => Interval a -> Interval a -> Bool Source #

Test if the former interval includes the latter.

intersect :: (Monoidal a, Ord a) => Interval a -> Interval a -> Interval a Source #

Takes intersection of two intervals.

Internal utility functions

presultant :: (Euclidean k, CoeffRing k) => Unipol k -> Unipol k -> k Source #

Pseudo resultant. should we expose this?