Take three definitions of the same function ArcTan[Tan[k]]. Can these be integrated? Can their integrals be differentiated?
sf[1, k_] := ArcTan[Tan[k]];
sf[2, k_] := Mod[k + \[Pi]/2, \[Pi]] - \[Pi]/2
sf[3, k_] := \[Pi] SawtoothWave[k/\[Pi] - 1/2] - \[Pi]/2
The integrals Mathematica computes take varied form. Sawtooth[] does not integrate, which is fine.
The other two look quite distinct, a plot comparison confirms.
It appears that the Mod form of the equation is the cleanest to work with, the trigonometric integral clearly being erroneous. Differentiating these integrals we hope to return to the original equation.
It is now the Mod form that produces odd results.
It seems no form of ArcTan[Tan[k]] is suitable for automatic calculus; stemming presumably from tricky issues with regular discontinuity. It’s concerning that so many of these procedures fail silently. If I integrate similar functions unexpectedly in the body of a volume of work, I likely wont observe these complications.
This exploration was prompted by @Marco Thiel’s work computing a convergent integral here .




