I need to evaluate the following indefinite integral:


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.

  • $\begingroup$ 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. $\endgroup$
    – cfdlab
    Nov 20, 2019 at 9:44
  • $\begingroup$ 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. $\endgroup$
    – MPIchael
    Nov 20, 2019 at 10:04
  • $\begingroup$ @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. $\endgroup$
    – Richard
    Nov 20, 2019 at 11:34
  • $\begingroup$ @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$. $\endgroup$
    – Richard
    Nov 20, 2019 at 11:43
  • $\begingroup$ I have to apologize, it seems trickier than I thought. $\endgroup$
    – MPIchael
    Nov 20, 2019 at 12:42

1 Answer 1


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").

The above formula must be modified depending on the multiplicity of the roots. The above formula only holds for single roots, ie.e. if all three roots are different.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.