0
我想創建一個集成了模型的腳本,以便我可以更改其中一個參數並查看系統對此更改的響應。如果,例如,我有一個的Lotka-Volterra模型(從這個example截取):Python中的ODE模型的交互式多點繪圖
import numpy as np
from scipy import integrate
a = 1.
b = 0.1
c = 1.5
d = 0.75
def dX_dt(X, t=0):
""" Return the growth rate of fox and rabbit populations. """
return array([ a*X[0] - b*X[0]*X[1] ,
-c*X[1] + d*b*X[0]*X[1] ])
t = np.linspace(0, 15, 1000) # time
X0 = np.array([10, 5]) # initials conditions: 10 rabbits and 5 foxes
X, infodict = integrate.odeint(dX_dt, X0, t, full_output=True)
我想創建參數a
和c
的滑塊,如在slider_demo of matplotlib,或任何其他工具。情節應該顯示總是橫跨[t_current - delta_t ,t_current]
的某個時間窗口。因此,通過更改參數的滑塊,我將能夠不斷探索參數空間。
任何想法如何做到這一點?