I need to compute some integrals numerically. The integrand is this:
$$f(x,y) = \left ( \sum_{mn=-j}^{j}A(m,n)\dfrac{\tan^{2j+m+n}(x/2)}{(1+\tan^2(x/2))^{2j}}e^{iy(n-m)} \right )^{N}$$
Note: sums are finite. And I have to compute
$$\int_0^\pi \int_0^{2\pi}f(x,y)dydx$$
I have to do this for different values of $N$. I was working in C++ with a simple integrator, but the problem is that the limits in $x$ are $[0,\pi]$. When $j$ is big and $x\rightarrow\pi$, I have overflows/underflows everywhere.
I've also tried to use Python/Scipy, with the dblquad
function. However, it takes forever to compute the integral. The results aren't good. I have to compute it more or less a hundred of times, so I need something reasonably fast.
I'm really stuck with this. Any idea to get a numerical result from the integral is well received.
EDIT: Common numerical values as requested.
$$j\in[20,150]$$ $$n,m\in[-j,j]$$ $$N=1,2,...,5$$
That means that we have up to ~$\tan^{4jN}(x/2)$ both in numerator/denominator. When $x$~$\pi$ that becomes huge! I've obtained a lot of NaNs in C++. $A(m,n)$ is simply a coefficient obtained from some non-zero constants.
Important note: althought the term $e^{iy(n-m)}$ is there, $f(x,y)\in\mathbb{R}$. Imaginary parts always dissapears.