Can odeint_adjoint solve parametric ODEs?
Author: mayar-shahinCreated Apr 7, 2023Updated Jul 2, 2025
Let's say I have some linear system of parametric ODEs:
def f(t, y, params):
a, b, c = params
dydt = torch.zeros_like(y)
dydt[0] = a*y[0] - b*y[1]
dydt[1] = b*y[0] - c*y[1]
return dydtHow do I pass the parameters to odeint/odeint_adjoint? In scipy.integrate.odeint, this would look like this:
odeint(f, y0, t, args=(a,b,c))Source: rtqichen/torchdiffeq