A minimal Buchberger algorithm

In this section the buchberger function from the module simplebb is presented. Unlike POLYBORI's more sophisticated routines this procedure was developed for educational purposes only:
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 addGenerator
    g=GroebnerStrategy()
    for p in l:
        g.addGenerator(p)
    while g.npairs()>0:
        g.cleanTopByChainCriterion()
        p=g.nextSpoly()
        p=g.nf(p)
        if not p.isZero():
            g.addGenerator(p)
    return list(g)
The criteria are handled by the addGenerator-method for immediately applicable criteria and by the function cleanTopByChainCriterion for the chain criterion.



2009-12-23