
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 vectors $\overrightarrow{m}=(\sin (x-\frac{\pi }{6}),\cos x)$ and $\overrightarrow{n}=(\cos x,\cos x)$, if the function $f(x)=\overrightarrow{m}\cdot \overrightarrow{n}-\frac{1}{4}$.

$(1)$ Find the range of $f(x)$ when $x\in\left[-\frac{\pi }{4},\frac{\pi }{2} \right]$;

$(2)$ In $\triangle ABC$, $a$, $b$, and $c$ are the sides opposite angles $A$, $B$, and $C$, respectively. If $f(A)=\frac{1}{4}$ and $|\overrightarrow{AC}-\overrightarrow{AB}|=2$, find the maximum length of the median on side $BC$.

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