diophantine-0.2.0.0: A quadratic diophantine equation solving library.

PortabilityGHC
Stabilitystable
Maintainerjoejev@gmail.org
Safe HaskellSafe-Inferred

Math.Diophantine.Internal

Contents

Description

WARNING: The internal workings of solve. These functions use error, and should only be called directly if you know the type of the equation ahead of time. For example, solveLinear will try to resolve a GeneralEquation into a linear one if possible, but if you pass a GeneralEquation of a parabolic form, then it will error.

Synopsis

Data

data Equation Source

A way to setup an equation in the form of:

 ax^2 + bxy + cy^2 + dx + ey + f = 0

Constructors

GeneralEquation Z Z Z Z Z Z

A general quadratic diophantine equation.

LinearEquation Z Z Z

dx + ey + f = 0

SimpleHyperbolicEquation Z Z Z Z

bxy + dx +ey + f = 0

ElipticalEquation Z Z Z Z Z Z

Eliptical equations.

ParabolicEquation Z Z Z Z Z Z

Parabolic equations.

HyperbolicEquation Z Z Z Z Z Z

Hyperbolic equations.

Instances

data Solution Source

The results of attempting to solve an Equation.

Constructors

ZxZ

All Integer pairs satisfy the equation.

NoSolutions

For all (x,y) in ZxZ

SolutionSet [(Z, Z)]

The set of pairs (x,y) that satisfy the equation. These are not in any particular order, and may contain duplicates.

Instances

type Z = IntegerSource

An alias for Integer, used to shorten type signatures.

Equation Solving

mergeSolutions :: Solution -> Solution -> SolutionSource

Merges two Solutions into one.

specializeEquation :: Equation -> EquationSource

Detirmines what kind of equation form a GeneralEquation fits. If you pass a non GeneralEquation to this function, it is the same as id.

solveLinear :: Equation -> SolutionSource

Solves for Equations in the form of dx + ey + f = 0

solveSimpleHyperbolic :: Equation -> SolutionSource

Solves for Equations in the form of bxy + dx + ey + f = 0

solveEliptical :: Equation -> SolutionSource

Solves for Equations in the form of ax^2 + bxy + cy^2 + dx + ey + f = 0 when b^2 - 4ac < 0

solveParabolic :: Equation -> SolutionSource

Solves for Equations in the form of ax^2 + bxy + cy^2 + dx + ey + f = 0 when b^2 - 4ac = 0