Skip to content Skip to sidebar Skip to footer

Full Factorization Of Polynomials Over Complexes With Sympy

I want to fully factorize a polynom, thus factorize it over complexes. SymPy provide factor to do it, but I’m very surprised that factorization is done only over integer roots, e

Solution 1:

The domain argument should work and in the case of Gaussian rationals you can also use gaussian=True which is equivalent to extension=I:

In [24]: factor(z**2 + 1, gaussian=True)
Out[24]: (z - ⅈ)⋅(z + ⅈ)

That doesn't work in your case though because the factorisation needs to be over QQ(I, sqrt(2)) rather than QQ(I). The reason that domains 'R' and 'C' don't work as expected is because they are inexact floating point domains rather than domains representing the real or complex numbers in the pure mathematical sense and factorisation is

The approaches above can be combined though with

In [28]: e = z**2 + 2

In [29]: factor(e, extension=roots(e))
Out[29]: (z - √2⋅ⅈ)⋅(z + √2⋅ⅈ)

Post a Comment for "Full Factorization Of Polynomials Over Complexes With Sympy"