I am currently trying to use the integrated SciPy package to solve a pair of first-order ODE-related applications: say, Lotka-Volterra-predator is the equation before . However, this means that during the integration cycle, I have to update the parameters that I send to the methods at each iteration, and just keep track of the previous value and call set_f_params()at each iteration does not seem to do the trick.
hprev = Ho
pprev = Po
yh = np.zeros(0)
yp = np.zeros(0)
while dh.successful() and dp.successful() and dp.t < endtime and dh.t < endtime:
hparams = [alpha, beta, pprev]
pparams = [delta, gamma, hprev]
dh.set_f_params(hparams)
dp.set_f_params(pparams)
dh.integrate(dh.t + stepsize)
dp.integrate(dp.t + stepsize)
yh = np.append(yh, dh.y)
yp = np.append(yp, dp.y)
hprev = dh.y
pprev = dp.y
, set_f_params, -, , , , , -, "" , , , .
- , SciPy ODE?