<s>[INST] $1/(x^6 + 1)$ partial fraction decomposition, with computer? This is a re-post from StackOverflow, I was advised to post it here.
https://stackoverflow.com/questions/64101194/partial-fraction-decomposition
How do I find the constants A,B,C,D,K,S such that
$$
\frac{1}{x^6+1} = \frac{Ax+B}{x^2+1} + \frac{Cx+D}{x^2-\sqrt 3 x+1} + \frac{Kx+S}{x^2+\sqrt 3 x+1}
$$
is true for every real x.
I need some sympy code maybe, not sure. Or... any other Python lib which could help here.
I tried by hand but it's not easy at all... and after 1 hour of calculating, I found that I have probably made some mistake.
I tried partial fraction decomposition in SymPy but it does not go that far.
I tried Wolfram Alpha too, but it also does not decompose to that level of detail, it seems.
WA attempt
See the alternate forms which WA gives below.
EDIT:
I did a second try entirely by hand and I got these:
\begin{align}A &= 0,\\
B &= \frac13,\\
C &= -\frac1{2\sqrt3},\\
D &= \frac13,\\
K &= \frac1{2\sqrt3},\\
S &= \frac13.
\end{align}
Could someone verify if these are correct?
And in general... how can I automate this task via SymPy or WA?
 [/INST] What you got is indeed correct since we have $$
 \frac{1}{3}\frac{1}{x^2+1} + \frac{-\frac{x}{2\sqrt{3}}+\frac{1}{3}}{x^2-\sqrt 3 x+1} + \frac{\frac{x}{2\sqrt{3}}+\frac{1}{3}}{x^2+\sqrt 3 x+1}
$$
$$=\frac{1}{3}\frac{1}{x^2+1}+\frac{2-x^2}{3(x^2-\sqrt{3}x+1)(x^2+\sqrt{3}+1)}$$
$$=\frac{1}{3}\frac{1}{x^2+1}+\frac{2-x^2}{3(x^4-x^2+1)}$$
$$=\frac{1}{3}\big[\frac{x^4-x^2+1+(2-x^2)(x^2+1)}{(x^2+1)(x^4-x^2+1)}\big]$$
$$=\frac{1}{3}\frac{3}{x^6+1}=\frac{1}{x^6+1}.$$
WA also agrees.
</s>