Hi there, below a couple of quick comments:
> 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(sage_eval(ch)) > if ',' in cha and ch<>'complex' and ch<>'real': I think you're probably looking for != here. > generator=cha.partition(',')[2] > fielx=PolynomialRing(fiel,generator) > minpoly=r.ringlist()[1][4][1] > minpoly=minpoly.sage_polystring() > minpoly=sage_eval(minpoly,locals={generator:fielx.gen()}) Sorry for failing to mention that earlier, there is a function called 'gens_dict' which gives you the right dictionary to pass to sage_eval: sage: k.<a> = GF(2^8) sage: k.gens_dict() {'a': a} sage: z = var('z'); K = NumberField(z^2 - 2,'s'); K Number Field in s with defining polynomial z^2 - 2 sage: K.gens_dict() {'s': s} > if ch=='0': > fiel=NumberField(minpoly,generator) > else: > fiel=fielx.quotient(fielx.ideal(minpoly)) This still doesn't work the right way for finite extension fields: sage: k.<a> = GF(2^8) sage: P.<x,y> = k[] sage: P Multivariate Polynomial Ring in x, y over Finite Field in a of size 2^8 sage: r = P._singular_() sage: coerce_ring_from_singular(r) Multivariate Polynomial Ring in x, y over Univariate Quotient Polynomial Ring in abar over Finite Field of size 2 with modulus a^8 + a^4 + a^3 + a^2 + 1 > R=PolynomialRing(fiel,vars) > return R -- name: Martin Albrecht _pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99 _www: http://www.informatik.uni-bremen.de/~malb _jab: [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---