I was experimenting with the int() function which gave me a strange integral.
syms x;f2 = @(x) sin(x) + 2*cos(x);integral = int(f2, x)
which gave me:
integral = -2*cos(x/2)*(cos(x/2) - 2*sin(x/2))
Any idea why this is the case? I expected something along the lines of -cos(x) – 2*sin(x); is this the same expression written differently or is my code written incorrectly, or is something else going on?
Best Answer