Contents Changes to MuPAD 1.2.2 Advanced Calculus Polynomials Linear Algebra Graphics Gröbner Bases Further Nice Examples
gbasis
groebner
info
LexOrder
normalf
ReOrder
spoly
groebner
The package groebner
contains functions to compute Gröbner bases
of polynomial ideals. The polynomials must have rational coefficients
or the coefficients must be from a domain representing a field.
First we want to export the functions of this package:
>> export(groebner):
The command info
displays some information about the package:
>> info(groebner);
Library 'groebner': Calculation of Gr"obner-bases for polynomial ideals Interface: gbasis, normalf, spoly
The function spoly
computes the S-polynomial of two polynomials p1 and p2:
>> p1:= poly(x^2*y + 5*x^2 + y^2, [y,x]);
2 2 2 poly(5 x + y + x y, [y, x])
>> p2:= poly(7*x*y^2 - 2*y^3 + 1, [y,x]);
3 2 poly(- 2 y + 7 x y + 1, [y, x])
>> spoly(p1, p2);
2 4 2 2 3 2 poly(- x - 2 y - 10 x y - 7 x y , [y, x])
The result was computed with respect to the total degree ordering of the terms. One may also use the lexicographical ordering:
>> spoly(p1, p2, LexOrder);
2 2 2 2 poly(- 7 x y - 10 x y - 2 x y - 1, [y, x])
The function normalf
returns the normal (fully reduced) form of a polynomial p modulo a
polynomial ideal P. The ideal is given as a list of polynomials.
As an example consider the ideal P = <p1,p2> and the polynomial q to be reduced:
>> q:= poly(3*x^3*y + 2*x^2*y^2 - 3*x*y + 5*x, [y,x]);
3 2 2 poly(5 x - 3 x y + 3 x y + 2 x y , [y, x])
Then the normal form of q with respect to the total degree ordering is given by
>> normalf(q, [p1, p2]);
2 3 2 2 poly(- 5 x + 3 x y - 50 x + 15 x - 10 y + 10 x y + 1, [y, x])
The reduced Gröbner basis of a polynomial ideal is computed by the
function gbasis
.
The ideal must be given as a list of polynomials:
>> gbasis([p1, p2]);
2 3 2 [poly(y + 251 x + 175 x + 50 y - 5, [y, x]), 2 2 2 3 2 poly(5 x + y + x y, [y, x]), poly(2 y - 7 x y - 1, [y, x])]
The Gröbner basis may also be computed with respect to the lexicographical ordering.
One may further allow the function gbasis
to heuristically change the order of the unknowns to find a more efficient one:
>> gbasis([p1, p2], LexOrder, Reorder);
3 4 5 6 [poly(175 x + 50 y - 4 y - 345 y + 49 y + 4 y + 1, [x, y]), 3 4 6 7 poly(y - 20 y - 4 y + 69 y + 4 y + 5, [x, y])]
Consider the polynomials
>> p1:= poly( x + y*z - 2, [x, y, z] );
poly(x + y z - 2, [x, y, z])
>> p2:= poly( x*z + y - 3, [x, y, z] );
poly(y + x z - 3, [x, y, z])
>> p3:= poly( x*y + z - 5, [x, y, z] );
poly(z + x y - 5, [x, y, z])
Given the system of equations {p1 = 0, p2 = 0, p3 = 0}, does there exist a solution at all? How many solutions are there? Such questions may be answered given the Gröbner basis of the ideal P = <p1, p2, p3>.
It is well known that there exists a solution if the basis doesn't contain a constant polynomial (regardless of the ordering chosen).
So lets first compute the reduced basis with respect to the degree ordering:
>> B:= gbasis( [p1, p2, p3] ): map( B, expr );
2 2 [x + y z - 2, y + x z - 3, - 3 y + 5 z + y - z , z + x y - 5, 2 2 2 3 - 2 x + 5 z + x - z , - 3 x - 2 y - z - 5 z + z + 11]
One may further conclude that a system has only a finite number of solutions if for each indeterminate X there is a leading term in the Gröbner basis which is of the form X^n for some n.
The leading terms of our basis B
fulfill this criterion:
>> map( B, lterm, DegreeOrder ): map( %, expr );
3 2 2 [z , x , x y, y , x z, y z]
As another example consider the system {p1 = 0, p2 = 0, p3 = 0} with polynomials
>> p1:= poly( x^2*y + 4*y^2 - 17, [x,y]);
2 2 poly(4 y + x y - 17, [x, y])
>> p2:= poly( 2*x*y - 3*y^3 + 8, [x,y]);
3 poly(2 x y - 3 y + 8, [x, y])
>> p3:= poly( x*y^2 - 5*x*y + 1, [x,y]);
2 poly(- 5 x y + x y + 1, [x, y])
This system has no solution, irrespective of the term ordering used:
>> gbasis( [ p1, p2, p3 ] ): map( %, expr );
[1]
>> gbasis( [ p1, p2, p3 ], LexOrder ): map( %, expr );
[1]