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?
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)$.