34.2 Groebner Fans

Module: sage.rings.polynomial.groebner_fan

Groebner Fans

Sage provides much of the functionality of gfan, which is a software package whose main function is to enumerate all reduced Gröbner bases of a polynomial ideal. The reduced Gröbner bases yield the maximal cones in the Gröbner fan of the ideal. Several subcomputations can be issued and additional tools are included. Among these the highlights are:

- Anders Nedergaard Jensen: Wrote the gfan C++ program, which implements algorithms many of which were invented by Jensen, Komei Fukuda, and Rekha Thomas. All the underlying hard work of the Gröbner fans functionality of Sage depends on this C++ program.

- William Stein (2006-04-20): Wrote first version of the Sage code for working with Groebner fans.

- Tristram Bogart (bogart@math): the design of the Sage interface to gfan is joint work with Tristram Bogart, who also supplied numerous examples.

- Marshall Hampton (2008-03-25): Rewrote various functions to use gfan-0.3. This is still a work in progress, comments are appreciated on sage-devel@googlegroups.com (or personally at hamptonio@gmail.com).

sage: x,y = QQ['x,y'].gens() 
sage: i = ideal(x^2 - y^2 + 1)
sage: g = i.groebner_fan()
sage: g.reduced_groebner_bases()
[[x^2 - y^2 + 1], [-x^2 + y^2 - 1]]

TESTS:

sage: x,y = QQ['x,y'].gens() 
sage: i = ideal(x^2 - y^2 + 1)
sage: g = i.groebner_fan()
sage: g == loads(dumps(g))
True

REFERENCES: Anders N. Jensen; Gfan, a software system for Gröbner fans; available at http://www.math.tu-berlin.de/~jensen/software/gfan/gfan.html

Module-level Functions

max_degree( list_of_polys)

Computes the maximum degree of a list of polynomials

sage: from sage.rings.polynomial.groebner_fan import max_degree
sage: R.<x,y> = PolynomialRing(QQ,2)
sage: p_list = [x^2-y,x*y^10-x]
sage: max_degree(p_list)
11.0

prefix_check( str_list)

Checks if any strings in a list are prefixes of another string in the list.

sage: from sage.rings.polynomial.groebner_fan import prefix_check
sage: prefix_check(['z1','z1z1'])
False
sage: prefix_check(['z1','zz1'])
True

Class: GroebnerFan

class GroebnerFan
GroebnerFan( self, I, [is_groebner_basis=False], [symmetry=None], [verbose=False])

Input:

I
- ideal in a multivariate polynomial ring
is_groebner_basis
- bool (default False). if True, then I.gens() must be a Groebner basis with respect to the standard degree lexicographic term order.
symmetry
- default: None; if not None, describes symmetries of the ideal
verbose
- default: False; if True, printout useful info during computations

sage: R.<x,y,z> = PolynomialRing(QQ, 3, order='lex')
sage: I = R.ideal([x^2*y - z, y^2*z - x, z^2*x - y])
sage: G = I.groebner_fan(); G
Groebner fan of the ideal:
Ideal (x^2*y - z, -x + y^2*z, x*z^2 - y) of Multivariate Polynomial Ring in
x, y, z over Rational Field

Functions: buchberger,$ \,$ characteristic,$ \,$ dimension_of_homogeneity_space,$ \,$ gfan,$ \,$ homogeneity_space,$ \,$ ideal,$ \,$ interactive,$ \,$ maximal_total_degree_of_a_groebner_basis,$ \,$ minimal_total_degree_of_a_groebner_basis,$ \,$ number_of_reduced_groebner_bases,$ \,$ number_of_variables,$ \,$ polyhedralfan,$ \,$ reduced_groebner_bases,$ \,$ render,$ \,$ render3d,$ \,$ ring,$ \,$ tropical_basis,$ \,$ tropical_intersection

buchberger( self)

Computes and returns a lexicographic reduced Groebner basis for the ideal.

