I am facing a fundamental quantum mechanics question. Which is the integration of two consine functions with different parameter.
The integration will take the form of
$\int_{-L/2}^{L/2} \sqrt{\frac{2}{L}} \cos\left(\frac{n x \pi}{L}\right) \times \sqrt{\frac{2}{L}}\cos\left(\frac{m x \pi}{L}\right) dx$ where n and m are integers.
I believe when n=m, the integration result will read.
However, if I am doing this in mathematica, we will have a general expression
$\frac{4 m \sin \left(\frac{\pi m}{2}\right) \cos \left(\frac{\pi n}{2}\right)-4 n \cos \left(\frac{\pi m}{2}\right) \sin \left(\frac{\pi n}{2}\right)}{\pi m^2-\pi n^2}$
Which is also correct when m and n are different.
However, when n=m, the indeterminate form will apprea. I am wondering if we are able to find a general expression that can take of the case n=m? Becasue I want to use a realtion to generate a matrix (not generating the matrix directly from something like "Table[Integral[f1[n]f1[m],{z,-L/2,L/2}],{n,1,10},{m,1,10}]") using n and m as index.
Thanks!
Integrate[x^n,x]for example. The result looks good but what aboutn=-1? Then tryIntegrate[x^(-1),x]. This is a common thing. – user293787 Aug 11 '22 at 09:27