#21067: Symbolic factor_list() should do integer factorisation of
integers/rationals
-------------------------------------+-------------------------------------
       Reporter:  rws                |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-7.3
      Component:  symbolics          |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Ralf Stephan       |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  
u/rws/symbolic_factor___should_do_integer_factorisation_of_integers_rationals|  
eca869e3fa641f8d8f6e4a4ed4fe47ec6745cde2
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by vdelecroix):

 Instead of having a special check and a special method for
 integer/rationals couldn't we use something simpler and more generic like
 {{{#!python
 def _factorization_from_pyobject(self):
     try:
         a = self.pyobject()
     except TypeError:
         return

     try:
         f = a.factor()
     except (AttributeError, NotImplementedError):
         return

     # from here I assume that a is a Sage object which might not be the
 case...
     P = self.parent()
     facs = [(P(p), P(e)) for p,e in f]
     if f.unit().is_one():
         return facs
     else:
         return [(P(f.unit()), P(1))] + facs
 }}}

--
Ticket URL: <https://trac.sagemath.org/ticket/21067#comment:7>
Sage <http://www.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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to