Safe Haskell | None |
---|---|

Language | Haskell2010 |

Algebraic Real Numbers for exact computation

Since 0.4.0.0

## Synopsis

- data Algebraic
- algebraic :: Unipol Rational -> Interval Rational -> Maybe Algebraic
- nthRoot :: Int -> Algebraic -> Maybe Algebraic
- nthRoot' :: Int -> Algebraic -> Algebraic
- improve :: Algebraic -> Algebraic
- approximate :: Rational -> Algebraic -> Rational
- approxFractional :: Fractional r => Rational -> Algebraic -> r
- realRoots :: Unipol Rational -> [Algebraic]
- complexRoots :: Unipol Rational -> [Complex Algebraic]
- data Interval r = Interval {}
- representative :: (Additive r, Division r, Num r) => Interval r -> r
- includes :: Ord a => Interval a -> Interval a -> Bool
- intersect :: (Monoidal a, Ord a) => Interval a -> Interval a -> Interval a
- strum :: Unipol Rational -> [Unipol Rational]
- presultant :: (Euclidean k, CoeffRing k) => Unipol k -> Unipol k -> k
- factors :: Unipol Rational -> [Unipol Rational]
- realPartPoly :: Unipol Rational -> Unipol Rational
- imagPartPoly :: Unipol Rational -> Unipol Rational
- sqFreePart :: (Eq r, Euclidean r, Division r) => Unipol r -> Unipol r

# Documentation

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

## Instances

# Operations

improve :: Algebraic -> Algebraic Source #

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

r

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

returns rational number `approximate`

eps r`r'`

close to `r`

,
with `abs (r - r') < eps`

.

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

Same as

, but returns `approximate`

value instead.`Fractional`

# Equation solver

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

finds all real roots of the rational polynomial `realRoots`

f`f`

.

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

finds all complex roots of the rational polynomial `realRoots`

f`f`

.

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

# Interval arithmetic

## Instances

Eq r => Eq (Interval r) Source # | |

Ord r => Ord (Interval r) Source # | |

Show r => Show (Interval r) Source # | |

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

Group r => Additive (Interval r) Source # | |

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.