@hackage linear-grammar0.0.2.1
A simple grammar for building linear equations and inclusive inequalities.
Categories
License
BSD-3-Clause
Maintainer
Athan Clark <athan.clark@gmail.com>
Links
Versions
Installation
Dependencies (3)
- base >=4.6 && <5
- containers
- QuickCheck Show all…
Dependents (1)
@hackage/simplex-basic
This library provides some simple tools for building abstract syntax trees, representing linear equations and (inclusive) inequalities. As an example:
12x + 3y - 4z + 12 <= 43x - 7b + 8q
Would look like...
f = (12 :: Rational) .*. EVar "x" .+. (3 :: Rational) .*. EVar "y" .+. (-4 :: Rational) .*. EVar "z" .+. ELit 12 .<=. (43 :: Rational) .*. EVar "x" .+. (-7 :: Rational) .*. EVar "b" .+. (8 :: Rational) .*. EVar "q"
I've added some overloading functionality, to help ease the verbosity of the
above statements - an IsString
instance, and some other utilities. To pack
the equation into standard form,
use the sandardForm
function:
stdF = standardForm f