def transformed(y):
return f(1.5 + np.exp(y[0]))
result = opt.minimize(transformed, x0=[0.0])
x_interior = 1.5 + np.exp(result.x[0])
x_best = min([1.5, x_interior], key=f)
print(x_best, f(x_best))Constraint reparameterization enforces feasibility but does not remove nonconvexity. In this example, up to the next negative-sine lobe, the derivative has one minimum in that lobe, and for the envelope gives . Thus later oscillations cannot improve on the displayed constrained minimum.