# Tips for Complicated Indefinite Integrals

I would like to have an analytical expression for some complicated indefinite integrals (example below). I am able to solve these integrals numerically, and I am able to plot them in Mathematica, however I don't know how to obtain an analytical expression for them.

1) Is it possible to evaluate the indefinite integral in the example below?

2) Is it possible to tell whether Mathematica is timing out, or if the integral simply cannot be done analytically? What does it mean when Mathematica spits back the unevaluated integral still with an integral sign?

3) More generally, are there any tips or tricks to successfully obtaining a result, or to speed up the calculation/stop it from timing out? I am thinking along the lines of: specifying assumptions, time constraints, rewriting special functions, Pade approximations, Taylor expansions, polynomial fits, etc.

Any help would be greatly appreciated :-)

Eii1[R_, ri_,
ae_] = -(1/(32 ae^6 (1 + E^(ri/ae))^4 \[Pi] R ri^3))
a0^2 (-E^((ri/ae))
ri (-4 ae (-1 + E^(ri/ae) + 2 E^((2 ri)/ae)) + (1 -
8 E^(ri/ae) + 3 E^((2 ri)/ae)) ri) +
32 ae^3 DiracDelta[ri]) ((4 ae E^(R/ae) (R - ri))/(
E^(R/ae) + E^(ri/ae)) - 4 R ri - 4 ae Sqrt[R^2 + ri^2] + (
4 ae (1 + E^((R + ri)/ae)) R^2 -
4 ae E^((R + ri)/ae) R Sqrt[R^2 + ri^2] +
4 ae ri (ri + E^((R + ri)/ae) ri -
E^((R + ri)/ae) Sqrt[R^2 + ri^2]))/((1 + E^((R + ri)/
ae)) Sqrt[R^2 + ri^2]) -
2 ae (R - ri) Log[1 + E^((R - ri)/ae)] +
2 ae (R + ri) Log[1 + E^((R + ri)/ae)] -
2 ae^2 PolyLog[2, -E^(((R - ri)/ae))] +
2 ae^2 PolyLog[2, -E^(((R + ri)/ae))]);

indefiniteEii1[R_, ri_, ae_] =
Integrate[Eii1[R, ri, ae] 2 \[Pi] ri^2, ri];

definiteEii1[R_, ae_] =
Integrate[Eii1[R, ri, ae] 2 \[Pi] ri^2, {ri, 0, \[Infinity]}];

Plot[(Eii1[1, ri, 1]/a0^2) 2 \[Pi] ri^2, {ri, 0, 50},
PlotRange -> Full]


• Yes that's correct, as far as I know ri should be integrated out. – Bart Sep 12 '18 at 7:49
• Thank you - I have corrected this now – Bart Sep 12 '18 at 7:54

What does it mean when Mathematica spits back the unevaluated integral still with an integral sign?

That is Mathematica's way of telling you that she cannot find an analytical expression for the indefinite integral. Notice also the error message Integrate::idiv which states that the definite integral you request does not exist.

Is it possible to evaluate the indefinite integral in the example below?

Sometimes, giving additional Assumptions helps...

And Albert Rich's Mathematica packages Rubi often finds indefinite integrals where Mathematica alobe has to resign... No, I've just checked it. It cannot. But Rubi may still serve as an answer for your follow-up question:

More generally, are there any tips or tricks to successfully obtaining a result, or to speed up the calculation/stop it from timing out?

Btw.: You know that there are indefinite integrals that cannot be written down in closed-form, don't you?

• Thank you for the helpful comments! So from what you've said, I assume Mathematica never "times out" when trying to evaluate integrals? It will always keep trying until it has exhausted all of its techniques and then it will return the unevaluated integral? Also, I have tried running the definite integral overnight but I still don't get any error messages or answers... If it does yield Integrate::idiv, it would be really useful to know how you got that. So assumptions just speed up the integration? Or can they sometimes make impossible integrals possible? Thank you for the Rubi link :-) – Bart Sep 12 '18 at 8:00
• I know that only some indefinite integrals can be written in closed form. That is what I implicitly meant when I said "possible to evaluate". – Bart Sep 12 '18 at 8:03
• I have also discovered the new AsymptoticIntegrate function, which may come in useful to me in the future... – Bart Sep 12 '18 at 8:05