sage: R.<x,y,z> = PolynomialRing(QQ,3)
sage: G = R.ideal([x - z^3, y^2 - x + x^2 - z^3*x]).groebner_fan()
sage: G.buchberger()
[-z^3 + y^2, -z^3 + x]

characteristic( self)

Return the characteristic of the base ring.

sage: R.<x,y,z> = PolynomialRing(QQ,3)
sage: i1 = ideal(x*z + 6*y*z - z^2, x*y + 6*x*z + y*z - z^2, y^2 + x*z + y*z)
sage: gf = i1.groebner_fan()
sage: gf.characteristic()
0

dimension_of_homogeneity_space( self)

Return the dimension of the homogeneity space.

sage: R.<x,y> = PolynomialRing(QQ,2)
sage: G = R.ideal([y^3 - x^2, y^2 - 13*x]).groebner_fan()
sage: G.dimension_of_homogeneity_space()
0

gfan( self, [cmd=], [I=None], [format=True])

Returns the gfan output as a string given an input cmd; the default is to produce the list of reduced Groebner bases in gfan format.

            sage: R.<x,y> = PolynomialRing(QQ,2)
            sage: gf = R.ideal([x^3-y,y^3-x-1]).groebner_fan()
            sage: gf.gfan()
            'Q[x,y]
{{
y^9-1-y+3*y^3-3*y^6,
x+1-y^3}
,
{
y^3-1-x,
x^3-y}
,
{
y-x^3,
x^9-1-x}
}
'

homogeneity_space( self)

Return the homogeneity space of a the list of polynomials that define this Groebner fan.

sage: R.<x,y> = PolynomialRing(QQ,2)
sage: G = R.ideal([y^3 - x^2, y^2 - 13*x]).groebner_fan()
sage: H = G.homogeneity_space()

ideal( self)

Return the ideal the was used to define this Groebner fan.

sage: R.<x1,x2> = PolynomialRing(QQ,2)
sage: gf = R.ideal([x1^3-x2,x2^3-2*x1-2]).groebner_fan()
sage: gf.ideal()
Ideal (x1^3 - x2, x2^3 - 2*x1 - 2) of Multivariate Polynomial Ring in x1,
x2 over Rational Field

interactive( self)

See the documentation for self[0].interative() This does not work with the notebook.

sage: print "This is not easily doc-testable; please write a good one!"
This is not easily doc-testable; please write a good one!

maximal_total_degree_of_a_groebner_basis( self)

Return the maximal total degree of any Groebner basis.

sage: R.<x,y> = PolynomialRing(QQ,2)
sage: G = R.ideal([y^3 - x^2, y^2 - 13*x]).groebner_fan()
sage: G.maximal_total_degree_of_a_groebner_basis()
4

minimal_total_degree_of_a_groebner_basis( self)

Return the minimal total degree of any Groebner basis.

sage: R.<x,y> = PolynomialRing(QQ,2)        
sage: G = R.ideal([y^3 - x^2, y^2 - 13*x]).groebner_fan()
sage: G.minimal_total_degree_of_a_groebner_basis()
2

number_of_reduced_groebner_bases( self)

Return the number of reduced Groebner bases.

sage: R.<x,y> = PolynomialRing(QQ,2)                
sage: G = R.ideal([y^3 - x^2, y^2 - 13*x]).groebner_fan()
sage: G.number_of_reduced_groebner_bases()
3

number_of_variables( self)

Return the number of variables.

sage: R.<x,y> = PolynomialRing(QQ,2)                         
sage: G = R.ideal([y^3 - x^2, y^2 - 13*x]).groebner_fan()
sage: G.number_of_variables()
2

sage: R = PolynomialRing(QQ,'x',10)
sage: R.inject_variables(globals())
Defining x0, x1, x2, x3, x4, x5, x6, x7, x8, x9
sage: G = ideal([x0 - x9, sum(R.gens())]).groebner_fan()
sage: G.number_of_variables()
10

polyhedralfan( self)

Returns a polyhedral fan object corresponding to the reduced Groebner bases.

