# Partial fraction expansion with complex numbers

$$\text{Apart}\left[\frac{1}{x^4+1}\right]$$

Does nothing. How can I get it to expand it. Sometimes it is useful.

• See this question: 68824. Jun 22, 2015 at 17:47
• @Mahdi $$\text{Apart}\left[\text{Factor}\left[\frac{1}{x^4+1},\text{Extension}\to i\right]\right]$$ gives only $$\frac{i}{2 \left(x^2+i\right)}-\frac{i}{2 \left(x^2-i\right)}$$ and $$\text{Apart}\left[\text{Factor}\left[\frac{1}{x^4+2},\text{Extension}\to i\right]\right]$$ straight up does not work Jun 22, 2015 at 17:56
• What is expected result for the first one? For the second one: Apart@Factor[1/(1 + x^2), Extension -> {(-1)^(1/2), I}]? Jun 22, 2015 at 18:05
• Your question is a partial case of the Mittag-Leffler's theorem for the expansion of meromorphic functions. There is a nice demo here. Sep 27, 2020 at 15:47
• Does this answer your question? Apart for complex roots? May 25, 2022 at 15:46

I found by trial and error that Extension-> Sqrt[I] does the job.

ExpToTrig[Apart[Factor[1/(1 + x^4), Extension -> Sqrt[I]]]]

$$\frac{\frac{1}{4}+\frac{i}{4}}{\sqrt{2} \left(-x+\frac{1+i}{\sqrt{2}}\right)}+\frac{\frac{1}{4}+\frac{i}{4}}{\sqrt{2} \left(x+\frac{1+i}{\sqrt{2}}\right)}-\frac{\frac{1}{4}-\frac{i}{4}}{\sqrt{2} \left(-x-\frac{1-i}{\sqrt{2}}\right)}-\frac{\frac{1}{4}-\frac{i}{4}}{\sqrt{2} \left(x-\frac{1-i}{\sqrt{2}}\right)}$$

Here ExpToTrig is not really required but it does the final beautifying.

• would there be any way to do something like: ExpToTrig[ Apart[Factor[1/(1 + x^4), Extension -> Roots[1 + x^4 == 0, x]]]] Jun 22, 2015 at 18:27
• @grdgfgr How about ExpToTrig[Apart[Factor[1/(1 + x^4), Extension -> (x /. Solve[1 + x^4 == 0, x])]]]? Jun 22, 2015 at 18:36
• @ kirma : that seems to be the general rule setting the Extension to the roots of the polynomial in question. From Help: Extension is an option for various polynomial and algebraic functions that specifies generators for the algebraic number field to be used. Jun 22, 2015 at 19:43
• @GappyHilmore Apart[Factor[1/(1 + x^4), Extension -> All]] works and so does Apart[Factor[1/(2 + x^4), Extension -> All]] (in V13 but maybe it didn't back then). May 5, 2022 at 13:37

There's an internal function:

Integrate`ComplexApart[1/(1 + x^4), x]
(*
-((-1)^(1/4)/(4 (-(-1)^(1/4) + x))) +
(-1)^(1/4)/(4 ((-1)^(1/4) + x)) -
(-1)^(3/4)/(4 (-(-1)^(3/4) + x)) +
(-1)^(3/4)/(4 ((-1)^(3/4) + x))
*)
• fyi, in Maple they have 2 functions. parfrac and fullparfrac for using complex domain. screen shot !Mathematica graphics It looks like fullparfrac is like ComplexApart you show. May 5, 2022 at 8:13
• @Nasser With so many top-level (System) functions in Mathematica, you would think ComplexApart would be among them. May 5, 2022 at 13:33