toysolver-0.2.0: Assorted decision procedures for SAT, Max-SAT, PB, MIP, etc

Copyright(c) Masahiro Sakai 2012-2013
LicenseBSD-style
Maintainermasahiro.sakai@gmail.com
Stabilityprovisional
Portabilitynon-portable (Rank2Types)
Safe HaskellNone
LanguageHaskell2010

ToySolver.Data.AlgebraicNumber.Real

Contents

Description

Algebraic reals

Reference:

Synopsis

Algebraic real type

data AReal Source

Algebraic real numbers.

Instances

Eq AReal 
Fractional AReal 
Num AReal 
Ord AReal 
Real AReal 
RealFrac AReal 
Show AReal 
Pretty AReal 
PrettyCoeff AReal 
Degree AReal

Degree of the algebraic number.

If the algebraic number's minimalPolynomial has degree n, then the algebraic number is said to be degree n.

Construction

realRoots :: UPolynomial Rational -> [AReal] Source

Real roots of the polynomial in ascending order.

realRootsEx :: UPolynomial AReal -> [AReal] Source

Real roots of the polynomial in ascending order.

Properties

minimalPolynomial :: AReal -> UPolynomial Rational Source

The polynomial of which the algebraic number is root.

isolatingInterval :: AReal -> Interval Rational Source

Isolating interval that separate the number from other roots of minimalPolynomial of it.

isRational :: AReal -> Bool Source

Whether the algebraic number is a rational.

isAlgebraicInteger :: AReal -> Bool Source

Whether the algebraic number is a root of a polynomial with integer coefficients with leading coefficient 1 (a monic polynomial).

height :: AReal -> Integer Source

Height of the algebraic number.

The height of an algebraic number is the greatest absolute value of the coefficients of the irreducible and primitive polynomial with integral rational coefficients.

rootIndex :: AReal -> Int Source

root index, satisfying

realRoots (minimalPolynomial a) !! rootIndex a == a

Operations

nthRoot :: Integer -> AReal -> AReal Source

The nth root of a

refineIsolatingInterval :: AReal -> AReal Source

Same algebraic real, but represented using finer grained isolatingInterval.

Approximation

approx Source

Arguments

:: AReal

a

-> Rational

epsilon

-> Rational 

Returns approximate rational value such that abs (a - approx a epsilon) <= epsilon.

approxInterval Source

Arguments

:: AReal

a

-> Rational

epsilon

-> Interval Rational 

Returns approximate interval such that width (approxInterval a epsilon) <= epsilon.

Misc

goldenRatio :: AReal Source

Golden ratio