On Thursday 19 March 2009, David Madore wrote: > Dear List, > > I'm trying to do some algebraic geometrical / arithmetical computation > with Sage and I find myself stuck on the following dumb problem: if I > have an ideal J of a quotient ring R/I (where R is a polynomial ring > and I some ideal of it), I wish to construct the ideal of R (called > p^{-1}(J) or perhaps even simply I+J) which is obtained by pulling > back J by the canonical map p:R->R/I. This presents no algorithmic > difficulty, since I is given by generators (in R), and J is also given > by generators (in R/I, but they are themselves represented by elements > of R) and it is just a question of taking the union of these lists of > generators (seeing those of J in R/I as arbitrary representatives in > R) to obtain the desired idea. Unfortunately, this doesn't seem to > work (probably because Sage doesn't know how to handle the canonical > surjection specially?): > > vega david /usr/local/src/sage-3.4 $ ./sage > ---------------------------------------------------------------------- > > | Sage Version 3.4, Release Date: 2009-03-11 | > | Type notebook() for the GUI, and license() for information. | > > ---------------------------------------------------------------------- > sage: R.<x,y> = QQ['x','y'] > sage: I = Ideal(y^2 - x^3 - x) > sage: Rq = R.quotient(I) > sage: p = R.hom(Rq) > sage: J = Ideal(p(y)-1) > sage: J > Ideal (ybar - 1) of Quotient of Multivariate Polynomial Ring in x, y over > Rational Field by the ideal (-x^3 + y^2 - x) sage: p.inverse_image(J) > --------------------------------------------------------------------------- > NotImplementedError Traceback (most recent call last) > > /usr/src/local/sage-3.4/<ipython console> in <module>() > > /usr/src/local/sage-3.4/local/lib/python2.5/site-packages/sage/rings/morphi >sm.so in sage.rings.morphism.RingHomomorphism.inverse_image > (sage/rings/morphism.c:3480)() > > NotImplementedError: > sage: whatiwantedwasthis = I + Ideal(y-1) > sage: whatiwantedwasthis > Ideal (-x^3 + y^2 - x, y - 1) of Multivariate Polynomial Ring in x, y over > Rational Field sage: p(whatiwantedwasthis) > Ideal (0, ybar - 1) of Quotient of Multivariate Polynomial Ring in x, y > over Rational Field by the ideal (-x^3 + y^2 - x) sage: > p(whatiwantedwasthis) == J > True > > By comparison, Macaulay2 does this: > > vega david ~ $ /opt/Macaulay2-1.2-r8438/bin/M2 > Macaulay 2, version 1.2 > with packages: Elimination, IntegralClosure, LLLBases, > PrimaryDecomposition, ReesAlgebra, SchurRings, TangentCone > > i1 : R = QQ[x,y] > > o1 = R > > o1 : PolynomialRing > > i2 : I = ideal(y^2-x^3-x) > > 3 2 > o2 = ideal(- x + y - x) > > o2 : Ideal of R > > i3 : Rq = R/I > > o3 = Rq > > o3 : QuotientRing > > i4 : p = map(Rq,R,matrix{{x,y}}) > > o4 = map(Rq,R,{x, y}) > > o4 : RingMap Rq <--- R > > i5 : J = ideal(y-1) > > o5 = ideal(y - 1) > > o5 : Ideal of Rq > > i6 : preimage(p,J) > > 3 > o6 = ideal (y - 1, x + x - 1) > > o6 : Ideal of R > > i7 : use R; whatiwantedwasthis = I + ideal(y-1) > > 3 2 > o8 = ideal (- x + y - x, y - 1) > > o8 : Ideal of R > > i9 : o6 == whatiwantedwasthis > > o9 = true > > i10 : p(whatiwantedwasthis) > > o10 = ideal (0, y - 1) > > o10 : Ideal of Rq > > i11 : p(whatiwantedwasthis) == J > > o11 = true > > (Unfortunately, I can't do my computations in Macaulay2 because I need > polynomial rings over number fields - the above example is in Q - and > it can't handle them.) > > So, is there a way in Sage to pull back an ideal by a canonical map?
Quotient rings are in a particularly bad shape in Sage, here's a hack: sage: R.<x,y> = QQ['x','y'] sage: I = Ideal(y^2 - x^3 - x) sage: Q = R.quotient(I) sage: p = R.hom(Q) sage: J = Ideal(p(y)-1) sage: J Ideal (ybar - 1) of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (-x^3 + y^2 - x) sage: I2 = Ideal([f._QuotientRingElement__rep for f in J.gens()]) + I sage: I2 Ideal (y - 1, -x^3 + y^2 - x) of Multivariate Polynomial Ring in x, y over Rational Field sage: I2.groebner_basis() [x^3 + x - 1, y - 1] that should be what you want. However, f._QuotientRingElement__rep is quite evil because it uses the internal representation. I'd actually give it a shot to implement the NotImplementedError above but I'm unsure where the implementation belongs: Not sure whether I should just patch RingHomomorphism_coercion:add a bunch of type checks and then do something like the above if they pass and raise NotImplementedError otherwise? Cheers, Martin -- name: Martin Albrecht _pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99 _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF _www: http://www.informatik.uni-bremen.de/~malb _jab: martinralbre...@jabber.ccc.de --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---