Package sage :: Package rings :: Package polynomial :: Module groebner_fan :: Class GroebnerFan
[hide private]
[frames] | no frames]

Class GroebnerFan

source code

                      object --+    
                               |    
structure.sage_object.SageObject --+
                                   |
                                  GroebnerFan

Instance Methods [hide private]
 
__init__(self, I, is_groebner_basis=False, symmetry=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., verbose=False)
INPUT: I -- ideal in a multivariate polynomial ring is_groebner_basis -- bool (default False).
source code
 
_repr_(self)
Describes the Groebner fan and its corresponding ideal.
source code
 
__eq__(self, right)
Tests equality of Groeber fan objects.
source code
 
ideal(self)
Return the ideal the was used to define this Groebner fan.
source code
 
_gfan_maps(self)
INPUT:...
source code
 
_gfan_ring(self)
Return the ring in gfan's notation...
source code
 
_gfan_ideal(self)
Return the ideal in gfan's notation.
source code
 
ring(self)
Return the multivariate polynomial ring.
source code
 
_gfan_reduced_groebner_bases(self)
A string of the reduced Groebner bases of the ideal as output by gfan.
source code
 
characteristic(self)
Return the characteristic of the base ring.
source code
 
reduced_groebner_bases(self)
EXAMPLES:...
source code
 
_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.
source code
 
gfan(self, cmd='', I=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., 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.
source code
 
__iter__(self)
Returns an iterator for the reduced Groebner bases.
source code
 
__getitem__(self, i)
Gets a reduced groebner basis...
source code
 
buchberger(self)
Computes and returns a lexicographic reduced Groebner basis for the ideal.
source code
 
polyhedralfan(self)
Returns a polyhedral fan object corresponding to the reduced Groebner bases.
source code
 
homogeneity_space(self)
Return the homogeneity space of a the list of polynomials that define this Groebner fan.
source code
 
render(self, file=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., larger=False, shift=0, rgbcolor=(0, 0, 0), polyfill=<function max_degree at 0xe0f5938>, scale_colors=True)
Render a Groebner fan as sage graphics or save as an xfig file.
source code
 
_cone_to_ieq(self, facet_list)
A simple utility function for converting a facet normal to an inequality form.
source code
 
_embed_tetra(self, fpoint)
Takes a 4-d vector and projects it onto the plane perpendicular to (1,1,1,1).
source code
 
_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.
source code
 
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.
source code
 
_gfan_stats(self)
Return various statistics about this Groebner fan.
source code
 
dimension_of_homogeneity_space(self)
Return the dimension of the homogeneity space.
source code
 
maximal_total_degree_of_a_groebner_basis(self)
Return the maximal total degree of any Groebner basis.
source code
 
minimal_total_degree_of_a_groebner_basis(self)
Return the minimal total degree of any Groebner basis.
source code
 
number_of_reduced_groebner_bases(self)
Return the number of reduced Groebner bases.
source code
 
number_of_variables(self)
Return the number of variables.
source code
 
tropical_basis(self, check=True, verbose=False)
Return a tropical basis for the tropical curve associated to this ideal.
source code
 
interactive(self, *args, **kwds)
See the documentation for self[0].interative() This does not work with the notebook.
source code
 
tropical_intersection(self, ideal_arg=False, *args, **kwds)
Returns information about the tropical intersection of the polynomials defining the ideal.
source code

Inherited from structure.sage_object.SageObject: __hash__, __new__, __repr__, _axiom_, _axiom_init_, _gap_, _gap_init_, _gp_, _gp_init_, _interface_, _interface_init_, _interface_is_cached_, _kash_, _kash_init_, _macaulay2_, _macaulay2_init_, _magma_, _magma_init_, _maple_, _maple_init_, _mathematica_, _mathematica_init_, _maxima_, _maxima_init_, _octave_, _octave_init_, _pari_, _pari_init_, _r_init_, _sage_, _singular_, _singular_init_, category, db, dump, dumps, plot, rename, reset_name, save, version

Inherited from object: __delattr__, __getattribute__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, I, is_groebner_basis=False, symmetry=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., verbose=False)
(Constructor)

source code 

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
    
EXAMPLES:
    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

Overrides: object.__init__

_repr_(self)

source code 

Describes the Groebner fan and its corresponding ideal.

EXAMPLES:
    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

__eq__(self, right)
(Equality operator)

source code 

Tests equality of Groeber fan objects.

EXAMPLES:
    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

ideal(self)

source code 

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

EXAMPLES:
    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

_gfan_maps(self)

source code 

INPUT:
    none
OUTPUT:
    -- map from SAGE ring to gfan ring
    -- map from gfan ring to SAGE ring

EXAMPLES:
    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_ring(self)

source code 

Return the ring in gfan's notation

EXAMPLES:
    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_ideal(self)

source code 

Return the ideal in gfan's notation.

EXAMPLES:
    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}'

ring(self)

source code 

Return the multivariate polynomial ring.

EXAMPLES:
    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

_gfan_reduced_groebner_bases(self)

source code 

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

EXAMPLES:
    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}}'

characteristic(self)

source code 

Return the characteristic of the base ring.

EXAMPLES:
    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

reduced_groebner_bases(self)

source code 

EXAMPLES:
    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]]

_gfan_mod(self)

source code 

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.

EXAMPLES:
    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(self, cmd='', I=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., format=True)

source code 

        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.

        EXAMPLES:
            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}
}
'
        

__iter__(self)

source code 

Returns an iterator for the reduced Groebner bases.

EXAMPLES:
    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]

__getitem__(self, i)
(Indexing operator)

source code 

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]

buchberger(self)

source code 

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

EXAMPLES:
    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]        

polyhedralfan(self)

source code 

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

EXAMPLES:
    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]]

homogeneity_space(self)

source code 

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

EXAMPLES:
    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()

render(self, file=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., larger=False, shift=0, rgbcolor=(0, 0, 0), polyfill=<function max_degree at 0xe0f5938>, scale_colors=True)

source code 

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


EXAMPLES:
    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)

_cone_to_ieq(self, facet_list)

source code 

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

EXAMPLES:
    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)

source code 

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

EXAMPLES:
    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]

_4d_to_3d(self, polyhedral_data)

source code 

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

EXAMPLES:
    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]]]

render3d(self, verbose=False)

source code 

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.

EXAMPLES:
    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()

_gfan_stats(self)

source code 

Return various statistics about this Groebner fan.

EXAMPLES:
    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}

dimension_of_homogeneity_space(self)

source code 

Return the dimension of the homogeneity space.

EXAMPLES:
    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

maximal_total_degree_of_a_groebner_basis(self)

source code 

Return the maximal total degree of any Groebner basis.

EXAMPLES:
    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)

source code 

Return the minimal total degree of any Groebner basis.

EXAMPLES:
    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)

source code 

Return the number of reduced Groebner bases.

EXAMPLES:
    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)

source code 

Return the number of variables.

EXAMPLES:
    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

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

source code 

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).
EXAMPLES:
    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]

interactive(self, *args, **kwds)

source code 

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

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

tropical_intersection(self, ideal_arg=False, *args, **kwds)

source code 

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

EXAMPLES:
    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]]