# Stop Apart from automatically simplifying complex rational expressions [duplicate]

I want to conduct partial fraction decomposition to rational function on $$\mathbb C$$ and tried this

PFD[R_, x_] :=
Apart[Numerator[Simplify@R]/
Factor[Denominator[Simplify@R], Extension -> All], x]


Normally it works fine like this

In:=PFD[(2 (-1 + x^2) (6 x - 3))/((1 + x^2)^2 (3 + x^2)^3), x]

Out:=-((3/2 - 3 I)/(-I + x)^2) + (6 + (3 I)/2)/(-I + x) - (
3/2 + 3 I)/(I + x)^2 + (6 - (3 I)/2)/(I + x) - (
Sqrt (I + 2 Sqrt))/(-I Sqrt + x) - (
Sqrt (-I + 2 Sqrt))/(I Sqrt + x)


However, when the denominator has multiple complicated complex roots, Apart will automatically simplify the result

In:=PFD[( x^4 (1 + x^2 + x^4 + x^6))/((-1 + x^2)^4 (1 + x^16)), x]

Out:=2/(-1 + x^2)^4 - 1/(-1 + x^2)^3 - 14/(-1 + x^2)^2 + 43/(
2 (-1 + x^2)) + (
65 + 77 x^2 + 77 x^4 + 65 x^6 + 43 x^8 + 15 x^10 - 15 x^12 -
43 x^14)/(2 (1 + x^16))


rather than leaving the parts of different poles alone. In other cases, it will output a tremendously long expression

In:=PFD[ (x^4) /((-1 + x^2)^4 (1 + x^5)), x]

Out:=(*too long for here*)


but it turns out to be not that long after simplification

In:=FullSimplify /@ % // ToRadicals

Out:=1/(32 (-1 + x)^4) - 1/(64 (-1 + x)^3) - 13/(128 (-1 + x)^2) + 41/(
256 (-1 + x)) + 1/(80 (1 + x)^5) - 3/(160 (1 + x)^3) - 3/(
160 (1 + x)^2) - 1/(6400 (1 + x)) + (
2 (5 I + Sqrt[5 (5 + 2 Sqrt)]))/(
25 (Sqrt[50 - 10 Sqrt] - 5 I (-3 + Sqrt) -
4 Sqrt[5 (5 - 2 Sqrt)] x)) - (-2 + Sqrt)/(
5 (1 + (-1)^(1/5)) (2 - 4 (-1)^(1/5) + (-1)^(2/5) + 2 (-1)^(3/5) +
I Sqrt[5 (5 - 2 Sqrt)] x)) + (
2 (-I (-2 + Sqrt) + 1/Sqrt[85 + 38 Sqrt]))/(
5 (Sqrt[250 - 110 Sqrt] - 5 I (-1 + Sqrt) +
4 Sqrt[5 (5 - 2 Sqrt)] x)) + (5 + Sqrt)/(
25 (5 - Sqrt + (-Sqrt - I Sqrt[5 (5 - 2 Sqrt)]) x))


Question Is there away to stop Apart from simplifying the complex expression and output a nice result efficiently?

In addition, I would be grateful if anyone could that tell me there exist a readily made PFD package.

• is there a reason why you can't just called Apart? as in expr = (2 (-1 + x^2) (6 x - 3))/((1 + x^2)^2 (3 + x^2)^3); Apart[expr, x] gives !Mathematica graphics What is the purpose of your PFD function? Mar 17 at 6:09
• Note the first line. I am trying to factor on complex numbers, that is, the denominator should be of the form $(x-z)^n$ where $z$ is one of its complex root (no quadratic terms in the power). Mar 17 at 9:55
• I originally supposed Apart also has the Extension option but found none. Mar 17 at 9:56
• OK, so why can't you always just use FullSimplify /@ % // ToRadicals afterwords like you showed if this fixes it and gives you the desired simplified output now? I also do not know of method to make it work automatically over complex. Maple does have one such method, but not Mathematica as builtin. Mar 17 at 14:11

ResourceFunction["ExtendedApart"][(x^4)/((-1 + x^2)^4 (1 + x^5)), x]