4. Given that $\theta$ is an acute angle, define the function
$$
f(\theta)=\frac{\sin ^{2} \theta}{\cos \theta}+\frac{\cos ^{2} \theta}{\sin \theta} \text {. }
$$

Then the range of the function $f(\theta)$ is $\qquad$
$$
\begin{array}{l}
\text { 4. }[\sqrt{2},+\infty) \text {. } \\
\text { Let } \theta \rightarrow 0 \text {, then } f(\theta) \rightarrow+\infty \text {. } \\
\text { Also, } f(\theta)=\frac{1}{\cos \theta}-\cos \theta+\frac{1}{\sin \theta}-\sin \theta \\
=\frac{\sin \theta+\cos \theta}{\sin \theta \cdot \cos \theta}-(\sin \theta+\cos \theta) \\
\geqslant \frac{4}{\sin \theta+\cos \theta}-(\sin \theta+\cos \theta) \text { (by the AM-GM inequality). } \\
\text { Since } \sin \theta+\cos \theta=\sqrt{2} \sin \left(\theta+\frac{\pi}{4}\right) \leqslant \sqrt{2} \text { and } \frac{4}{x}-x
\end{array}
$$

is monotonically decreasing on $(0,+\infty)$, we have
$$
f(\theta) \geqslant \frac{4}{\sin \theta+\cos \theta}-(\sin \theta+\cos \theta) \geqslant \frac{4}{\sqrt{2}}-\sqrt{2}=\sqrt{2} \text {. }
$$
$f(\theta)=\sqrt{2}$ when $\theta=\frac{\pi}{4}$.
Thus, the range of $f(\theta)$ is $[\sqrt{2},+\infty)$.