I have the following code, which aims at tuning the parameters of an ODE:
def fun(t, s, rho_1, rho_2):
return np.dot(np.array([0.775416, 0,0, 0.308968]).reshape(2,2), s) + np.array([rho_1, rho_2]).reshape(2,1)
def fun2(t, rho_1, rho_2):
t_eval = np.arange(0, 5)
res = solve_ivp(fun, [0, 5], y0 = [0, 0], t_eval=t_eval, args = (rho_1, rho_2), vectorized = True)
Sol = res.y[:, 2] - np.array([0.013063648930914912, 0.005891186899569828])
return Sol
root = fsolve[fun2, [0, 0]]
which is giving the following error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [300], in <cell line: 10>()
7 Sol = res.y[:, 2] - np.array([0.013063648930914912, 0.005891186899569828])
8 return Sol
---> 10 root = fsolve[fun2, [0, 0]]
TypeError: 'function' object is not subscriptable
I don't know whether the issue is that 'fsolve' is not the appropriate function for this purpose, or there is something wrong with my code that could potentially get easily resolved.