sage: R3.<x,y,z> = PolynomialRing(QQ,3)
sage: gf = R3.ideal([x^8-y^4,y^4-z^2,z^2-1]).groebner_fan()
sage: pf = gf.polyhedralfan()
sage: pf.rays()
[[1, 0, 0], [0, 1, 0], [0, 0, 1]]

reduced_groebner_bases( self)

sage: R.<x,y,z> = PolynomialRing(QQ, 3, order='lex')
sage: G = R.ideal([x^2*y - z, y^2*z - x, z^2*x - y]).groebner_fan()
sage: X = G.reduced_groebner_bases()
sage: len(X)
33
sage: X[0]
[z^15 - z, y - z^11, x - z^9]
sage: X[0].ideal()
Ideal (z^15 - z, y - z^11, x - z^9) of Multivariate Polynomial Ring in x,
y, z over Rational Field
sage: X[:5]
[[z^15 - z, y - z^11, x - z^9],
[-y + z^11, y*z^4 - z, y^2 - z^8, x - z^9],
[-y^2 + z^8, y*z^4 - z, y^2*z^3 - y, y^3 - z^5, x - y^2*z],
[-y^3 + z^5, y*z^4 - z, y^2*z^3 - y, y^4 - z^2, x - y^2*z],
[-y^4 + z^2, y^6*z - y, y^9 - z, x - y^2*z]]
sage: R3.<x,y,z> = PolynomialRing(GF(2477),3)
sage: gf = R3.ideal([300*x^3-y,y^2-z,z^2-12]).groebner_fan()
sage: gf.reduced_groebner_bases()
[[z^2 - 12, y^2 - z, x^3 + 933*y],
[-y^2 + z, y^4 - 12, x^3 + 933*y],
[z^2 - 12, -300*x^3 + y, x^6 - 1062*z],
[-828*x^6 + z, -300*x^3 + y, x^12 + 200]]

render( self, [file=None], [larger=False], [shift=0], [rgbcolor=(0, 0, 0)], [polyfill=<function max_degree at 0x37f7668>], [scale_colors=True])

Render a Groebner fan as sage graphics or save as an xfig file.

More precisely, the output is a drawing of the Groebner fan intersected with a triangle. The corners of the triangle are (1,0,0) to the right, (0,1,0) to the left and (0,0,1) at the top. If there are more than three variables in the ring we extend these coordinates with zeros.

Input:

file
- a filename if you prefer the output saved to a file. This will be in xfig format.
shift
- shift the positions of the variables in the drawing. For example, with shift=1, the corners will be b (right), c (left), and d (top). The shifting is done modulo the number of variables in the polynomial ring. The default is 0.
larger
- bool (default: False); if True, make the triangle larger so that the shape of of the Groebner region appears. Affects the xfig file but probably not the sage graphics (?)
rgbcolor
- This will not affect the saved xfig file, only the sage graphics produced.
polyfill
- Whether or not to fill the cones with a color determined by the highest degree in each reduced Groebner basis for that cone.
scale_colors
- if True, this will normalize color values to try to maximize the range

sage: R.<x,y> = PolynomialRing(QQ,2)
sage: G = R.ideal([y^3 - x^2, y^2 - 13*x]).groebner_fan()
sage: G.render()

sage: R.<x,y,z> = PolynomialRing(QQ,3)
sage: G = R.ideal([x^2*y - z, y^2*z - x, z^2*x - y]).groebner_fan()
sage: G.render(larger=True)

render3d( self, [verbose=False])

For a Groebner fan of an ideal in a ring with four variables, this function intersects the fan with the standard simplex perpendicular to (1,1,1,1), creating a 3d polytope, which is then projected into 3 dimensions. The edges of this projected polytope are returned as lines.

sage: R4.<w,x,y,z> = PolynomialRing(QQ,4)
sage: gf = R4.ideal([w^2-x,x^2-y,y^2-z,z^2-x]).groebner_fan()
sage: three_d = gf.render3d()

ring( self)

Return the multivariate polynomial ring.

