Hi Andy, On Tue, Feb 22, 2011 at 3:28 AM, andyl <[email protected]> wrote: > Hi > > I have been trying out sympy, working through the examples in the > documentation. All went well, and was impressive, until I tried to > factor polynomials. The example in the documentation was > > f = 4*x**4 + 8*x**3 + 77*x**2 + 18*x + 153 > > and factor(f) gave (9 + 4*x**2)*(17 + 2*x + x**2) as expected. > > But then factor(f, gaussian=True) or factor(f, extension=I) should > give according the documentation: > > 4*(x - 3*I/2)*(x + 3*I/2)*(x - 4*I + 1)*(x + 4*I + 1) > > Instead I get the same result as before, ie (9 + 4*x**2)*(17 + 2*x + > x**2) > > I then backed up a bit and tried the first example > > factor(6*x - 10) > > The documentation says this gives 2⋅(3⋅x - 5). Instead it returned > -10 + 6*x. > > What am I doing wrong? I am using v0.6.7, installed via > easy_install. I have tried importing sympy into regular python (2.6), > and also using isympy, and the results are the same. > > Any advice will be most welcome!
I tried the latest git and got: >>> f = 4*x**4 + 8*x**3 + 77*x**2 + 18*x + 153 >>> factor(f) ⎛ 2⎞ ⎛ 2⎞ ⎝9 + 4⋅x ⎠⋅⎝17 + 2⋅x + x ⎠ >>> factor(f, gaussian=True) ⎛ 3⋅ⅈ⎞ ⎛ 3⋅ⅈ⎞ 4⋅⎜x + ───⎟⋅⎜x - ───⎟⋅(1 + x - 4⋅ⅈ)⋅(1 + x + 4⋅ⅈ) ⎝ 2 ⎠ ⎝ 2 ⎠ >>> factor(f, extension=I) ⎛ 3⋅ⅈ⎞ ⎛ 3⋅ⅈ⎞ 4⋅⎜x + ───⎟⋅⎜x - ───⎟⋅(1 + x - 4⋅ⅈ)⋅(1 + x + 4⋅ⅈ) ⎝ 2 ⎠ ⎝ 2 ⎠ So probably it doesn't work in your version, but it was fixed (or added?) later. Ondrej -- You received this message because you are subscribed to the Google Groups "sympy" 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/sympy?hl=en.
