(seq, ring, method=None)
return G
Computes Groebner basis for a set of polynomials in `K[X]`.

    Wrapper around the (default) improved Buchberger and the other algorithms
    for computing Groebner bases. The choice of algorithm can be changed via
    ``method`` argument or :func:`setup` from :mod:`sympy.polys.polyconfig`,
    where ``method`` can be either ``buchberger`` or ``f5b``.
Computes Groebner basis for a set of polynomials in `K[X]`.
Computes Groebner basis for a set of polynomials in K [ X ] .
def groebner(seq, ring, method=None):
    """
    Computes Groebner basis for a set of polynomials in `K[X]`.

    Wrapper around the (default) improved Buchberger and the other algorithms
    for computing Groebner bases. The choice of algorithm can be changed via
    ``method`` argument or :func:`setup` from :mod:`sympy.polys.polyconfig`,
    where ``method`` can be either ``buchberger`` or ``f5b``.

    """
    if method is None:
        method = query('groebner')

    _groebner_methods = {
        'buchberger': _buchberger,
        'f5b': _f5b,
    }

    try:
        _groebner = _groebner_methods[method]
    except KeyError:
        raise ValueError("'%s' is not a valid Groebner bases algorithm (valid are 'buchberger' and 'f5b')" % method)

    domain, orig = ring.domain, None

    if not domain.has_Field or not domain.has_assoc_Field:
        try:
            orig, ring = ring, ring.clone(domain=domain.get_field())
        except DomainError:
            raise DomainError("can't compute a Groebner basis over %s" % domain)
        else:
            seq = [ s.set_ring(ring) for s in seq ]

    G = _groebner(seq, ring)

    if orig is not None:
        G = [ g.clear_denoms()[1].set_ring(orig) for g in G ]

    return G
def groebner ( seq , ring , method = None ) : if method is None : method = query ( 'groebner' ) _groebner_methods = { 'buchberger' : _buchberger , 'f5b' : _f5b , } try : _groebner = _groebner_methods [ method ] except KeyError : raise ValueError ( "'%s' is not a valid Groebner bases algorithm (valid are 'buchberger' and 'f5b')" % method ) domain , orig = ring . domain , None if not domain . has_Field or not domain . has_assoc_Field : try : orig , ring = ring , ring . clone ( domain = domain . get_field ( ) ) except DomainError : raise DomainError ( "can't compute a Groebner basis over %s" % domain ) else : seq = [ s . set_ring ( ring ) for s in seq ] G = _groebner ( seq , ring ) if orig is not None : G = [ g . clear_denoms ( ) [ 1 ] . set_ring ( orig ) for g in G ] return G