sage: R.<x1,x2> = PolynomialRing(QQ,2)
sage: gf = R.ideal([x1^3-x2,x2^3-x1-2]).groebner_fan()
sage: gf.ring()
Multivariate Polynomial Ring in x1, x2 over Rational Field

tropical_basis( self, [check=True], [verbose=False])

Return a tropical basis for the tropical curve associated to this ideal.

Input:

check
- bool (default: True); if True raises a ValueError exception if this ideal does not define a tropical curve (i.e., the condition that R/I has dimension equal to 1 + the dimension of the homogeneity space is not satisfied).

sage: R.<x,y,z> = PolynomialRing(QQ,3, order='lex')
sage: G = R.ideal([y^3-3*x^2, z^3-x-y-2*y^3+2*x^2]).groebner_fan()
sage: G
Groebner fan of the ideal:
Ideal (-3*x^2 + y^3, 2*x^2 - x - 2*y^3 - y + z^3) of Multivariate
Polynomial Ring in x, y, z over Rational Field
sage: G.tropical_basis()
[-3*x^2 + y^3, 2*x^2 - x - 2*y^3 - y + z^3, 3/4*x + y^3 + 3/4*y - 3/4*z^3]

tropical_intersection( self, [ideal_arg=False])

Returns information about the tropical intersection of the polynomials defining the ideal.

sage: R.<x,y,z> = PolynomialRing(QQ,3)
sage: i1 = ideal(x*z + 6*y*z - z^2, x*y + 6*x*z + y*z - z^2, y^2 + x*z + y*z)
sage: gf = i1.groebner_fan()
sage: pf = gf.tropical_intersection()
sage: pf.rays()
[[-1, 0, 0]]

Special Functions: _4d_to_3d,$ \,$ __eq__,$ \,$ __getitem__,$ \,$ __init__,$ \,$ __iter__,$ \,$ _cone_to_ieq,$ \,$ _embed_tetra,$ \,$ _gfan_ideal,$ \,$ _gfan_maps,$ \,$ _gfan_mod,$ \,$ _gfan_reduced_groebner_bases,$ \,$ _gfan_ring,$ \,$ _gfan_stats,$ \,$ _repr_

_4d_to_3d( self, polyhedral_data)

A utility function that takes a list of 4d polytopes, projects them to 3d, and returns a list of edges.

Input:

polyhedral_data
- an object with 4d vertex and adjacency information

Output:
edges
- a list of edges in 3d - each list item is a pair of points

sage: R4.<w,x,y,z> = PolynomialRing(QQ,4)
sage: gf = R4.ideal([w^2-x,x^2-y,y^2-z,z^2-1]).groebner_fan()
sage: g_cone = gf[0].groebner_cone()
sage: g_cone_facets = g_cone.facets()
sage: g_cone_ieqs = gf._cone_to_ieq(g_cone_facets)
sage: cone_data = ieq_to_vert(g_cone_ieqs,linearities=[[1,-1,-1,-1,-1]])
sage: cone_lines = gf._4d_to_3d(cone_data)
sage: cone_lines
[[[-3/5, -1/3, -1/5], [-1/7, 3/7, 5/7]], [[-3/5, -1/3, -1/5], [1, -1/3,
1/3]], [[-3/5, -1/3, -1/5], [1, 1, -1]], [[-1/7, 3/7, 5/7], [1, -1/3,
1/3]], [[-1/7, 3/7, 5/7], [1, 1, -1]], [[1, -1/3, 1/3], [1, 1, -1]]]

__eq__( self, right)

Tests equality of Groeber fan objects.

sage: R.<q,u> = PolynomialRing(QQ,2)
sage: gf = R.ideal([q^2-u,u^2-q]).groebner_fan()
sage: gf2 = R.ideal([u^2-q,q^2-u]).groebner_fan()
sage: gf.__eq__(gf2)
True

__getitem__( self, i)

Gets a reduced groebner basis

EXAMPLES;

