In Mathematica notation, I am looking for the function f[m,n] for real numbers m and n defined by
f[m_,n_]:=Integrate[SquareWave[m x]SquareWave[n x],{x,0,1}].
I'm trying to get a closed form for the integral for general m and n, but am having trouble, as Mathematica cannot do it.
I found a closed form for f[m,n] for integer m, n:
f[m,n] = Mod[m,2]Mod[n,2]GCD[m,n]^2/(m n).
I am just wondering if there exists a closed formula for f[m,n] for real values of m and n. It seems like a simple problem but I'm not sure how to solve it, or if a closed form even exists. I found the integer m,n result using Fourier series for the square waves, along with properties of the dilogarithm function (which shows up in Mathematica when I compute the needed sums of products of Fourier coefficients).
Naturally, if this has already been answered I will remove it, but was curious if anyone has any input. I feel like I'm attacking the problem using the wrong method (analysis) and that it would be better to use number theory or something like that. Any insights? This is just for fun, so if no one figures it out there's no harm done.