factory-0.3.2.0: Rational arithmetic in an irrational world.

Safe HaskellSafe
LanguageHaskell2010

Factory.Data.Monomial

Contents

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 e Source #

Double the specified Monomial.

mod' Source #

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 e Source #

Negate the coefficient.

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

Convert the type of the coefficient.

shiftCoefficient Source #

Arguments

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

The magnitude of the shift.

-> Monomial c e 

Shift the coefficient, by the specified amount.

shiftExponent Source #

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 e Source #

Square the specified Monomial.

Accessors

getExponent :: Monomial c e -> e Source #

Accessor.

getCoefficient :: Monomial c e -> c Source #

Accessor.

Operators

(<=>) :: Ord e => Monomial c e -> Monomial c e -> Ordering infix 4 Source #

Compares the exponents of the specified Monomials.

(</>) infixl 7 Source #

Arguments

:: (Eq c, 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 e infixl 7 Source #

Multiply the two specified Monomials.

(=~) :: Eq e => Monomial c e -> Monomial c e -> Bool infix 4 Source #

True if the exponents are equal.

Predicates

isMonomial :: Integral e => Monomial c e -> Bool Source #

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