MATLAB: Do I get “sin(t)^2” when I “int(sin(2*t))”

integrationMATLAB and Simulink Student Suite

I enter the following at the start of a Matlab session:
t = sym('t'); y = sin(2*t); int(y)
Matlab returns the following: ans = sin(t)^2
This is clearly not correct. It should return -cos(2*t)/2. Any other number in the cosine argument besides "2" seems to give the correct answer (e.g. if y = sin(3*t), int(y) returns -cos(3*t)/3). I've tried this in v2014b as well as v2016a. Simulink does the same thing if you integrate the function sin(2*t). Either this is a bug, or I'm going insane!

Best Answer

Results of int(), are correct. Actually sin(t)^2 and -cos(2t)/2 differ only by a constant 1/2.
And this is legal, since at every integral we can consider a constant that is added to the result.