Gröbner bases are in 'hspray' 2.0.0

Hello,

I worked on my package ‘hspray’ (multivariate polynomials) these days. In the new version, it is possible to compute Gröbner bases.

I should upload this version on Hackage today.

import Math.Algebra.Hspray
import Data.Ratio

-- define the elementary monomials
o = lone 0 :: Spray Rational
x = lone 1 :: Spray Rational
y = lone 2 :: Spray Rational
z = lone 3 :: Spray Rational

-- define three polynomials
p1 = x^**^2 ^+^ y ^+^ z ^-^ o -- x² + y + z - 1
p2 = x ^+^ y^**^2 ^+^ z ^-^ o -- x + y² + z - 1
p3 = x ^+^ y ^+^ z^**^2 ^-^ o -- x + y + z² - 1

-- compute the Gröbner basis
g = groebner [p1, p2, p3]

-- show result
prettyResult = map (prettySpray show "x") g
mapM_ print prettyResult
"((-1) % 1) * x^() + (1 % 1) * x^(0, 0, 2) + (1 % 1) * x^(0, 1) + (1 % 1) * x^(1)"
"(1 % 1) * x^(0, 0, 1) + ((-1) % 1) * x^(0, 0, 2) + ((-1) % 1) * x^(0, 1) + (1 % 1) * x^(0, 2)"
"((-1) % 2) * x^(0, 0, 2) + (1 % 2) * x^(0, 0, 4) + (1 % 1) * x^(0, 1, 2)"
"((-1) % 1) * x^(0, 0, 2) + (4 % 1) * x^(0, 0, 3) + ((-4) % 1) * x^(0, 0, 4) + (1 % 1) * x^(0, 0, 6)"
2 Likes

I also have a repo at GitHub - DaveBarton/calculi: Fast parallel calculations in pure mathematics, e.g. Gröbner Bases that does this, with an emphasis on parallelism and timings. I’ve been working mostly on Macaulay2 the past few months, but hope to connect the two eventually (and upload to Hackage :grinning:).

1 Like

Maybe you could define instance Num (Spray ...) to prettify the syntax for polynomials…

Not sure to understand… But if I correctly understand, then that won’t do it. Because there’s the multiplication by a scalar too. And please see Easier usage in the README.

1 Like