Carl Witty wrote : > > > > For instance: > > R.<a,b> = NumberField(x^2-3,'g')[] > > S.<y> = R.fraction_field()[] > > xgcd(y^2, a*y+b) > > > > returns the error: (more below) > > <type 'exceptions.TypeError'>: unsupported operand type(s) for %: > > 'sage.rings.number_field.number_field_element_quadratic.NumberFieldElement_quadratic' > > and > > 'sage.rings.number_field.number_field_element_quadratic.NumberFieldElement_quadratic' > > This should work, but doesn't due to a bug (well, perhaps you could > call it a missing feature instead). I've posted a patch here, > http://trac.sagemath.org/sage_trac/ticket/3327 so this will work in > some future version of Sage (likely the next version, assuming that > somebody positively reviews my patch).
Thank you so much. The patch is indeed working fine. I still have issues when involving a tower of number fields, though. That is, the following code: R.<a,b> = NumberField(x^2-3,'g').extension(x^2-7,'h')[] h = R.base_ring().gen() S.<y> = R.fraction_field()[] xgcd(y^2, a*h*y+b) raises the error: NameError: name 'h' is not defined Note, however, that when the first line is replaced by: R.<a,b> = NumberField(x^2-3,'h')[] computations run flawlessly and SAGE outputs the result: (b^2/(3*a^2), 1, ((-1)/(h*a))*y + b/(3*a^2)) Do I have to define 'h' in a more "robust" way to avoid that or is this unrelated to the way it's defined? Thanks again, --Gaetan --------------------------------------------------------------------------- NameError Traceback (most recent call last) /users/cacao/bissogae/<ipython console> in <module>() /usr/local/sage-3.0.2/sage/local/lib/python2.5/site-packages/sage/rings/arith.py in xgcd(a, b) 1243 """ 1244 try: -> 1245 return a.xgcd(b) 1246 except AttributeError: 1247 pass /users/cacao/bissogae/element.pyx in sage.structure.element.PrincipalIdealDomainElement.xgcd (sage/structure/element.c:11861)() /users/cacao/bissogae/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial._xgcd (sage/rings/polynomial/polynomial_element.c:23441)() /localdisk/tmp/sage-3.0.2/local/lib/python2.5/site-packages/sage/rings/polynomial/polynomial_element_generic.py in quo_rem(self, other) /users/cacao/bissogae/element.pyx in sage.structure.element.RingElement.__mul__ (sage/structure/element.c:8544)() /users/cacao/bissogae/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/structure/coerce.c:5027)() /users/cacao/bissogae/action.pyx in sage.categories.action.Action._call_c (sage/categories/action.c:1682)() /users/cacao/bissogae/coerce.pyx in sage.structure.coerce.LeftModuleAction._call_c_impl (sage/structure/coerce.c:12298)() /users/cacao/bissogae/coerce.pxi in sage.structure.coerce._rmul_c (sage/structure/coerce.c:2411)() /users/cacao/bissogae/element.pyx in sage.structure.element.ModuleElement._rmul_ (sage/structure/element.c:6770)() /users/cacao/bissogae/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial_generic_dense._rmul_c_impl (sage/rings/polynomial/polynomial_element.c:28474)() /users/cacao/bissogae/element.pyx in sage.structure.element.RingElement.__mul__ (sage/structure/element.c:8527)() /users/cacao/bissogae/coerce.pxi in sage.structure.element._mul_c (sage/structure/element.c:16109)() /localdisk/tmp/sage-3.0.2/local/lib/python2.5/site-packages/sage/rings/fraction_field_element.py in _mul_(self, right) /localdisk/tmp/sage-3.0.2/local/lib/python2.5/site-packages/sage/rings/fraction_field_element.py in __init__(self, parent, numerator, denominator, coerce, reduce) /localdisk/tmp/sage-3.0.2/local/lib/python2.5/site-packages/sage/rings/fraction_field_element.py in reduce(self) /localdisk/tmp/sage-3.0.2/local/lib/python2.5/site-packages/sage/rings/polynomial/multi_polynomial_element.py in quo_rem(self, right) /localdisk/tmp/sage-3.0.2/local/lib/python2.5/site-packages/sage/rings/polynomial/multi_polynomial_ring.py in __call__(self, x, check) /localdisk/tmp/sage-3.0.2/local/lib/python2.5/site-packages/sage/interfaces/singular.py in sage_poly(self, R, kcache) /localdisk/tmp/sage-3.0.2/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py in __call__(self, x) /localdisk/tmp/sage-3.0.2/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py in __call__(self, x) /localdisk/tmp/sage-3.0.2/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py in _coerce_from_str(self, x) /localdisk/tmp/sage-3.0.2/local/lib/python2.5/site-packages/sage/misc/sage_eval.py in sage_eval(source, locals) /users/cacao/bissogae/<string> in <module>() NameError: name 'h' is not defined --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---