I don't know how to solve this integral 
Could you please help me compute the following integral: $$\int \frac{(x^2+x-4)}{x(x^2+4)}dx$$

What I've done so far is:

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

So

$$x^2+x-4 = A(x^2-4)+Bx$$

And I did this so I could figure out the value of A and B but I am having a rough time trying to calculate A because of the $x^2$.
I've also seen that the solution solves this exercise by separating the fraction's numerator like this:

$$\int \frac{(x^2+x-4)}{x(x^2+4)}dx = \int \frac{x^2}{x(x^2+4)}dx+\int \frac{x}{x(x^2+4)}dx + \int \frac{-4}{x(x^2+4)}dx $$

When do I know that I have to use this? Is what I though correct? If yes, how do I continue it?
Thank you very much. Please, let me know if something is not very clear in my question.
Agapita.
 A: Your partial fraction decomposition should be
$$\frac{x^2+x-4}{x(x^2+4)} = \frac{A}{x}+\frac{Bx+C}{x^2+4}. \tag{1}$$
Multiplying both sides by $x(x^2+4)$ results in
$$x^2+x-4 = (A+B)x^2+Cx+4A. \tag{2}$$
Consequently, $4A=-4 \implies A=-1$, $C=1$ and $A+B = 1 \implies B =2$.
After partial-fraction decomposition, the integral can be computed using standard transformations.
A: What you should do is to find $A$, $B$, and $C$ such that$$\frac1{x(x^2+4)}=\frac Ax+\frac{Bx+C}{x^2+4}.$$
A: To make the finding of partial fractions slightly easier you may care to write
$$\frac{x^2 + x - 4}{x(x^2 + 4)} = \frac{(x^2 + 4) + x - 8}{x(x^2 + 4)} = \frac{1}{x} + \frac{1}{x^2 + 4} - \frac{8}{x(x^2 + 4)},$$
and then it is prehaps easier to guess/see that
$$\frac{8}{x(x^2 + 4)} = \frac{2}{x} + \frac{-2x}{x^2 + 4}.$$
A: Hint:
It must be
$$\dfrac{x^2+x-4}{x(x^2+4)}=\dfrac Ax+\frac{Bx+C}{x^2+4}$$
then
\begin{align*}
x^2+x-4&=A(x^2+4)+(Bx+C)x\\
&=(A+B)x^2+Cx+4A
\end{align*}
A: The partial fractions decomposition is not what you think: it should be
$$\frac{x^2+x-4}{x(x^2+4)}=\frac Ax+\frac{Bx+C}{x^2+4},$$
because the  condition on the numerators is not they're constants, but  they're polynomials with degree less than the degree of the irreducible factor in the denominator. Here the second irreducible factor has degree $2$, so the numerator has degree $<1$.
To find the coefficients, multiply both sides of this equality by $x(x^2+4)$:
$$x^2+x-4=A(x^2+4)+(Bx+C)x.$$
Then set successively 


*

*$x=0$, which yields $\;-4=4A+0$, whence $A=-1$,

*$x=2i$, which results in $\;2i-8= 0-4B+2iC$, whence $B=2$, $C=1.$
Finally the integral becomes
\begin{align}
\int\frac{x^2+x-4}{x(x^2+4)}\,\mathrm dx&=-\int\frac{\mathrm dx}x+\int\frac{2x}{x^2+4}\,\mathrm dx + \int\frac{\mathrm dx}{x^2+4}\\&=-\ln|x|+\ln(x^2+4)+\frac12\,\arctan \frac x2.
\end{align}