sage: R4.<w1,w2,w3,w4> = PolynomialRing(QQ,4)
sage: gf = R4.ideal([w1^2-w2,w2^3-1,2*w3-w4^2,w4^2-w1]).groebner_fan()
sage: gf[0]
[w4^12 - 1, -1/2*w4^2 + w3, -w4^4 + w2, -w4^2 + w1]

__iter__( self)

Returns an iterator for the reduced Groebner bases.

sage: R.<x,y> = PolynomialRing(QQ,2)
sage: gf = R.ideal([x^3-y,y^3-x-1]).groebner_fan()
sage: a = gf.__iter__()
sage: a.next()
[y^9 - 3*y^6 + 3*y^3 - y - 1, -y^3 + x + 1]

_cone_to_ieq( self, facet_list)

A simple utility function for converting a facet normal to an inequality form.

sage: R.<x,y> = PolynomialRing(QQ,2) # dummy stuff to get a gfan object
sage: gf = R.ideal([x^2+y,y^2]).groebner_fan()
sage: gf._cone_to_ieq([[1,2,3,4]])
[[0, 1, 2, 3, 4]]

_embed_tetra( self, fpoint)

Takes a 4-d vector and projects it onto the plane perpendicular to (1,1,1,1). Stretches by a factor of 2 as well, since this is only for graphical display purposes.

Input:

fpoint
- a list of four numbers

sage: R.<x> = PolynomialRing(QQ,1) # dummy stuff to get a gfan object
sage: gf = R.ideal([x^2]).groebner_fan()
sage: gf._embed_tetra([1/2,1/2,1/2,1/2])
[0, 0, 0]

_gfan_ideal( self)

Return the ideal in gfan's notation.

sage: R.<x,y,z> = PolynomialRing(QQ,3)
sage: G = R.ideal([x^2*y - z, y^2*z - x, z^2*x - y]).groebner_fan()
sage: G._gfan_ideal()
'Q[x, y, z]{x^2*y-z,y^2*z-x,x*z^2-y}'

_gfan_maps( self)

Input: none Output:

- map from SAGE ring to gfan ring
- map from gfan ring to SAGE ring

sage: R.<x,y,z> = PolynomialRing(QQ,3)
sage: G = R.ideal([x^2*y - z, y^2*z - x, z^2*x - y]).groebner_fan()
sage: G._gfan_maps()
(Ring morphism:
  From: Multivariate Polynomial Ring in x, y, z over Rational Field
  To:   Multivariate Polynomial Ring in a, b, c over Rational Field
  Defn: x |--> a
        y |--> b
        z |--> c,
 Ring morphism:
  From: Multivariate Polynomial Ring in a, b, c over Rational Field
  To:   Multivariate Polynomial Ring in x, y, z over Rational Field
  Defn: a |--> x
        b |--> y
        c |--> z)

_gfan_mod( self)

Return the extra options to the gfan command that are used by this object to account for working modulo a prime or in the presence of extra symmetries.

sage: R.<x,y> = PolynomialRing(QQ,2)
sage: gf = R.ideal([x^3-y,y^3-x-1]).groebner_fan()
sage: gf._gfan_mod()
''

_gfan_reduced_groebner_bases( self)

A string of the reduced Groebner bases of the ideal as output by gfan.

sage: R.<a,b> = PolynomialRing(QQ,2)
sage: gf = R.ideal([a^3-b^2,b^2-a-1]).groebner_fan()
sage: gf._gfan_reduced_groebner_bases()
'Q[a,b]{{b^6-1+2*b^2-3*b^4,a+1-b^2},{b^2-1-a,a^3-1-a}}'

_gfan_ring( self)

Return the ring in gfan's notation

sage: R.<x,y,z> = PolynomialRing(QQ,3)
sage: G = R.ideal([x^2*y - z, y^2*z - x, z^2*x - y]).groebner_fan()
sage: G._gfan_ring()
'Q[x, y, z]'

_gfan_stats( self)

Return various statistics about this Groebner fan.

