Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using Singular's solve.lib

I am trying to use Singular's solve.lib from Sage, but I am running into issues with getting the result out of Singular. I tried using the Singular interface and was able to make it this far:

sage: singular.lib('solve.lib')
sage: r = singular.ring('complex', '(x,y)', 'lp')
sage: I = singular.ideal('(x-5)*y/32', 'y^2-x^3-5*x-10')
sage: R = singular.fglm_solve(I)
sage: singular.setring(R)

at which point the result is stored in a list rlist inside of R. I can do singular.eval('rlist') and see the answer, but in order to get it back into Sage I would have to parse the resulting string. Is there a better way to get rlist?

Alternatively, I tried to use libSingular as follows:

sage: from sage.libs.singular.function import singular_function, lib
sage: lib('solve.lib')
sage: fglm_solve = singular_function('fglm_solve')
sage: P = PolynomialRing(QQ,'x,y',order='lex'); x,y = P.gens()
sage: I = Ideal((x-5)*y/32, y^2-x^3-5*x-10)
sage: R = fglm_solve(I)

// 'fglm_solve' created a ring, in which a list rlist of numbers (the
// complex solutions) is stored.
// To access the list of complex solutions, type (if the name R was assigned
// to the return value):
        setring R; rlist; 
<RingWrap>

But then R is a <RingWrap> instance and this time I don't even know how to go about seeing the answer. Also, I would prefer to work over the complex field, but I couldn't get fglm_solve to accept an ideal in CC['x,y']

Any help in either direction would be greatly appreciated.