I'm a student learning ML with Python. I have the following code which generates a np.array, uses it as a parameter of the function and creates its plot:
import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize as opt
def _y_(x):
return np.sin(x/5)*np.exp(x/10) + 5*np.exp(-x/2)
x = np.arange(1, 30.01, 0.01)
y = _y_(x)
plt.plot(x, y)
plt.show()
min1 = opt.minimize(y, x0=2)
print(res1)
print()
min2 = opt.minimize(y, x0=15)
print(min2)
print()
min3 = opt.minimize(y, x0=30)
print(min3)
print()
But when I try to find the minimum of the function for three different points, I get an error:
'numpy.ndarray' object is not callable
It occurs on this line:
min1 = opt.minimize(y, x0=2)
Please, help me fix it!