I want to evaluate the following integral and obtain the result as a function of n and m, the latter is absolutely crucial to me :
$$g(n,x) = \sqrt{\frac{2}{(n+2)^2 - 1}} \Big\{ (n+2) \cos[(n+2) \pi x] - \cot(\pi x) \sin[ (n+2) \pi x] \Big\}$$
and
$$x_{nm}(n,m) = \int_0^1 \ g(n,t)\ t\ g(m,t)\, \operatorname dt$$
Naively, integrating this results in a non-converging integral (using Mathematica). So, I sought for an indefinite integral which I can then use with Fundamental Theorem of Calculus to get my result as $x_{nm} \equiv x_{nm}(n,m)$.
The indefinite integral that I obtain using Mathematica is discontinuous which means that I cannot use the Fundamental Theorem of Calculus on it. It is giving incorrect result (which I verified separately) in two cases :
- $m=n$ (should be non-zero finite number but getting $\infty$)
- $|m-n|$ = even (should be 0 but getting $\infty$)
Can anyone please suggest me a way forward so that I can get $x_{nm}$ as a function of $n,m$? I would be happy with any kind of solution.
My question regarding the same problem on Mathematica.SE is here.
Proceeding as in comments : $$ I_1 = \int_{0}^{1} dx\ \underbrace{x}_\text{A}\ \underbrace{\cos[(n+2)\pi x] \cos[(m+2)\pi x]}_\text{B} = x \left[ \int dx\ B \Bigg| ^{1}_{0} \right] - \int_{0}^{1} dx\ \int dx\ B $$ with $$ \int dx\ B = \frac{\frac{\sin(\pi x (m-n))}{m-n} + \frac{\sin(\pi x (m+n+4))}{m+n+4}}{2 \pi} $$ and so on. I believe I can do it now, shouldn't have been stuck on solving by Mathematica!