0

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!

  • 1
  • @user293787 Thanks a lot! Lord this is so helpful and I was being retarded not able to find such a similar topic. – StudyPhysGood Aug 11 '22 at 09:16
  • You should not be so self-demeaning. It is easier for people that have been around longer. There are lots of similar cases in symbolic computation. Try Integrate[x^n,x] for example. The result looks good but what about n=-1? Then try Integrate[x^(-1),x]. This is a common thing. – user293787 Aug 11 '22 at 09:27

0 Answers0