Hi,
On 8 December 2014 at 01:05, Paul Royik <[email protected]> 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))
In [1]: from sympy import *
In [2]: var('x')
Out[2]: x
In [3]: factor(x**2 + 1, extension=I)
Out[3]: (x - I)*(x + I)
In [4]: factor(x**4-9*x**2-22, extension=[sqrt(11), sqrt(2), I])
Out[4]: (x - sqrt(11))*(x + sqrt(11))*(x - sqrt(2)*I)*(x + sqrt(2)*I)
Mateusz
> --
> 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/d6ad1def-31a0-4819-89fc-2a57c52f5636%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
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/CAGBZUCYOCNGhT2weJTZuqHKNESikHx0L93Mz9n3cTavd5LN1MA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.