factory-0.0.0.2: Rational arithmetic in an irrational world.

Factory.Data.Monomial

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION

Synopsis

# Types

## Type-synonyms

type Monomial coefficient exponent = (coefficient, exponent)Source

• The type of an arbitrary monomial.
• CAVEAT: though a monomial has an integral power, this contraint is only imposed at the function-level.

# Functions

double :: Num c => Monomial c e -> Monomial c eSource

Double the specified Monomial.

Arguments

 :: Integral c => Monomial c e -> c Modulus. -> Monomial c e

Reduce the coefficient using modular arithmetic.

negateCoefficient :: Num c => Monomial c e -> Monomial c eSource

Negate the coefficient.

realCoefficientToFrac :: (Real r, Fractional f) => Monomial r e -> Monomial f eSource

Convert the type of the coefficient.

Arguments

 :: Num c => Monomial c e -> c The magnitude of the shift. -> Monomial c e

Shift the coefficient, by the specified amount.

Arguments

 :: Num e => Monomial c e -> e The magnitude of the shift. -> Monomial c e

Shift the exponent, by the specified amount.

square :: (Num c, Num e) => Monomial c e -> Monomial c eSource

Square the specified Monomial.

## Accessors

getExponent :: Monomial c e -> eSource

Accessor.

getCoefficient :: Monomial c e -> cSource

Accessor.

## Operators

(<=>) :: Ord e => Monomial c e -> Monomial c e -> OrderingSource

Compares the exponents of the specified Monomials.

Arguments

 :: (Fractional c, Num e) => Monomial c e Numerator. -> Monomial c e Denominator. -> Monomial c e

Divide the two specified Monomials.

(<*>) :: (Num c, Num e) => Monomial c e -> Monomial c e -> Monomial c eSource

Multiply the two specified Monomials.

(=~) :: Eq e => Monomial c e -> Monomial c e -> BoolSource

True if the exponents are equal.

## Predicates

isMonomial :: Integral e => Monomial c e -> BoolSource

• True if the exponent is both integral and non-negative.
• CAVEAT: one can't even call this function unless the exponent is integral.