I'm trying to minimize the function, but get an
ValueError: setting an array element with a sequence.
in the following code:
import numpy as np
from scipy import optimize as opt
def f(x):
return np.sin(x / 5.) * np.exp(x / 10.) + 5 * np.exp( -x / 2.)
aprox_0 = np.array([range(1, 10), range(11, 20), range(21, 30)])
min_0 = opt.minimize(f, aprox_0[0])
Can anyone help?
aprox_0[0]with a single value. Maybe you are just mistaken about the shape of aprox_0? It's a 2D array.