%matplotlib inline
import numpy as np
import scipy.optimize as so
import matplotlib.pyplot as plt

result = so.minimize_scalar(f, bracket=(-10,10))
x = np.linspace(-10,10,100)
plt.plot(x, f(x))
plt.scatter([result.x], [result.fun], c='r',zorder=10)

74a0ccc42613dfbca9532fbd9ee14b4f196f4a82
%matplotlib inline
import numpy as np
import scipy.optimize as so
import matplotlib.pyplot as plt

result = so.minimize_scalar(f, bracket=(-10,10))
x = np.linspace(-10,10,100)
plt.plot(x, f(x))
plt.scatter([result.x], [result.fun], c='r',zorder=10)
