y = (1/2)cos2x - asinx + b + 1/2
= (1/2)(1 - 2sin²x) - asinx + b + 1/2
= -sin²x - asinx + b + 1
= -(sinx + a/2)² + a²/4 + b + 1
当 0 ≤ a ≤ 2 时,
a²/4 + b + 1 = 0
-1 - a + b + 1 = -4
解得: a = 2 , b = -2
当 -2 ≤ a ≤ 0 时,
a²/4 + b + 1 = 0
-1 + a + b + 1 = -4
解得: a = -2 , b = -2
当 a < -2 时,
-1 - a + b + 1 = 0
-1 + a + b + 1 = -4
无解
当 a > 2 时,
-1 + a + b + 1 = 0
-1 - a + b + 1 = -4
无解
综上: a = 2 , b = -2 或 a = -2 , b = -2