Integration: Method of partial fractions - Any standard method of finding constants in hard to solve expressions?

I've been computing many indefinite integrals using the method of partial decomposition. The integrals are usual on the form $$\int \frac {x^2-29x+5} {(x-4)^2(x^2+3)} dx$$

which is equal to

$$\int \frac {A} {x-4} + \frac {B} {(x-4)^2} + \frac {Cx+D} {x^2+3}dx$$

and the constants are given by

$$x^2-29x+5=A(x-4)(x^2+3)+B(x^2+3)+(Cx+D)(x-4)^2 = (A+C)x^3+(-4A+B-8C+D)x^2+(3A+16C-8D)x + 12A+ 3B+16D$$

which can be solved using a matrix because no two constants are multiplied, squared or somehow messed up.

Also as I've been reading here: http://mathforum.org/library/drmath/view/51687.html the constants should be unique since the proof is based on polynomial division in a polynomial ring over field $F$, in this case the field is $\mathbb R$.

My question is: so far I have solved for all constants using a matrix. But what if the partial fractions include terms like $$(ax^2+bx+c)^k = \frac {A_1x + B_1} {a^2+bx+c} + .. + \frac {A_kx + B_k} {(ax^2+bx+c)^k}$$ for some very high power of $k$.

Then when multiplying all the denominators together to solve for constants, I will get some expression involving constants that cannot be solved for using a matrix. I know we don't meet these hard to solve tasks in a standard textbook, but they must arise in real.

As stated above, we know there exists values for the constants such that equality holds. However how would you solve these expressions involving constants I'm refering too ? - Is there some standard way ? Should I use some algebra system on my PC, or is there somehow to do it by hand when the power of $k$ is high ?

-
You will always get a linear equation for the constant, which can be solved as a matrix equation. –  martini Nov 30 '13 at 18:38

The partial fraction depends on finding all singular terms. For example, expand about 4: $$\frac{x^{2}-29x+5}{(x-4)^{2}(x^{2}+3)} = \frac{(x-4+4)^{2}-29(x-4+4)+5}{(x-4)^{2}((x-4+4)^{2}+3)}$$ The expansion only needs to be valid for $x$ very close to 4 in order to find all the singular terms. For example, one of the terms ... $$\frac{1}{x^{2}+3}=\frac{1}{(x-4)^{2}+8(x-4)+7}=\frac{1}{7}\frac{1}{1+\frac{1}{7}(x-4)^{2}+\frac{8}{7}(x-4)}$$ can be expanded in a geometric series; only terms up to $(x-4)^{2}$ are needed in this case: $$\frac{1}{7}\left[1-\left[\frac{8}{7}(x-4)+\frac{1}{7}(x-4)^{2}\right]+\left[\frac{8}{7}(x-4)+\frac{1}{7}(x-4)^{2}\right]^{2}-...\right]$$ Yes, it gets messy, but its all explicit if you already know all of the singular points. In this case, the numerator becomes $a(x-4)^{2}+b(x-4)+c$ which you will multiply by the above geometric series expansion of denominator terms, followed by division by $(x-4)^{2}$ in order to find an expansion $$\frac{C}{(x-4)^{2}}+\frac{D}{(x-4)}+E+...$$ The singular terms are all you need if the numerator is of lower degree than the denominator. If not, then you also need a polynomial division to extract a polynomial term, which is the equivalently of a singular term at $\infty$. The process is repeated until you have gathered all singular terms. Then by Liouville's Theorem of Complex Analysis, the following is 0: $$\mbox{original_fraction} - \frac{C}{(x-4)^{2}}-\frac{D}{(x-4)}-\frac{Ex+F}{x^{2}+3} = 0.$$ There are no equations to solve. One has to be able to perform polynomial division with remainder, expand in geometric series in a small neighborhood, multiply polynomials, and gather like terms. These steps are enough, once performed for all factors. In fact, this is how the general partial fractions method is proved. You don't end up with a bunch of equations to solve, and an algorithm can be concocted, if needed.
One can find partial fractions this way: \begin{equation*} f(x)=\frac{x^{2}-29x+5}{(x-4)^{2}(x^{2}+3)}=\frac{A}{(x-4)}+\frac{B}{% (x-4)^{2}}+\frac{Cx+D}{x^{2}+3}. \end{equation*} \begin{equation*} B=\left. (x-4)^{2}f(x)\right] _{x=4}=\left. \frac{x^{2}-29x+5}{(x^{2}+3)}% \right] _{x=4}=-5. \end{equation*} \begin{eqnarray*} Cx+D &=&\left. (x^{2}+3)f(x)\right] _{x^{2}=-3} \\ &=&\left. \frac{x^{2}-29x+5}{x^{2}-8x+16}\right] _{x^{2}=-3} \\ &=&\left. \frac{\left( -3\right) -29x+5}{(-3)-8x+16}\right] _{x^{2}=-3} \\ &=&\left. \frac{-29x+2}{-8x+13}\right] _{x^{2}=-3} \\ &=&\left. \frac{\left( -29x+2\right) \left( 8x+13\right) }{\left( -8x+13\right) \left( 8x+13\right) }\right] _{x^{2}=-3}\ tricky \\ &=&\left. \frac{26-232x^{2}-361x}{169-64x^{2}}\right] _{x^{2}=-3} \\ &=&\frac{26-232(-3)-361x}{169-64(-3)} \\ &=&-x+2. \end{eqnarray*} To find $A$ multiply by $x$ \begin{equation*} xf(x)=A\left( \frac{x}{x-4}\right) +\frac{Bx}{(x-4)^{2}}+\frac{Cx^{2}+Dx}{% x^{2}+3} \end{equation*} then take the limit as $x$ tends to $+\infty$ \begin{eqnarray*} \lim_{x\rightarrow \infty }xf(x) &=&\lim_{x\rightarrow \infty }A\left( \frac{% x}{x-4}\right) +\frac{Bx}{(x-4)^{2}}+\frac{Cx^{2}+Dx}{x^{2}+3} \\ 0 &=&A+0+C \end{eqnarray*} then \begin{equation*} A=-C=1. \end{equation*} Therefore, \begin{equation*} \frac{x^{2}-29x+5}{(x-4)^{2}(x^{2}+3)}=\frac{1}{x-4}-\frac{5}{\left( x-4\right) ^{2}}+\frac{-x+2}{x^{2}+3}. \end{equation*}