[英]How to display the curve with my two differential equations?
Hello i'm trying to implement the euler explicit method with my code. 您好,我正在尝试用我的代码实现euler显式方法。 Here are my two differential equation.
这是我的两个微分方程。 - dSdt = ps S (1-((R + S)/K)) - (C * S) - dRdt = pr R (1-((R + S)/K)) - (beta S R)
-dSdt = ps S (1-(((R + S)/ K))-(C * S)-dRdt = pr R (1-((R + S)/ K))-(beta S R)
How can i display the curve ? 如何显示曲线?
Thank you for your answers. 谢谢您的回答。
h = 0.5
t = np.linspace(0, 35, 35)
def S(t):
if(t <= 0):
return S0
else:
return funcS(t - h) + h * ps*funcS(t - h)*(1-((funcR(t - h) + funcS(t - h))/K)) - (C * funcS(t - h))
def R(t):
if(t == 0):
return R0
else:
return pr*funcR(t - h)*(1-((funcR(t - h) + funcS(t - h))/K)) - (beta*funcS(t - h)*funcR(t - h))
Try this with matplotlib: 尝试使用matplotlib:
import matplotlib.pyplot as plt
plt.plot(t, S(t)) # assuming you want to plot S(t)
plt.show() # this will display your figure
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.