#6496: functions numerator() and denominator() for multivariate polynomials
-------------------------+--------------------------------------------------
 Reporter:  mvngu        |       Owner:  tbd                                    
         
     Type:  enhancement  |      Status:  new                                    
         
 Priority:  major        |   Milestone:  sage-4.1.1                             
         
Component:  algebra      |    Keywords:  numerator, denominator, multivariate 
polynomials
 Reviewer:               |      Author:                                         
         
   Merged:               |  
-------------------------+--------------------------------------------------
 This issue was raised in [http://groups.google.com/group/sage-
 devel/browse_thread/thread/e6fa735733c86635 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):
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6496>
Sage <http://sagemath.org/>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to