
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
Let $$f(x)= \frac {1}{2}\cos2x+a\sin x- \frac {a}{4} \quad (0\leq x\leq \frac {\pi}{2}).$$  
(1) Express the maximum value of $f(x)$, denoted as $M(a)$, in terms of $a$.  
(2) Find the value of $a$ when $M(a) = 2$.

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