Recently, I needed to evaluate some integrals involving linear combinations of J_m and Y_m. There are well-known analytical expressions for those, which are
However, I am finding that when \alpha and \beta are very close, and for certain m, like m=7, I think I am getting catastrophic cancellation since the results are completely wrong. A comparison with QuadGK
confirms that indeed the results are wrong.
Also, the results for \alpha \approx \beta should get really close to the \alpha = \beta case, which should be 1 since I am working with an orthonormal basis.
What could be a good strategy to alleviate this issue? I would like to keep using the analytical expression since it is much faster.