Main Content

gbasis

Reduced Groebner basis

Description

gbasis(poly) returns the Groebner basis of the vector of polynomials poly. By default, gbasis finds independent variables in poly by using symvar, and uses the monomial ordering degreeInverseLexicographic.

example

gbasis(poly,vars) also uses the independent variables vars.

example

gbasis(___,'MonomialOrder',MonomialOrder) also uses the specified monomial order in addition to the input arguments in previous syntaxes. Options are 'degreeInverseLexicographic', 'degreeLexicographic', or 'lexicographic'. By default, gbasis uses 'degreeInverseLexicographic'.

example

Examples

collapse all

Calculate the Groebner basis of the polynomials x^2-y^2 and x^2+y. By default, gbasis finds the independent variables by using symvar.

syms x y
p = [x^2-y^2, x^2+y];
gbasis(p)
ans =
[ x^2 + y, y^2 + y]

Specify the independent variables as the second argument of gbasis.

Compute the Groebner basis of the polynomials a*y+x^2*y+a and a*x^2+y with the independent variables [x y].

syms x y a
p = [a*y + x^2*y + a, a*x^2 + y];
vars = [x y];
grobnerBasis = gbasis(p,vars)
grobnerBasis =
[ a*x^2 + y, - y^2/a + a*y + a]

By default, gbasis uses the monomial order degreeInverseLexicographic. Change the monomial order by using the 'MonomialOrder' name-value pair argument.

Find the Groebner basis of the polynomials y*z^2+1 and y^2*x^2-y-z^3 with lexicographic monomial order.

syms x y z
p = [y*z^2 + 1, y^2*x^2 - y - z^3];
grobnerBasis = gbasis(p,'MonomialOrder','lexicographic')
grobnerBasis =
[ x^2 - z^7 + z^2, y*z^2 + 1]

Use the variables [z y] with degreeLexicographic monomial order.

grobnerBasis = gbasis(p,[z y],'MonomialOrder','degreeLexicographic')
grobnerBasis =
[ x^2*y^2 - y - z^3, y*z^2 + 1, x^2*y^3 - y^2 + z]

Input Arguments

collapse all

Polynomials, specified as a vector of symbolic expressions.

Independent variables, specified as a vector of symbolic variables.

Monomial order, specified as the comma-separated pair of 'MonomialOrder' and one of the values 'degreeInverseLexicographic', 'degreeLexicographic', or 'lexicographic'. If vars is specified, then monomials are sorted with respect to the order of variables in vars.

  • lexicographic sorts the terms of the polynomial using lexicographic ordering.

  • degreeLexicographic sorts the terms of a polynomial according to the total degree of each term. If terms have equal total degrees, polynomialReduce sorts them using lexicographic ordering.

  • degreeInverseLexicographic sorts the terms of a polynomial according to the total degree of each term. If terms have equal total degrees, polynomialReduce sorts them using inverse lexicographic ordering.

Version History

Introduced in R2018a