If you don't know what extension to use you can just rebuild the expression from the roots:
>>> efactor = lambda e: Mul(*[(x - r)**m for r,m in roots(e).items()]).subs( ... x,e.free_symbols.pop()) >>> efactor(y**6 - 20*y**4 + 77*y**2 + 242) (y - sqrt(11))**2*(y + sqrt(11))**2*(y - sqrt(2)*I)*(y + sqrt(2)*I) On Sunday, December 7, 2014 6:05:08 PM UTC-6, Paul Royik wrote: > > How should I use factor to factor expression over irrational numbers? > > For example, > x^2-4 produces (x-2)(x+2) > x^2-2 produces (x-sqrt(2))(x+sqrt(2)) > x^4+1 produces (x^2-sqrt(2) x+1) (x^2+sqrt(2) x+1) > x^2+1 produces x^2+1 (only complex roots) > x^4-9 x^2-22 produces (x^2+2)(x-sqrt(11))(x+sqrt(11)) > -- You received this message because you are subscribed to the Google Groups "sympy" 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 http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/660591ec-29b8-412e-9423-b2b1ab9a7257%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
