f(x)=(x-1)^2+2,
因为(x-1)^2≧0,
①若a>1,
则f(x)max=[(a+2)-1]^2+2=a^2+2a+3
f(x)min=(a-1)^2+2=a^2-2a+3,
②若a≦1≦a+2,即-1≦a≦1,此时分2种情况考虑,
1若1-a≦a+2-1,即a≧0时,(0≤a≤1)
f(x)max=[(a+2)-1]^2+2=a^2+2a+3,
f(x)min=2(此时x=1时,f(1)最小)
2若1-a≧a+2-1,即a≦0,(-1≤a≤0)
f(x)max=(a-1)^2+2=a^2-2a+3,
f(x)min=1,
③当a+2