14.15.4 An Important Concept

Author: Neal Harris

The following illustrates an important concept: how Sage interacts with the data being used and returned by Singular. Let's compute a Gröbner basis for some ideal, using Singular through Sage.

sage: singular.lib('poly.lib')
sage: singular.ring(32003, '(a,b,c,d,e,f)', 'lp')
        //   characteristic : 32003
        //   number of vars : 6
        //        block   1 : ordering lp
        //                        : names    a b c d e f 
        //        block   2 : ordering C
sage: I = singular.ideal('cyclic(6)')
sage: g = singular('groebner(I)')             
Traceback (most recent call last):
...
TypeError: Singular error:
...

We restart everything and try again, but correctly.

sage: singular.quit()
sage: singular.lib('poly.lib'); R = singular.ring(32003, '(a,b,c,d,e,f)', 'lp')
sage: I = singular.ideal('cyclic(6)')
sage: I.groebner()     
f^48-2554*f^42-15674*f^36+12326*f^30-12326*f^18+15674*f^12+2554*f^6-1,
...

It's important to understand why the first attempt at computing a basis failed. The line where we gave singular the input 'groebner(I)' was useless because Singular has no idea what 'I' is! Although 'I' is an object that we computed with calls to Singular functions, it actually lives in Sage. As a consequence, the name 'I' means nothing to Singular. When we called I.groebner(), Sage was able to call the groebner function on'I' in Singular, since 'I' actually means something to Sage.

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