def f(x):
if x <= -2:
res = 1 - math.sin(x)**2
elif -2 < x <= 2:
res = -x
elif x > 2:
res = (x-2)**2 + 1
return res
вот......................
def f(x):
if x <= -2:
res = 1 - math.sin(x)**2
elif -2 < x <= 2:
res = -x
elif x > 2:
res = (x-2)**2 + 1
return res
вот......................