Let $f:\mathbb{R}\to\mathbb{R}$ with, $f(x)=1-x/\pi$ if $x\in(0,\pi]$ and $f(x)=cos(x)$ if $x\in[-\pi,0]$ and 0 in $\mathbb{R}\backslash[-\pi,\pi]$. I want calculate the distributional derivate, So my idea was $$\langle f',\varphi\rangle=-\langle f,\varphi'\rangle=-\left(\varphi(-\pi)+\int_{-\pi}^{0}\sin(x)\varphi(x)\,dx+\int_{0}^{\pi}\dfrac{1}{\pi}\varphi(x)\,dx\right)$$ $$=-\left(\int_{\mathbb{R}}\delta(x+\pi)\varphi(x)\,dx+\int_{-\pi}^{0}\sin(x)\varphi(x)\,dx+\int_{0}^{\pi}\dfrac{1}{\pi}\varphi(x)\,dx\right)$$
but I have a confusion to say which is the derivate, i dont know is right say that $f'=-\delta(x+\pi)-\sin(x)$ if $x\in[-\pi,0]$ and $1/\pi$ if $x\in[0,\pi]$. Or maybe the derivative is equal to $$ \int_{\mathbb{R}}\left[-\delta_{-\pi}(x)\mathbb{1}_{\mathbb{R}\backslash(-\pi,\pi]}(x)-\sin(x)\mathbb{1}_{(-\pi,0]}(x)-\frac{1}{\pi}\mathbb{1}_{(0,\pi]}(x)\right]\varphi(x)dx $$
I don't know if the expression $\delta_{-\pi}(x)\mathbb{1}_{\mathbb{R}\backslash(-\pi,\pi]}(x)$ is right, because this dirac is 1 only on the point $-\pi$.
Thanks!!
Your expression at the end of your computation (your first equation) is correct. Now you do not need any indicator function near the Dirac, $\delta_{-\pi}$ is already supported at $x=\pi$. Hence you can write $$ f'(x) = -\delta_{-\pi}(x) - \sin(x)\,\mathbf{1}_{(-\pi,0]}(x) - \frac{1}{\pi}\,\mathbf{1}_{(0,\pi]}(x) $$ in the sense of distributions. Or even more rigorously, since this is an equality of distributions and not a pointwise identity, you can write $$ f' = -\delta_{-\pi} - \sin\,\mathbf{1}_{(-\pi,0]} - \frac{1}{\pi}\,\mathbf{1}_{(0,\pi]}. $$