What is the indefinite integral of $f(x) = \begin{cases} \sin x & x<\pi/4 \\ \cos x & x\ge \pi/4 \\ \end{cases}$ I'm trying to find the indefinite integral of
$$f(x) = \begin{cases} \sin x  & x<\pi/4 \\ \cos x & x\ge \pi/4 \\ \end{cases}$$
In all of $\Bbb R$. It seems continuous at $\frac{\pi}4$ and everywhere else, so it should have a definite integral. I intuitively think of something like:
$$F(x) = \begin{cases} -\cos x+C_1 & x<\pi/4 \\ \sin x+C_2 & x\ge \pi/4 \\ \end{cases}$$
So I indeed recover $f(x)$ by differentiating $F(x)$ everywhere but at $\frac\pi 4$ (At which point it's not continuous) and I'm wondering if that's a problem. I'm new to this kind of integration..
Thanks for your help!
Edit: At this point I'm thinking this family of functions will work:
$F(x)=\begin{cases} -\cos x + \sqrt2 +C & x<\pi/4 \\ \sin x + C& x\ge \pi/4 \\ \end{cases}$
For some $C\in \Bbb R$. Thoughts?
 A: The best and fastest route to find the antiderivatives is the one taken by Andre Nicolas. This answer shows how to go from where the OP stopped.
Yes, that's a problem. 
You first need to adjust the constants so that your antiderivative be continuous at $\pi/4$, hence on $\mathbb{R}$.
Equate the right and the left limits with $F(\pi/4)$ to find the condition on $C_1$ and $C_2$.
Then you need to check that $F$ is differentiable with derivative $f$ on $\mathbb{R}$. On $\mathbb{R}\setminus \{\pi/4\}$, this is obvious. 
At $\pi/4$, you have 
$$
\lim_{\pi^+/4}F'(x)=\lim_{\pi^-/4}F'(x)=f(\pi/4).
$$
So $F$ is indeed differentiable at $\pi/4$ with derivative $f(\pi/4)$. This method is slightly shorter than computing the limit of $(F(x)-F(\pi/4))/(x-\pi/4)$.
A: After we have found one antiderivative, getting them all is mechanical.  Let $f(x)$ be our function. Since $f$ is continuous everywhere, one antiderivative $F(x)$ is given by
$$F(x)=\int_a^x f(t)\,dt,$$
where $a$ is a constant. Now we are finished. 
But if we want an explicit formula, pick any $a$ you like. For example, the choice $a=0$ is not unreasonable. 
Then for $x\le \frac{\pi}{4}$, we get $F(x)=\int_0^x \sin t\,dt=1-\cos x$.  For $x \ge \frac{\pi}{4}$, we get $F(x)=\int_0^{\pi/4} \sin t\,dt +\int_{\pi/4}^x \cos t \,dt=1-\frac{2}{\sqrt{2}}+\sin x$.
It is more elegant to let $a=\frac{\pi}{4}$. That gives $F(x)=-\cos x+\frac{1}{\sqrt{2}}$ if $x\le \frac{\pi}{4}$, and $F(x)=\sin x-\frac{1}{\sqrt{2}}$ for $x\ge \frac{\pi}{4}$.  
