x = [1, 2, 3.2, 4, 5]
y = [1, 4, 16, 4, 1]

def f(x, p1, p2, p3):
    return p3 * (p1 / ((x - p2) ** 2 + (p1 / 2) ** 2))
p0 = 8, 16, 0.1
plt.plot(x, y, 'ro')
popt, pcov = curve_fit(f, x, y, p0)
fm = lambda x: -f(x, *popt)
r = minimize_scalar(fm, bounds=(1, 5))
print('maximum:', r['x'], f(r['x'], *popt))
x_curve = np.linspace(1, 5, 100)
plt.plot(x_curve, f(x_curve, *popt))
plt.plot(r['x'], f(r['x'], *popt), 'ko')
plt.show()
Нахождение максимума кривой scipy