9. The difference between the maximum and minimum values of the function $f(x)=|\sin x|+\sin ^{+} 2 x+|\cos x|$ is $\qquad$
9. $\sqrt{2}$ Hi $f\left(\frac{\pi}{4}+x\right)=\left|\sin \left(\frac{\pi}{4}+x\right)\right|+\sin ^{\prime}\left(\frac{\pi}{2}+2 x\right)+\left|\cos \left(\frac{\pi}{4}+x\right)\right|$ $=\left|\cos \left(\frac{\pi}{4}-x\right)\right|+\sin ^{\prime}\left(\frac{\pi}{2}-2 x\right)+\left|\sin \left(\frac{\pi}{4}-x\right)\right|$ $=f\left(\frac{\pi}{4}-x\right)$.

It is known that the graph of $f(x)$ is symmetric about the line $x=\frac{\pi}{4}$. Also, it is easy to see that the smallest positive period of $f(x)$ is $\frac{\pi}{2}$, so we only need to consider the case $0 \leqslant x \leqslant \frac{\pi}{4}$.
When $x \in\left[0, \frac{\pi}{4}\right]$,
$$
f(x)=\sin x+\sin ^{4} 2 x+\cos x=\sin ^{\prime} 2 x+\sqrt{2} \sin \left(x+\frac{\pi}{4}\right) .
$$

Since $\sin ^{\prime} 2 x$ and $\sin \left(x+\frac{\pi}{4}\right)$ are both increasing functions on $\left[0, \frac{\pi}{4}\right]$, $f(x)$ is an increasing function on $\left[0, \frac{\pi}{4}\right]$. Therefore,
$$
f(x)_{\max }-f(x)_{\min }=f\left(\frac{\pi}{4}\right)-f(0)=\sqrt{2} .
$$