Hi, Some days ago I sent a bug report using the notebook link to the google docs form. I am unable to find that bug report on the web.
Anyway as the thing is trivial I wrote a patch myself. The problem is that multivariate polynomials do not admit numerator and denominator sage: K.<x,y>=QQ['x,y'] sage: f=x+y sage: numerator(f) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home/luisfe/.sage/temp/mychabol/5681/ _home_luisfe__sage_init_sage_0.py in <module>() /opt/SAGE/sage/local/lib/python2.5/site-packages/sage/misc/ functional.pyc in numerator(x) 686 if isinstance(x, (int, long)): 687 return x --> 688 return x.numerator() 689 690 def numerical_approx(x, prec=None, digits=None): AttributeError: 'sage.rings.polynomial.multi_polynomial_libsingular' object has no attribute 'numerator' Although numerator and denominator are expectoed for rational functions only they might be needed, once would like to write an algorithm valid for both polynomials and rational functions, for example the following code in the same session: sage: g=y sage: h=1-y sage: (f/(g)).numerator() x + y sage: (f/(g+h)).denominator() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home/luisfe/.sage/temp/mychabol/5681/ _home_luisfe__sage_init_sage_0.py in <module>() AttributeError: 'sage.rings.polynomial.multi_polynomial_libsingular' object has no attribute 'denominator' In the first case, the fraction is created and the numerator has a meaning. In the second the fraction is never created and the code fails. I have writen a trivial patch for the class MPolynomial. I am not sure if denominator should return 1 or self.parent(one) I write 1 because it seems inoffensive to me diff -r 2e793d2a0e12 sage/rings/polynomial/multi_polynomial.pyx --- a/sage/rings/polynomial/multi_polynomial.pyx Thu Jun 18 23:52:34 2009 -0700 +++ b/sage/rings/polynomial/multi_polynomial.pyx Thu Jul 09 00:05:29 2009 -0700 @@ -980,6 +980,28 @@ from sage.structure.factorization import Factorization return Factorization(v, unit) + def numerator(self): + """ + Numerator of a polynomial + + EXAMPLES: + sage: K.<x,y> = QQ['x,y'] + sage: f = x + y + sage: f.numerator() + x + y + """ + return self + + def denominator(self): + """ + Denominator of a polynomial + EXAMPLES: + sage: K.<x,y> = QQ['x,y'] + sage: f = x + y + sage: f.denominator() + 1 + """ + return 1 cdef remove_from_tuple(e, int ind): --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---