sage: R.<x,y> = PolynomialRing(QQ)
sage: G = R.ideal([y^3 - x^2, y^2 - 13*x]).groebner_fan()
sage: G._gfan_stats()
{'Number of reduced Groebner bases': 3,
 'Maximal total degree of a Groebner basis': 4,
 'Dimension of homogeneity space': 0,
 'Number of variables': 2,
 'Minimal total degree of a Groebner basis': 2}

_repr_( self)

Describes the Groebner fan and its corresponding ideal.

sage: R.<q,u> = PolynomialRing(QQ,2)
sage: gf = R.ideal([q-u,u^2-1]).groebner_fan()
sage: gf # indirect doctest
Groebner fan of the ideal:
Ideal (q - u, u^2 - 1) of Multivariate Polynomial Ring in q, u over
Rational Field

Class: PolyhedralCone

class PolyhedralCone
PolyhedralCone( self, gfan_polyhedral_cone, [ring=Rational Field])

Converts polymake/gfan data on a polyhedral cone into a sage class. Currently (18-03-2008) needs a lot of work.

sage: R3.<x,y,z> = PolynomialRing(QQ,3)
sage: gf = R3.ideal([x^8-y^4,y^4-z^2,z^2-2]).groebner_fan()
sage: a = gf[0].groebner_cone()
sage: a.facets()
[[0, 0, 1], [0, 1, 0], [1, 0, 0]]

Functions: ambient_dim,$ \,$ dim,$ \,$ facets,$ \,$ lineality_dim,$ \,$ relative_interior_point

ambient_dim( self)

Returns the ambient dimension of the Groebner cone.

sage: R3.<x,y,z> = PolynomialRing(QQ,3)
sage: gf = R3.ideal([x^8-y^4,y^4-z^2,z^2-2]).groebner_fan()
sage: a = gf[0].groebner_cone()
sage: a.ambient_dim()
3

dim( self)

Returns the dimension of the Groebner cone.

sage: R3.<x,y,z> = PolynomialRing(QQ,3)
sage: gf = R3.ideal([x^8-y^4,y^4-z^2,z^2-2]).groebner_fan()
sage: a = gf[0].groebner_cone()
sage: a.dim()
3

facets( self)

Returns the inward facet normals of the Groebner cone.

sage: R3.<x,y,z> = PolynomialRing(QQ,3)
sage: gf = R3.ideal([x^8-y^4,y^4-z^2,z^2-2]).groebner_fan()
sage: a = gf[0].groebner_cone()
sage: a.facets()
[[0, 0, 1], [0, 1, 0], [1, 0, 0]]

lineality_dim( self)

Returns the lineality dimension of the Groebner cone. This is the just the difference between the ambient dimension and the dimension of the cone.

sage: R3.<x,y,z> = PolynomialRing(QQ,3)
sage: gf = R3.ideal([x^8-y^4,y^4-z^2,z^2-2]).groebner_fan()
sage: a = gf[0].groebner_cone()
sage: a.lineality_dim()
0

relative_interior_point( self)

Returns a point in the relative interior of the Groebner cone.

sage: R3.<x,y,z> = PolynomialRing(QQ,3)
sage: gf = R3.ideal([x^8-y^4,y^4-z^2,z^2-2]).groebner_fan()
sage: a = gf[0].groebner_cone()
sage: a.relative_interior_point()
[1, 1, 1]

Special Functions: __init__,$ \,$ _repr_

_repr_( self)

Returns a basic description of the polyhedral cone.

sage: R3.<x,y,z> = PolynomialRing(QQ,3)
sage: gf = R3.ideal([x^8-y^4,y^4-z^2,z^2-2]).groebner_fan()
sage: a = gf[0].groebner_cone()
sage: a # indirect doctests
Polyhedral cone in 3 dimensions of dimension 3

Class: PolyhedralFan

class PolyhedralFan
PolyhedralFan( self, gfan_polyhedral_fan)

Converts polymake/gfan data on a polyhedral fan into a sage class. Currently (18-03-2008) needs a lot of work.

Input:

