This issue was raised in sage-devel:
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'
The person who reported the bug also attached a patch to fix this:
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):
Component: algebra
Keywords: numerator, denominator, multivariate polynomials
Author: Luis Felipe Tabera
Reviewer: Robert Bradshaw, Florent Hivert
Merged: sage-4.3.alpha1
Issue created by migration from https://trac.sagemath.org/ticket/6496
This issue was raised in sage-devel:
The person who reported the bug also attached a patch to fix this:
Component: algebra
Keywords: numerator, denominator, multivariate polynomials
Author: Luis Felipe Tabera
Reviewer: Robert Bradshaw, Florent Hivert
Merged: sage-4.3.alpha1
Issue created by migration from https://trac.sagemath.org/ticket/6496