优化示例(黄金)
黄金方法通过缩小极值范围来最小化单峰函数
import numpy as np
from scipy.optimize import _minimize
from scipy import special
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 500)
y = special.j0(x)
optimize.minimize_scalar(special.j0, method='golden')
plt.plot(x, y)
plt.show()
得到的图像