#11431: Conversion from Singular to Sage
-------------------------------------------------------------+--------------
    Reporter:  SimonKing                                     |         Owner:  
was            
        Type:  defect                                        |        Status:  
positive_review
    Priority:  major                                         |     Milestone:  
sage-4.7.2     
   Component:  interfaces                                    |    Resolution:   
              
    Keywords:                                                |   Work_issues:   
              
    Upstream:  None of the above - read trac for reasoning.  |      Reviewer:  
Martin Albrecht
      Author:  Simon King                                    |        Merged:   
              
Dependencies:  #11316, #11645                                |  
-------------------------------------------------------------+--------------

Old description:

> 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 all patches

New description:

 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.

--

Comment(by leif):

 Simon, are you ok with dropping the (IMHO obsolete) Solaris patch?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11431#comment:27>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to