Python 中 solve_ivp() 函数的 R 等价物是什么?
What is the R equivalent of the solve_ivp() function in Python?
我正在将一些代码从 Python 翻译成 R,我发现很难在每个代码中找到相应的函数。在这种特殊情况下,我遇到问题的代码是:
x_sol_best = solve_ivp(
fun=model_covid,
y0=x_0_cases,
t_span=[t_predictions[0], t_predictions[-1]],
t_eval=t_predictions,
args=tuple(optimal_params),
).y
从 scipy.integrate.solve_ivp
documentation 中,我看到此函数中使用的默认积分方法是:'RK45'(默认):显式龙格-阶数 5(4)
的 Kutta 方法
R 中的哪些包/函数等同于此?
从 R ode
函数的 R documentation 中,我看到有许多可用的 RK 4(5) 方法(粘贴在下面)——但是 Python 文档指出 RK45 是订单 5(4)...
谁能解释一下? TIA
"rk45ck" | Runge-Kutta Cash-Karp, order 4(5)
"rk45f" | Runge-Kutta-Fehlberg, order 4(5); Octave: ode45, pair=1
"rk45e" | Runge-Kutta-England, order 4(5)
"rk45dp6" | Dormand-Prince, order 4(5), local order 6
"rk45dp7", "ode45" | Dormand-Prince 4(5), local order 7
根据文档,solve_ivp()
中的默认求解器是 Dormand-Prince。这在 deSolve
包的 ode()
函数中调用了 ode45
。
x_sol_best = deSolve::ode(
y = x_0_cases,
times = t_predictions,
func = model_covid,
parms = c(...), # vector of parameter values
method = "ode45"
)[ , -1] # drop the t column
我正在将一些代码从 Python 翻译成 R,我发现很难在每个代码中找到相应的函数。在这种特殊情况下,我遇到问题的代码是:
x_sol_best = solve_ivp(
fun=model_covid,
y0=x_0_cases,
t_span=[t_predictions[0], t_predictions[-1]],
t_eval=t_predictions,
args=tuple(optimal_params),
).y
从 scipy.integrate.solve_ivp
documentation 中,我看到此函数中使用的默认积分方法是:'RK45'(默认):显式龙格-阶数 5(4)
R 中的哪些包/函数等同于此?
从 R ode
函数的 R documentation 中,我看到有许多可用的 RK 4(5) 方法(粘贴在下面)——但是 Python 文档指出 RK45 是订单 5(4)...
谁能解释一下? TIA
"rk45ck" | Runge-Kutta Cash-Karp, order 4(5)
"rk45f" | Runge-Kutta-Fehlberg, order 4(5); Octave: ode45, pair=1
"rk45e" | Runge-Kutta-England, order 4(5)
"rk45dp6" | Dormand-Prince, order 4(5), local order 6
"rk45dp7", "ode45" | Dormand-Prince 4(5), local order 7
根据文档,solve_ivp()
中的默认求解器是 Dormand-Prince。这在 deSolve
包的 ode()
函数中调用了 ode45
。
x_sol_best = deSolve::ode(
y = x_0_cases,
times = t_predictions,
func = model_covid,
parms = c(...), # vector of parameter values
method = "ode45"
)[ , -1] # drop the t column