I am trying to compute the integral
$$ F(i, j) = \int_0^1 \phi_i(x) \phi_j(x) dx, \quad \mbox{where}~~ \phi_k(x) = \sqrt{2} \sin\Big(\frac{2 k - 1}{2} \pi x\Big) $$
The integer $k \geq 1$. The answer should be $F(i,j) = \delta_{ij}$ so that $F(i,i) = 1$ for all integers $i \geq 1$ and $F(i,j) = 0$ for positive integers $i \neq j$.
The answer I get from Mathematica is wrong:
In[27]:= EigFun[j_, x_] = Sqrt[2] * Sin[Pi * x * (2*j - 1)/2]
Out[27]= Sqrt[2] Sin[1/2 (-1 + 2 j) [Pi] x]
In[29]:=
ExpVal[i_, j_] = Integrate[EigFun[i, x] * EigFun[j, x], {x, 0, 1}]
Out[29]= (
Sin[(i - j) [Pi]]/(i - j) -
Sin[(-1 + i + j) [Pi]]/(-1 + i + j))/[Pi]
In[30]:= FullSimplify[%29,
Assumptions -> {i >= 1 && j >= 1 && i [Element] Integers &&
j [Element] Integers}]
Out[30]= 0
Is there an easy fix for this? Or what is the explanation for this issue?
KroneckerDelta[i,j]as result, you could send an email to support@wolfram.com and complain about a misleading result forIntegrate[Sqrt[2]* Sin[(1/2)*(2*i - 1)*Pi*x]* Sqrt[2]*Sin[(1/2)* (2*j - 1)*Pi*x], {x, 0, 1}, Assumptions -> i \[Element] Integers && j \[Element] Integers, GenerateConditions -> True]. I am sure WRI is aware of these subtle issues. BTW: ChatGPT gets it wrong, too ... – Rolf Mertig Aug 12 '23 at 22:31