For my physics research, I need to do some series expansions of complete elliptic integrals of the first kind. When I tell Mathematica to approximate it, I get...
$$\int_0^{\pi/2}d\theta \frac{1}{\sqrt{x^2 + \sin^2(\theta)}} = \frac{1}{2} \ln \frac{16}{x} + \frac{1}{8}x \ln \frac{x}{8} + x + \mathcal{O}(x^2)$$
I have no idea how Mathematica does this, and I'm going to need to figure this out because I have more complicated elliptic integrals coming down the line, and Mathematica gives up on those. I've tried to fiddle around with Taylor series-ing the integral for small $x$, but that doesn't work. I always get integrals like $\int_0^{\pi/2} \csc^n(\theta) d\theta$, and none of those converge. I believe the problem is, for any small but nonzero $x$, there'll always be a $\theta$ such that $\sin(\theta) \ll x$ on the interval I'm integrating over, and that screws up any series expansion of the integrand I make in $x$.
Any advice on good approximation schemes that would give me those logs, or any book chapters that might be helpful, would be greatly appreciated! Thanks so much.