On Mon, Jul 6, 2009 at 11:31 PM, mmarco<mma...@unizar.es> wrote: > > Let me give some more details about my question: i have a number field > K, and a ring of polynomials over it, R1. I also have a ring > homomorphism from K to QQbar (which actually makes all sense from a > mathematical point of view), and a ring of polynomials R2 over QQbar. > > All this should give a map from R1 to R2, but when i try to construct > it in sage, i can't: > > sage: alpha=symbolic_expression(x^2+x+1).roots > (ring=QQbar,multiplicities=False) > sage: K.<a>=NumberField(x^2+x+1) > sage: R1.<x,y>=K[] > sage: f=R1(x*y-a*y+x) > sage: H=K.hom([alpha[0]],QQbar) > sage: H(a) > -0.500000000000000? - 0.866025403784439?*I > sage: R2.<x,y>=QQbar[] > sage: H(f) > ERROR: An unexpected error occurred while tokenizing input > The following traceback may be corrupted or invalid > The error message is: ('EOF in multi-line statement', (920, 0)) > > --------------------------------------------------------------------------- > TypeError Traceback (most recent call > last) > > /home/mmarco/<ipython console> in <module>() > > /home/mmarco/sage/local/lib/python2.5/site-packages/sage/categories/ > map.so in sage.categories.map.Map.__call__ (sage/categories/map.c:3227) > () > > TypeError: x*y + x + (-a)*y must be coercible into Number Field in a > with defining polynomial x^2 + x + 1 > sage: R1.hom([x,y],R2) > --------------------------------------------------------------------------- > TypeError Traceback (most recent call > last) > > /home/mmarco/<ipython console> in <module>() > > /home/mmarco/sage/local/lib/python2.5/site-packages/sage/structure/ > parent_gens.so in sage.structure.parent_gens.ParentWithGens.hom (sage/ > structure/parent_gens.c:3785)() > > /home/mmarco/sage/local/lib/python2.5/site-packages/sage/rings/ > homset.pyc in __call__(self, im_gens, check) > 79 return self._coerce_impl(im_gens) > 80 except TypeError: > ---> 81 raise TypeError, "images do not define a valid > homomorphism" > 82 > 83 > > TypeError: images do not define a valid homomorphism > > > Actually, both error messages are correct (H is not defined in R1, and > there is no natural coercion from K to QQbar), but i have not found > any other way to build a homomorphism that involves the variables AND > the base ring.
I think this unfortunately may not be supported at present? What are you going to be doing with the homomorphism? If you're just going to evaluate it, you can probably easily write a standard Python function to do that -- turn the input into a list of coefficients, apply a map, then turn the resulting list back into a polynomial. William --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---