Numerical evaluation of an infinite sum I am trying to evaluate numerically :
\begin{equation}
G = \frac{-1}{4\pi}\sum_{l=0}^{\infty}\frac{2l+1}{\frac{l(l+1)}{R^2}+\frac{1}{L_d^2}}P_l(\cos(\gamma))
\end{equation}
Where $P_l$ is the $l_{th}$ Legendre Polynomial, $R = 6371000, Ld = 1000000$ and $\cos(\gamma)\in [-1,1) $. I know that the series converges for any $\cos(\gamma) \neq 1$.
I did a very simple code on fortran90 that calculates the sum, but i really dont know how much terms to sum, is there any tolerance or relative errors i can include in my code?
 A: Not a complete answer, just some thoughts:
$$\frac{2\ell+1}{\frac{\ell(\ell+1)}{R^2} + \frac1{L_d^2}} \leq \max(R^2,L_d^2) \cdot \ell^{-1}$$
Further, there is the asymptotic formula
$$
P_\ell(\cos \gamma) = J_0(\ell\gamma) + \mathcal O(\ell^{-1})
$$
where $J_\nu$ denotes the Bessel functions of the first kind. From what I found, the constant in the error term seems to be related to the error term in Stirling's formula for factorials, for which estimates are known. Unfortunately, I cannot provide a good reference for that.
Also, something is known about the error term in the asymptotic form of $J_0$:
$$
\biggl|J_0(\ell \gamma) - \sqrt{\frac2{\pi \ell \gamma}}\cos(\ell \gamma-\tfrac14)\biggr| \leq \frac14 \cdot \Bigl(\frac2 \pi\Bigr)^{3/2}\cdot (\ell \gamma)^{-3/2}.
$$
This follows from Theorem 10 in https://arxiv.org/pdf/1107.2007.pdf.
It should be possible to get a numerical estimate on the error of the partial sums in your problem by putting these pieces together. I guess it will be some work though. Sorry that I can't provide much more detail. I'm not an expert in approximation theory.
