I am considering the following integral
\begin{equation} f(r)=\int\dfrac{r^{5/2}\ dr}{(r-r_0)\sqrt{(r-r_1)(r-r_2)(r-r_3)}} \end{equation} where the domain of $r$ is $[0,\infty)$, $r_0$ is a real positive constant and $r_i$ are the roots of a depressed cubic polynomial (so that $r_1+r_2+r_3=0$). This can be solved in terms of elliptic functions.
I am interested in the large-$r$ behaviour. If one Taylor expands the integrand at large-$r$, and then integrates (the interchange seems to be justified via Tonelli's theorem) the function behaves like: \begin{equation} f(r)\sim r+r_0 \log(r)+\mathcal{O}(1/r) \end{equation} However, integrating the function directly (with Mathematica 12) gives an answer that does not have a logarithmic term when expanded at large-$r$. Instead it gives \begin{equation} f(r)\sim r+C+\mathcal{O}(1/r) \end{equation} where $C$ is a constant determined by the $r_i$.
I take this to mean the interchange is not justified in the first case. Why does it not work? The coefficients of the Taylor expansion of the integrand all appear to be positive, which seems to be enough for Tonelli's theorem.
Thanks!
I did run $1000$ problems with random $r_0>0$, random $(r_1,r_2)$ and $r_3=-(r_1+r_2)$.
For each triplet, was generated a table analyzed using linear regression (no intercept) with $r$ and $\log(r)$ as predictors.
In all cases, the logarithm term is present at a very significant level.
Just an example : $r_0=6$, $r_1=14$, $r_2=29$, $r_3=-43$. The data were generated for $100 \leq r \leq 10000$. With an $R^2=0.999999989$, the results are
$$\begin{array}{|llll} \hline \text{} & \text{Estimate} & \text{Standard Error} & \text{Confidence Interval} \\ r & 1.00014 & 2.57\times 10^{-6} & \{1.00013,1.00014\} \\ \log (r) & 5.89291 & ~~0.00180 & \{5.88939,5.89643\} \\ \end{array}$$
while, using the expansion of the integrand, it would be $$r+6 \log(r) +O\left(\frac{1}{r}\right)$$
Imposing the coefficient of $r$ to be equal to $1$, the coefficient of $\log(r)$ becomes $5.98000$ with a standard error equal to $0.00083$.
In my humble opinion, what happens is that Mathematica has problems with the expansion of the incomplete elliptic integral of the third kind (probably because of its second argument).