# Evaluating an indefinite integral that has no closed form

I need to evaluate the following indefinite integral:

$$I=\int\frac{x^5+2ax^3+a^2x-4a}{x^7+ax^5+2ax^4}dx=\int\frac{x^5+2ax^3+a^2x-4a}{x^4(x^3+ax+2a)}dx$$

The solution that I obtained while evaluating the integral in SageMath is $$\frac{{\left(a^{2} + 10a + 8\right)} \log\left(x\right)}{8a} - \frac{\int \frac{a^{3} + {\left(a^{2} + 10a + 8\right)} x^{2} + 14a^{2} - 2{\left(a^{2} + 6a\right)} x + 16a}{x^{3} + a x + 2a}{d x}}{8a} + \frac{3{\left(a + 2\right)} x^{2} - 3{\left(a + 2\right)} x + 8}{12x^{3}}$$ where the solution contains an expression that contains an integral itself. According to the manual of SageMath, this happens when an integral has no closed form.

Question: Is it possible to deal with the integral in SageMath in some other way?

Question: Are there any other techniques or any approximation method to deal with the integral? I am thinking whether the integral can be solved by quadratures.

• If you can factorise the integrand as $a_0/x^4 + a_1/(x-c_1) + a_2/(x-c_2) + a_3/(x-c_3)$ where $c_1,c_2,c_3$ are roots of the cubic polynomial in the denominator, you may be able to calculate the integral. – cfdlab Nov 20 '19 at 9:44
• I would also presume that the integral has an analytical solution, and no numericla treatment is necessary. Have you tried rewriting it? I would try to separate the integral into the four expressions of the numerator, and then dig into the partial integration. You might also feed the sub-problems to your CAS and see if it can handle them. – MPIchael Nov 20 '19 at 10:04
• @MPIchael I tried to solve the integration considering single terms in the numerator, but the problem is with the cubic term in the denominator. Even the integral $\int\frac{dx}{x^3+ax+2a}$ is not returning any value. – Richard Nov 20 '19 at 11:34
• @cpraveen In general, it is not possible to factorize the cubic polynomial in the denominator of the integrand. It seems to be possible only in some special cases (like when $a=1$). In my calculation, however, $a$ is a parameter that can take any values between $0$ and $1$. – Richard Nov 20 '19 at 11:43
• I have to apologize, it seems trickier than I thought. – MPIchael Nov 20 '19 at 12:42

This integral has a closed analytic solution. The trick is to write $$\frac{1}{x^3+ ax + 2a} = \frac{A}{x-x_1} + \frac{B}{x-x_2} + \frac{C}{x-x_3}$$ by a method called partial fraction decomposition. The values $$x_i$$ are the roots of the polynomial in the denominator. As your polynomial only has third degree, an analytic formula for the roots exists (aka "Cardano Formula").