예제 #1
0
def less_than_n_solutions(ideal,n):
    l=interred(ideal)
    if not l:
        return False
    g=GroebnerStrategy(l[0].ring())
    all_monomials=Monomial([Variable(i) for i 
        in xrange(number_of_variables())]).divisors()
    monomials_not_in_leading_ideal=all_monomials
    for p in l:
        g.add_generator(p)
    while g.npairs()>0:
        monomials_not_in_leading_ideal=monomials_not_in_leading_ideal\
            % g.reduction_strategy.minimal_leading_terms
        if len(monomials_not_in_leading_ideal)<n:
            return True
        g.clean_top_by_chain_criterion()
        p=g.next_spoly()
        p=g.nf(p)
        if not p.is_zero():
            g.add_generator(p)
    monomials_not_in_leading_ideal=monomials_not_in_leading_ideal\
        % g.reduction_strategy.minimal_leading_terms
    if len(monomials_not_in_leading_ideal)<n:
        return True
    else:
        return False
예제 #2
0
def less_than_n_solutions(ideal, n):
    l = interred(ideal)
    if not l:
        return False
    g = GroebnerStrategy(l[0].ring())
    all_monomials = Monomial(
        [Variable(i) for i in xrange(number_of_variables())]).divisors()
    monomials_not_in_leading_ideal = all_monomials
    for p in l:
        g.add_generator(p)
    while g.npairs() > 0:
        monomials_not_in_leading_ideal = monomials_not_in_leading_ideal \
            % g.reduction_strategy.minimal_leading_terms
        if len(monomials_not_in_leading_ideal) < n:
            return True
        g.clean_top_by_chain_criterion()
        p = g.next_spoly()
        p = g.nf(p)
        if not p.is_zero():
            g.add_generator(p)
    monomials_not_in_leading_ideal = monomials_not_in_leading_ideal \
        % g.reduction_strategy.minimal_leading_terms
    if len(monomials_not_in_leading_ideal) < n:
        return True
    else:
        return False
예제 #3
0
def buchberger(l):
    "calculates a (non minimal) Groebner basis"
    l=interred(l)
    #for making sure, that every polynomial has a different leading term
    #needed for add_generator
    if not l:
        return []
    g=GroebnerStrategy(l[0].ring())
    for p in l:
        g.add_generator(p)
    while g.npairs()>0:
        g.clean_top_by_chain_criterion()
        p=g.next_spoly()
        p=g.nf(p)
        if not p.is_zero():
            g.add_generator(p)
    return list(g)
예제 #4
0
def buchberger(l):
    "calculates a (non minimal) Groebner basis"
    l = interred(l)
    #for making sure, that every polynomial has a different leading term
    #needed for add_generator
    if not l:
        return []
    g = GroebnerStrategy(l[0].ring())
    for p in l:
        g.add_generator(p)
    while g.npairs() > 0:
        g.clean_top_by_chain_criterion()
        p = g.next_spoly()
        p = g.nf(p)
        if not p.is_zero():
            g.add_generator(p)
    return list(g)