I got a different value with wolfram of evaluating $~\int_{0}^{2\pi}\left|\sin\theta+\cos\theta\right|\mathrm d \theta$ $$\begin{align}
A&:=\int_{0}^{2\pi}\left|\sin\theta+\cos\theta\right|\mathrm{d}\theta\\
\end{align}$$
$$\begin{align}
\sin\theta+\cos\theta&<0\leftrightsquigarrow\theta\neq{\pi\over2},{3\pi\over 2}\\
\cos\theta&<-\sin\theta\\
1&<-\tan\theta\\\iff-1&>\tan\theta
\\\equiv\tan\theta&<-1\\
f(\theta)&:=\sin\theta+\cos\theta
\\
A&=\int_{0}^{{\pi\over 2}}f(\theta)\mathrm d\theta-\int_{{\pi\over 2}}^{{\pi\over 2}+{\pi\over 4}}f(\theta)\mathrm d\theta+\int_{{\pi\over 2}+{\pi\over 4}}^{3\pi\over 2}f(\theta)\mathrm d\theta\\~~~&-\int_{{3\pi\over 2}}^{{3\pi\over2}+{\pi\over 4}}f(\theta)\mathrm d\theta+\int_{{3\pi\over 2}+{\pi\over 4}}^{2\pi}f(\theta)\mathrm d\theta
\end{align}$$
And I got $~ A=0 ~$ but wolfram shows me the value of $~ A ~$ should be $~ 4\sqrt{2} ~$
Where I've made (a) mistake(s)?
 A: The mapping $\theta \mapsto |\sin(\theta)+\cos(\theta)|$ has period $\pi$, then
$$A:=\int_{0}^{2\pi}|\sin(\theta)+\cos(\theta)|\, d\theta=2\int_{0}^{\pi}|\sin(\theta)+\cos(\theta)|\, d\theta$$
The problem here is that the map $\theta\mapsto \sin(\theta)+\cos(\theta)$ change of sign over the interval $[0,\pi]$, see the following picture.

However, we can solve that problem noticing that over the interval $[0,\pi]$ we have a only a zero given by $\frac{3\pi}{4}$, indeed $\sin(x)+\cos(x)=0$ iff $\sin(\theta)=-\cos(\theta)$ and over the interval $[0,\pi]$ the only solution is given by $3\pi/4$. Thus, we can move to the interval $[0+3\pi/4,\pi+3\pi/4]$ in order to obtain the same value for $A$, noticing that over the interval $[3\pi/4,7\pi/4]$, the map $\theta \mapsto \sin(\theta)+\cos(\theta)$ is always less than zero, see the following picture.

Then
$$2\int_{0}^{\pi}|\sin(\theta)+\cos(\theta)|\, d\theta=2\int_{3\pi/4}^{7\pi/4}|\sin(\theta)+\cos(\theta)|\, d\theta=-2\int_{3\pi/4}^{7\pi/4}\sin(\theta)+\cos(\theta)\, d\theta$$
Thus, solving the last definite integral we find the value of $A$ to be $4\sqrt{2}$.
Note: Of course we can avoid moving to another interval as above and work the integral in two definite integrals, using only the definition of the absolute value.
\begin{align*}A&=2\int_{0}^{\pi}|\sin(\theta)+\cos(\theta)|\, d\theta,\\
&=2\left(\int_{0}^{3\pi/4}\underbrace{\sin(\theta)+\cos(\theta)}_{>0}\, d\theta+\int_{3\pi/4}^{\pi}-\underbrace{(\sin(\theta)+\cos(\theta))}_{<0}\, d\theta \right),\\
&=2(1+\sqrt{2})+2(-1+\sqrt{2}),\\
&=4\sqrt{2}.
\end{align*}
A: since $$f(\theta)>0 \  ;\theta=(-\pi/ 4 ,3\pi/4)$$
and negative for $$(3\pi/4,7\pi/4)$$
using that
$$\begin{align}\
A&=\int_{0}^{{3\pi\over 4}}f(\theta)\mathrm d\theta-\int_{{3\pi\over 4}}^{{7\pi\over 4}}f(\theta)\mathrm d\theta+\int_{{3\pi\over 2}+{\pi\over 4}}^{2\pi}f(\theta)\mathrm d\theta
\end{align}$$
it seems your third term is wrong.
{ i am new to MES so, forgive my crudeness}
A: Note
$$\int_{0}^{2\pi}\left|\sin\theta+\cos\theta\right|\mathrm d \theta=\int_{0}^{2\pi}\sqrt2\left|\sin(\theta+\frac\pi4)\right|\mathrm d \theta.$$
Since $\sin(\theta)$ is a periodic function with period $2\pi$. So
$$\int_{0}^{2\pi}\left|\sin\theta+\cos\theta\right|\mathrm d \theta=\int_{0}^{2\pi}\sqrt2\left|\sin(\theta+\frac\pi4)\right|\mathrm d \theta=\sqrt2\int_0^{2\pi}|\sin\theta|\mathrm d \theta=4\sqrt2\int_0^{\pi/2}|\sin\theta|\mathrm d \theta=4\sqrt2.$$
A: I would like to evaluate the integral from definition of absolute value by splitting the integration interval into 3 intervals.
$$
\begin{aligned}
\int_0^{2 \pi}|\sin \theta+\cos \theta| d \theta 
\stackrel{\theta\mapsto\theta-\frac{\pi}{4}}{=}&  \sqrt{2} \int_0^{2 \pi}\left|\cos \left(\theta-\frac{\pi}{4}\right)\right| d \theta \\
=  &\sqrt{2} \int_{-\frac{\pi}{4}}^{\frac{7 \pi}{4}}|\cos \theta| d \theta \\
= & \sqrt{2}\left(\int_{-\frac{\pi}{4}}^{\frac{\pi}{2}}|\cos \theta| d \theta+\int_{\frac{\pi}{2}}^{\frac{3 \pi}{2}}|\cos \theta| d \theta+\int_{\frac{2 \pi}{2}}^{\frac{7 \pi}{4}} \cos \theta d \theta\right) \\
= & \sqrt{2}\left(\int_{-\frac{\pi}{4}}^{\frac{\pi}{2}} \cos \theta d \theta-\int_{\frac{\pi}{2}}^{\frac{3 \pi}{2}} \cos \theta d \theta+\int_{\frac{3 \pi}{2}}^{\frac{\pi \pi}{4}} \cos \theta d \theta\right) \\
= & \sqrt{2}\left([\sin \theta]_{-\frac{\pi}{4}}^{\frac{\pi}{2}}-[\sin \theta]_{\frac{\pi}{2}}^{\frac{3 \pi}{2}}+[\sin \theta]_{\frac{3 \pi}{2}}^{\frac{7\pi}{4}}\right) \\
= & \sqrt{2}\left(1+\frac{1}{\sqrt{2}}+2-\frac{1}{\sqrt{2}}+1\right) \\
= & \ 4 \sqrt{2}
\end{aligned}
$$
