id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,merged,author,reviewer,upstream,work_issues,branch,commit,dependencies,stopgaps
11431,Conversion from Singular to Sage,SimonKing,was,"On [http://groups.google.com/group/sage-support/browse_thread/thread/f35e6064434dacdc sage-devel], Francisco Botana complained about some shortcomings of the conversion from Singular (pexpect interface) to Sage.
I think the conversions provided by this patch are quite thorough.
First of all, the patch provides a conversion of base rings, even with minpoly, with complicated block, matrix and weighted orders (note that one needs #11316) and even quotient rings:
{{{
sage: singular.eval('ring r1 = (9,x),(a,b,c,d,e,f),(M((1,2,3,0)),wp(2,3),lp)')
'ring r1 = (9,x),(a,b,c,d,e,f),(M((1,2,3,0)),wp(2,3),lp);'
sage: R = singular('r1').sage_basering()
sage: R
Multivariate Polynomial Ring in a, b, c, d, e, f over Finite Field in x of size 3^2
sage: R.term_order()
Block term order with blocks:
(Matrix term order with matrix
[1 2]
[3 0],
Weighted degree reverse lexicographic term order with weights (2, 3),
Lexicographic term order of length 2)
sage: singular.eval('ring r3 = (3,z),(a,b,c),dp')
'ring r3 = (3,z),(a,b,c),dp;'
sage: singular.eval('minpoly = 1+z+z2+z3+z4')
'minpoly = 1+z+z2+z3+z4;'
sage: singular('r3').sage_basering()
Multivariate Polynomial Ring in a, b, c over Univariate Quotient Polynomial Ring in z over Finite Field of size 3 with modulus z^4 + z^3 + z^2 + z + 1
sage: singular.eval('ring r5 = (9,a), (x,y,z),lp')
'ring r5 = (9,a), (x,y,z),lp;'
sage: Q = singular('std(ideal(x^2,x+y^2+z^3))', type='qring')
sage: Q.sage_basering()
Quotient of Multivariate Polynomial Ring in x, y, z over Finite Field in a of size 3^2 by the ideal (y^4 - y^2*z^3 + z^6, x + y^2 + z^3)
}}}
By consequence, it is now straight forward to convert polynomials or ideals to sage:
{{{
sage: singular.eval('ring R = integer, (x,y,z),lp')
'// ** You are using coefficient rings which are not fields...'
sage: I = singular.ideal(['x^2','y*z','z+x'])
sage: I.sage() # indirect doctest
Ideal (x^2, y*z, x + z) of Multivariate Polynomial Ring in x, y, z over Integer Ring
# Note that conversion of a Singular string to a Sage string was missing
sage: singular('ringlist(basering)').sage()
[['integer'], ['x', 'y', 'z'], [['lp', (1, 1, 1)], ['C', (0)]], Ideal (0) of Multivariate Polynomial Ring in x, y, z over Integer Ring]
sage: singular.eval('ring r10 = (9,a), (x,y,z),lp')
'ring r10 = (9,a), (x,y,z),lp;'
sage: Q = singular('std(ideal(x^2,x+y^2+z^3))', type='qring')
sage: Q.sage()
Quotient of Multivariate Polynomial Ring in x, y, z over Finite Field in a of size 3^2 by the ideal (y^4 - y^2*z^3 + z^6, x + y^2 + z^3)
sage: singular('x^2+y').sage()
x^2 + y
sage: singular('x^2+y').sage().parent()
Quotient of Multivariate Polynomial Ring in x, y, z over Finite Field in a of size 3^2 by the ideal (y^4 - y^2*z^3 + z^6, x + y^2 + z^3)
}}}
----
Apply
1. [attachment:trac11431_singular_sage_conversion.patch]
1. [attachment:trac11431_singular_sage_documentation.patch]
to the Sage library.
",defect,closed,major,sage-4.7.2,interfaces,fixed,,malb,sage-4.7.2.alpha3,Simon King,Martin Albrecht,None of the above - read trac for reasoning.,,,,#11316 #11645,