
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
Given the function $f(x)= \frac{1}{2}\sin 2x- \sqrt{3}\cos^2x$

$(1)$ Find the smallest positive period and the minimum value of $f(x)$;

$(2)$ If the graph of function $f(x)$ is transformed such that every point's x-coordinate is stretched to twice its original value while the y-coordinate remains unchanged, resulting in the graph of function $g(x)$, find the range of $g(x)$ when $x\in\left[ \frac{\pi}{2} ,\pi\right]$.

Present the answer in LaTex format: \boxed{Your answer}
user