5. Let the complex number $z=(\omega+2)^{3}(\omega-3)^{2}$. Find the maximum value of the modulus of $z$ when $\omega$ takes all complex numbers of modulus 1.
5. If $\alpha$ is a real number, $\omega$ is a complex number with modulus 1, let $t=\omega+\bar{\omega}=2 \operatorname{Re} \omega$.
Then $|\omega-\alpha|^{2}=(\omega-\alpha)(\bar{\omega}-\bar{\alpha})$
$$
=|\omega|^{2}-\alpha(\omega+\bar{\omega})+\alpha^{2}=1-\alpha t+\alpha^{2} \text {. }
$$

By the AM-GM inequality,
$$
\begin{array}{l}
|z|^{2}=\left|(\omega+2)^{3}(\omega-3)^{2}\right|^{2} \\
=\left(|\omega+2|^{2}\right)^{3}\left(|\omega-3|^{2}\right)^{2} \\
=(5+2 t)^{3}(10-3 t)^{2} \\
\leqslant\left(\frac{3(5+2 t)+2(10-3 t)}{3+2}\right)^{3+2}=7^{5},
\end{array}
$$

Equality holds if and only if $5+2 t=10-3 t$, i.e., $t=1$. At this point, $\omega=\frac{1 \pm \sqrt{3} \mathrm{i}}{2}$, and the maximum modulus of $|z|$ is $7^{\frac{5}{2}}$.