Integral of a function with two parts (piecewise defined) The function has 2 parts: 
$$f(x) = \begin{cases} -\sin x & x \le 0 \\ 2x & x > 0\end{cases}$$
I need to calculate the integral between $-\pi$ and $2$.
So is the answer is an integral bewteen $-\pi$ and $0$ of $f(x)$ and then and $0$ to $2$.
but why the calculation of the first part of $-\pi$ and $2$ aire on $-\sin x$ and the second part of the intgral is on $x^2$, which is part of the $F(x)$.
I'd like to get some help over here, I'm lost 

Note that $$ \displaystyle\int_{-\pi}^{2} f(x) \, \mathrm{d}x = \displaystyle\int_{-\pi}^{0} f(x) \, \mathrm{d}x + \displaystyle\int_{0}^{2} f(x) \, \mathrm{d}x $$ because each integral is an area under the curve $f(x)$ under the given domain and we want to find the full area so we just add the two "components" of the area to get the total. 
