diophantine-0.2.1.0: A quadratic diophantine equation solving library.

CopyrightJoe Jevnik 2013
LicenseGPL-2
Maintainerjoejev@gmail.org
Stabilitystable
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

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 = Integer Source

An alias for Integer, used to shorten type signatures.

Equation Solving

mergeSolutions :: Solution -> Solution -> Solution Source

Merges two Solutions into one.

specializeEquation :: Equation -> Equation Source

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 -> Solution Source

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

WARNING: This expects that the Equation is actually a LinearEquation; it is safer to just call solve unless you have already verified that the equation is linear.

solveSimpleHyperbolic :: Equation -> Solution Source

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

WARNING: This expects that the Equation is actually a SimpleHyperbolicEquation; it is safer to just call solve unless you have already verified that the equation is simple hyperbolic.

solveEliptical :: Equation -> Solution Source

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

WARNING: This expects that the Equation is actually an ElipticalEquation; it is safer to just call solve unless you have already verified that the equation is eliptical.

solveParabolic :: Equation -> Solution Source

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

WARNING: This expects that the Equation is actually a ParabolicEquation; it is safer to just call solve unless you have already verified that the equation is parabolic.