factor over complex numbers?



On Jan 27, 2008 5:29 PM, Nikos Apostolakis <nikos.ap at gmail.com> wrote:

> factor(expr1, i^2+1);...and then you can do subst(i=%i, %); to get
> (x-%i)^5*(x+%i)^5
>

For this case, you can just use gfactor.

factor(x^2-20, a^2-5); ==> (x-2*a)*(x+2*a)
> factor(x^2-20, x^2-5); ==> -3*5
>
> BTW, is the last result a bug?
>

Well, yes and no. Since x^2-5 == 0, x^2-20 == -15, and factor(-15) = -3*5,
it is mathematically correct.
That said, factoring over the integers is only supposed to happen when the
argument is an integer, and the (intentionally) unsimplified form -3*5 can
confuse other calculations.

So it is a bug, though I'd say a minor one.

                 -s