I have written this function that transforms a singular ring into the
corresponding sage ring. As far as i can tell it works fine with
polynomial rings over the real, complex, rationals and finite fields,
and algebraic extensions of them. It doesn't consider the monomial
ordering though (i haven't found how to work with local orderings in
sage).

In case you think it can be useful to include it in sage, either as is
or modified, feel free to do so.

Best.

Miguel Marco.

The function is the following:
def coerce_ring_from_singular(r):
    cha=str(r.charstr())
    vars=str(r.varstr()).rsplit(',')
    ch=cha.partition(',')[0]
    if ch=='real':
        fiel=RR
    elif ch=='0':
        fiel=QQ
    elif ch=='complex':
        fiel=ComplexField()
    else:
        fiel=GF(eval(cha))
    if ',' in cha:
        fielx=PolynomialRing(fiel,cha.partition(',')[2])
        fielx.inject_variables()
        minpoly=r.ringlist()[1][4][1]
        minpoly=minpoly.sage_polystring()
        minpoly=eval(minpoly)
        fiel=fielx.quotient(fielx.ideal(minpoly))
    R=PolynomialRing(fiel,vars)
    return R

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to