If I take the following integral:
$$\int_0^l \sin\left(\frac{n\pi x}{l}\right)\sin\left(\frac{m\pi x}{l}\right)\mathrm dx, \tag{1}$$
and I put it into an integral calculator, it produces the following formula:
$$y=-\frac{l((n-m)\sin(\pi n+\pi m)+(-n-m)\sin(\pi n-\pi m))}{2\pi (n^2-m^2)}. \tag{2}$$
If I then calculate $y$ for various combinations of integer $n$ and $m$ I find that when $n\neq m$ then $y=0$ and when $n=m$ then $y=\text{undefined}$. However if I set $n=m$ with $n,m\in \Bbb N$ in $(1)$ I find that I get a finite answer when $n=m$.
What's strange is that if I consider both formulas to be $y(n,m)$, even though they are equivalent (?), one is undefined at $y(m,m)$ and the other is finite. What is going on here?
FWIW: I am a physicist(-type background), not mathematics, I don't have a thorough understanding of how integrals are constructed.