Find the maximum value g (a) of the function y = - cosx ^ 2 + acosx + 5 / 8a-1 / 2 (x is greater than or equal to 0, less than or equal to half)

Find the maximum value g (a) of the function y = - cosx ^ 2 + acosx + 5 / 8a-1 / 2 (x is greater than or equal to 0, less than or equal to half)

f(x)=-cosx^2+acosx+5/8a-1 -π/2