17 Given the function $f(x)=\sqrt{3} \sin \omega x \cdot \cos \omega x-\cos ^{2} \omega x(\omega>0)$ has a period of $\frac{\pi}{2}$
(1) Find the value of $\omega$;
(2) Suppose the three sides $a, b, c$ of $\triangle A B C$ satisfy $b^{2}=a c$, and the angle opposite side $b$ is $x$, find the range of the function $f(x)$ at this time.
17
$$
\text { (1) } \begin{aligned}
f(x) & =\frac{\sqrt{3}}{2} \sin 2 \omega x-\frac{1}{2}(\cos 2 \omega x+1) \\
& =\sin \left(2 \omega x-\frac{\pi}{6}\right)-\frac{1}{2} .
\end{aligned}
$$

From the function $f(x)$'s period $T=\frac{2 \pi}{2 \omega}=\frac{\pi}{2}$, we get $\omega=2$. The expression for the function $f(x)$ is
$$
f(x)=\sin \left(4 x-\frac{\pi}{6}\right)-\frac{1}{2} .
$$
（2）From the problem, we have
$$
\begin{aligned}
\cos x & =\frac{a^{2}+c^{2}-b^{2}}{2 a c} \\
& \geqslant \frac{2 a c-a c}{2 a c} \\
& =\frac{1}{2} .
\end{aligned}
$$

Since $0<x<\pi$, we know
$$
0<x \leqslant \frac{\pi}{3},-\frac{\pi}{6}<4 x-\frac{\pi}{6} \leqslant \frac{7 \pi}{6} .
$$

Therefore,
$$
\begin{array}{c}
-\frac{1}{2} \leqslant \sin \left(4 x-\frac{\pi}{6}\right) \leqslant 1, \\
-1 \leqslant \sin \left(4 x-\frac{\pi}{6}\right)-\frac{1}{2} \leqslant \frac{1}{2},
\end{array}
$$

which means the range of the function $f(x)$ is $\left[-1, \frac{1}{2}\right]$.