Reputation: 311
I have the following code:
def fun(t, s, rho_0, rho_1):
return lambda t, s:np.dot(np.array([0.775416, 0,0, 0.308968]).reshape(2,2), s) + np.array([rho_0,rho_1]).reshape(2,1)
def fun2(t, rho_0, rho_1):
t_eval = np.arange(0,5)
res = solve_ivp(fun, [0, 5], y0 = [0, 0], t_eval=t_eval, args = (rho_0, rho_1), vectorized = True)
return res.y[1]
fun2(t = 0, rho_0 = 0.0099532, rho_1 = 0.001699)
which is giving the titled error. I am not exactly following why and how it can alternatively be expressed.
Upvotes: 0
Views: 136
Reputation: 169
you returned a lambda expression in the function. In Python, lambda is an anonymous function. You don't need to use lambda
def fun(t, s, rho_0, rho_1):
return np.dot(np.array([0.775416, 0,0, 0.308968]).reshape(2,2), s) + np.array([rho_0,rho_1]).reshape(2,1)
Upvotes: 3