gfan_polyhedral_fan
- output from gfan of a polyhedral fan.

sage: R.<x,y,z> = PolynomialRing(QQ,3)
sage: i2 = ideal(x*z + 6*y*z - z^2, x*y + 6*x*z + y*z - z^2, y^2 + x*z + y*z)
sage: gf2 = i2.groebner_fan(verbose = False)
sage: pf = gf2.polyhedralfan()
sage: pf.rays()
[[1, 0, 0], [-2, -1, 0], [1, 1, 0], [0, -1, 0], [-1, 1, 0]]

Functions: ambient_dim,$ \,$ dim,$ \,$ lineality_dim,$ \,$ rays

ambient_dim( self)

Returns the ambient dimension of the Groebner fan.

sage: R3.<x,y,z> = PolynomialRing(QQ,3)
sage: gf = R3.ideal([x^8-y^4,y^4-z^2,z^2-2]).groebner_fan()
sage: a = gf.polyhedralfan()
sage: a.ambient_dim()
3

dim( self)

Returns the dimension of the Groebner fan.

sage: R3.<x,y,z> = PolynomialRing(QQ,3)
sage: gf = R3.ideal([x^8-y^4,y^4-z^2,z^2-2]).groebner_fan()
sage: a = gf.polyhedralfan()
sage: a.dim()
3

lineality_dim( self)

Returns the lineality dimension of the Groebner fan. This is the just the difference between the ambient dimension and the dimension of the cone.

sage: R3.<x,y,z> = PolynomialRing(QQ,3)
sage: gf = R3.ideal([x^8-y^4,y^4-z^2,z^2-2]).groebner_fan()
sage: a = gf.polyhedralfan()
sage: a.lineality_dim()
0

rays( self)

Returns a list of rays of the polyhedral fan.

sage: R.<x,y,z> = PolynomialRing(QQ,3)
sage: i2 = ideal(x*z + 6*y*z - z^2, x*y + 6*x*z + y*z - z^2, y^2 + x*z + y*z)
sage: gf2 = i2.groebner_fan(verbose = False)
sage: pf = gf2.polyhedralfan()
sage: pf.rays()
[[1, 0, 0], [-2, -1, 0], [1, 1, 0], [0, -1, 0], [-1, 1, 0]]

Special Functions: __init__,$ \,$ _repr_,$ \,$ _str_

_repr_( self)

Returns a basic description of the polyhedral fan.

sage: R3.<x,y,z> = PolynomialRing(QQ,3)
sage: gf = R3.ideal([x^8-y^4,y^4-z^2,z^2-2]).groebner_fan()
sage: pf = gf.polyhedralfan()
sage: pf # indirect doctest
Polyhedral fan in 3 dimensions of dimension 3

_str_( self)

Returns the raw output of gfan as a string. This should only be needed internally as all relevant output is converted to sage objects.

sage: R3.<x,y,z> = PolynomialRing(QQ,3)
sage: gf = R3.ideal([x^8-y^4,y^4-z^2,z^2-2]).groebner_fan()
sage: pf = gf.polyhedralfan()
sage: pf._str_()
'_application PolyhedralFan\n_version 2.2\n_type
PolyhedralFan\n\nAMBIENT_DIM\n3\n\nDIM\n3\n\nLINEALITY_DIM\n0\n\nRAYS\n1 0
0\t# 0\n0 1 0\t# 1\n0 0 1\t#
2\n\nN_RAYS\n3\n\nLINEALITY_SPACE\n\nORTH_LINEALITY_SPACE\n0 0 1\n0 1 0\n1
0 0\n\nF_VECTOR\n1 3 3 1\n\nCONES\n{}\t# Dimension 0\n{0}\t# Dimension
1\n{1}\n{2}\n{0 1}\t# Dimension 2\n{0 2}\n{1 2}\n{0 1 2}\t# Dimension
3\n\nMAXIMAL_CONES\n{0 1 2}\t# Dimension 3\n\nPURE\n1\n'

Class: ReducedGroebnerBasis

