# Help with singular integral

I'm new in Mathematica. I need solve a singular integral like

$$\int_a^b \frac{A_0 + A_1 s + A_2 s^2 + A_3 s^3}{(B_0 + B_2 s^2 + B_4 s^4)(t-s)}ds$$

where $A's$ and $B's$ are reals and $0<a<t<b$. I tried the following command:

Assuming[Element[{A0, A1, A2, A3, B0, B2, B4, s, t, a, b},Reals] && 0<a<t<b,
Integrate[(A0 + A1 s + A2 s^2 + A3 s^3)/(B0 + B2 s^2 + B4 s^4),{s,a,b},
PrincipalValue -> True]]


The program ran for a couple hours and returned no results.Do you have any sugestions?

• your code is missing the (t-s) Oct 21, 2015 at 14:18
• note the integrand may have other singularities at the roots of the quartic. One reason it is taking a long time it is pondering all the permutations of the B's and whether there are roots in the range. (First thing I'd do here is see if you get results with specific numeritc values for the coefficients ) Oct 21, 2015 at 14:40
• Thanks! Just a typo error in this message. In the program the code is correct. Oct 21, 2015 at 23:24

When one is trying to compute such an integral symbolically in the full generality we expect that all symbolic constants appear somewhere in the ultimate result. Of course there might be various issues, e.g. the numerator and denominator could contain one or more identical monomials, then the result should differ significantly on the case by case basis and the full symbolic integral would be quite involved with many ConditionalExpression objects. There is however quite a simple approach: we just write down a function calculating the integral for various constants.

int[A0_, A1_, A2_, A3_, B0_, B2_, B4_, a_, b_, t_] :=
Integrate[(A0 + A1 s + A2 s^2 + A3 s^3)/((t - s) (B0 + B2 s^2 + B4 s^4)),
{s, a, b},
Assumptions ->
Element[{A0, A1, A2, A3, B0, B2, B4, t, a, b}, Reals] &&
0 < a < t < b,
PrincipalValue -> True]


I recommend some experimenting then what happens when we impose symbolic constants. It will appear reasonable why it takes so much time in purely symolic form. Nevertheless there is no problem with given constants, e.g.:

int[1, -1, 3, 1, 1, -1, 1, 1/2, 1, 3/4]

 1/193 (-RootSum[193 + 12 #1 + 38 #1^2 + 12 #1^3 + #1^4 &,
(1/(3 + 19 #1 + 9 #1^2 + #1^3))(-14207 Log[-1 - #1]
+ 1685 Log[-1 - #1] #1 + 1619 Log[-1 - #1] #1^2
+ 151 Log[-1 - #1] #1^3) &] +
RootSum[193 + 12 #1 + 38 #1^2 + 12 #1^3 + #1^4 &,
(-14207 Log[1 - #1] + 1685 Log[1 - #1] #1 + 1619 Log[1 - #1] #1^2
+ 151 Log[1 - #1] #1^3)/(3 + 19 #1 + 9 #1^2 + #1^3) &])


Calculating the integral with few a symbolic constants still provides the result (a bit involved though) however takes a few minutes, try e.g.

int[1, A1, 3, A3, 2, -1, 1, 1, 2, 3/2]


What about trying indefinite integral and then plugging the limits? In this way you should have to apply $a, b$ conditions after:

res = Assuming[Element[{A0, A1, A2, A3, B0, B2, B4, s, t}, Reals],
Integrate[(A0 + A1 s + A2 s^2 + A3 s^3)/(B0 + B2 s^2 + B4 s^4), s,
PrincipalValue -> True]];

Assuming[0 < a < t < b,
FullSimplify[Refine[(res /. s -> b) - (res /. s -> a)]]] //

$\frac{\log \left(-2 a^2 \text{B4}+\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}-\text{B2}\right) \left(\text{A3} \left(\text{B2}-\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}\right)-2 \text{A1} \text{B4}\right)-\log \left(2 a^2 \text{B4}+\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}+\text{B2}\right) \left(\text{A3} \left(\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}+\text{B2}\right)-2 \text{A1} \text{B4}\right)-\frac{2 \sqrt{2} \sqrt{\text{B4}} \tan ^{-1}\left(\frac{\sqrt{2} a \sqrt{\text{B4}}}{\sqrt{\text{B2}-\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}}}\right) \left(2 \text{A0} \text{B4}+\text{A2} \left(\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}-\text{B2}\right)\right)}{\sqrt{\text{B2}-\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}}}-\frac{2 \sqrt{2} \sqrt{\text{B4}} \tan ^{-1}\left(\frac{\sqrt{2} a \sqrt{\text{B4}}}{\sqrt{\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}+\text{B2}}}\right) \left(\text{A2} \left(\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}+\text{B2}\right)-2 \text{A0} \text{B4}\right)}{\sqrt{\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}+\text{B2}}}+\frac{2 \sqrt{2} \sqrt{\text{B4}} \left(2 \text{A0} \text{B4}+\text{A2} \left(\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}-\text{B2}\right)\right) \tan ^{-1}\left(\frac{\sqrt{2} b \sqrt{\text{B4}}}{\sqrt{\text{B2}-\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}}}\right)}{\sqrt{\text{B2}-\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}}}+\frac{2 \sqrt{2} \sqrt{\text{B4}} \left(\text{A2} \left(\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}+\text{B2}\right)-2 \text{A0} \text{B4}\right) \tan ^{-1}\left(\frac{\sqrt{2} b \sqrt{\text{B4}}}{\sqrt{\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}+\text{B2}}}\right)}{\sqrt{\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}+\text{B2}}}+\left(2 \text{A1} \text{B4}+\text{A3} \left(\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}-\text{B2}\right)\right) \log \left(-2 b^2 \text{B4}+\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}-\text{B2}\right)+\left(\text{A3} \left(\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}+\text{B2}\right)-2 \text{A1} \text{B4}\right) \log \left(2 b^2 \text{B4}+\sqrt{\text{B2}^2-4 \text{B0} \text{B4}}+\text{B2}\right)}{4 \text{B4} \sqrt{\text{B2}^2-4 \text{B0} \text{B4}}}$