I'm trying to code

$\displaystyle -\int_{-\pi}^0 \frac{1}{n}sin(nx)\ dx$ + $\displaystyle \int_0^{\pi} \frac{1}{n}sin(nx)\ dx$

in Matlab. I am using the following: - 1/n*integral(sin(n*x),x,-pi,0) + 1/n*integral(sin(n*x),x,0,pi)

But this is what Matlab thinks I'm putting in:

Why on earth is the first integral messed up but not the second?? And how do I fix the first one?

EDIT: Fixed it. I just needed to add parentheses--i.e., (- 1/n*integral(sin(n*x),x,-pi,0)) + (1/n*integral(sin(n*x),x,0,pi)). But why does this work and the original way doesn't?