7. Find the maximum value of the function

$$
f(x)=\sin (x+\sin x)+\sin (x-\sin x)+\left(\frac{\pi}{2}-2\right) \sin \sin x
$$
Answer: $\frac{\pi-2}{\sqrt{2}}$.

Solution. Using the formula for converting the sum of sines into a product, we get

$$
f(x)=2 \sin x \cdot \cos \sin x+\left(\frac{\pi}{2}-2\right) \sin \sin x=g(\sin x)
$$

where $g(t)=2 t \cos t+\left(\frac{\pi}{2}-2\right) \sin t, t=\sin x \in[-1 ; 1]$. The function $g$ is odd and

$$
g^{\prime}(t)=-2 t \sin t+\frac{\pi}{2} \cos t=\frac{\pi}{2} \sin t\left(\operatorname{ctg} t-\frac{4}{\pi} t\right)
$$

Since $g^{\prime}(t)>0$ for $0 \leqslant t<\frac{\pi}{4}, g^{\prime}(t)<0$ for $\frac{\pi}{4}<t \leqslant 1$, the function $g(t)$ has a unique maximum on the interval $[0 ; 1]$ at the point $t=\frac{\pi}{4}$. Therefore, $g(t) \leqslant g\left(\frac{\pi}{4}\right)=\frac{\pi-2}{\sqrt{2}}, t \in[0 ; 1]$. Due to the oddness, the situation on the interval $[-1 ; 0]$ is symmetric. We will show that $g(-1)<g\left(\frac{\pi}{4}\right)$. Indeed,

$$
g(-1)=\left(2-\frac{\pi}{2}\right) \sin 1-2 \cos 1=2 \sin 1\left(1-\frac{\pi}{4}-\operatorname{ctg} 1\right)<2 \sin 1\left(\frac{1}{2}-\frac{\pi}{4}\right)<0<g\left(\frac{\pi}{4}\right)
$$

Thus, the maximum value of the function $g(t)$ on the interval $[-1 ; 1]$, and hence the function $f(x)$ on the entire real line, is $\frac{\pi-2}{\sqrt{2}}$.

Answer to variant 2: $\frac{2-\pi}{\sqrt{2}}$. $\quad$ Answer to variant 3: $\frac{4-2 \pi}{\pi \sqrt{2}}$. Answer to variant 4: $\frac{4 \pi-8}{\pi \sqrt{2}}$.