class ReducedGroebnerBasis
ReducedGroebnerBasis( self, groebner_fan, gens, gfan_gens)

A class for representing reduced Groebner bases as produced by gfan.

Input:

groebner_fan
- a GroebnerFan object from an ideal
gens
- the generators of the ideal
gfan_gens
- the generators as a gfan string

sage: R.<a,b> = PolynomialRing(QQ,2)
sage: gf = R.ideal([a^2-b^2,b-a-1]).groebner_fan()
sage: from sage.rings.polynomial.groebner_fan import ReducedGroebnerBasis
sage: ReducedGroebnerBasis(gf,gf[0],gf[0]._gfan_gens())
[b - 1/2, a + 1/2]

Functions: groebner_cone,$ \,$ ideal,$ \,$ interactive

groebner_cone( self, [restrict=False])

Return defining inequalities for the full-dimensional Groebner cone associated to this marked minimal reduced Groebner basis.

Input:

restrict
- bool (default: False); if True, add an inequality for each coordinate, so that the cone is restricted to the positive orthant.

Output: tuple of integer vectors

sage: R.<x,y> = PolynomialRing(QQ,2)
sage: G = R.ideal([y^3 - x^2, y^2 - 13*x]).groebner_fan()
sage: poly_cone = G[1].groebner_cone()
sage: poly_cone.facets()
[[-1, 2], [1, -1]]
sage: [g.groebner_cone().facets() for g in G]
[[[0, 1], [1, -2]], [[-1, 2], [1, -1]], [[-1, 1], [1, 0]]]
sage: G[1].groebner_cone(restrict=True).facets()
[[-1, 2], [1, -1]]

ideal( self)

Return the ideal generated by this basis.

sage: R.<x,y,z> = PolynomialRing(QQ,3)
sage: G = R.ideal([x - z^3, y^2 - 13*x]).groebner_fan()
sage: G[0].ideal()
Ideal (-13*z^3 + y^2, -z^3 + x) of Multivariate Polynomial Ring in x, y, z
over Rational Field

interactive( self, [latex=False], [flippable=False], [wall=False], [inequalities=False], [weight=False])

Do an interactive walk of the Groebner fan starting at this reduced Groebner basis.

sage: R.<x,y> = PolynomialRing(QQ,2)
sage: G = R.ideal([y^3 - x^2, y^2 - 13*x]).groebner_fan()
sage: G[0].interactive()      # not tested
Initializing gfan interactive mode
*********************************************
*     Press control-C to return to SAGE     *
*********************************************
....

Special Functions: __init__,$ \,$ _gfan,$ \,$ _gfan_gens,$ \,$ _repr_

_gfan( self)

Returns a description of the Groebner fan this basis was derived from.

sage: R.<z1,zz1> = PolynomialRing(QQ,2)
sage: gf = R.ideal([z1^2*zz1-1,zz1-2]).groebner_fan()
sage: rgb1 = gf.reduced_groebner_bases()[0]
sage: rgb1._gfan()
Groebner fan of the ideal:
Ideal (z1^2*zz1 - 1, zz1 - 2) of Multivariate Polynomial Ring in z1, zz1
over Rational Field

_gfan_gens( self)

Returns the reduced Groebner basis as a string in gfan format.

sage: R.<z1,zz1> = PolynomialRing(QQ,2)
sage: gf = R.ideal([z1^2*zz1-1,zz1-2]).groebner_fan()
sage: rgb1 = gf.reduced_groebner_bases()[0]
sage: rgb1._gfan_gens()
'{zz1-2,z1^2-1/2}'

_repr_( self)

Returns the reduced Groebner basis as a string.

sage: R.<z1,zz1> = PolynomialRing(QQ,2)
sage: gf = R.ideal([z1^2*zz1-1,zz1-2]).groebner_fan()
sage: rgb1 = gf.reduced_groebner_bases()[0]
sage: rgb1 # indirect doctest
[zz1 - 2, z1^2 - 1/2]

See About this document... for information on suggesting changes.