이제 오일러 메서드를 사용하여 문제를 해결하고 있습니다. 나는 다음과 같이 그것을했지만 내가 slidr를 이동하더라도 그래프는 Matplotlib page에 Slider
을 사용하는 방법에 대한 예제가있다python matplotlib 위젯이 작동하지 않습니다.
from math import exp
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.widgets import Slider, Button, RadioButtons
for i in range(1,n):
Nlist.append(Nlist[i-1]+dNlist[i-1]*deltat)
Qlist.append(Qlist[i-1]+Qlist[i-1]*deltat)
dNlist.append(Qlist[i]/(1+Qlist[i])*(1-Nlist[i]/Nmax)*Nlist[i])
tlist.append(t0+i*deltat)
x=tlist
y=Nlist
fig=plt.figure()
l=fig.add_subplot(111)
fig.subplots_adjust(left=0.25, bottom=0.25)
l.plot(x,y,linewidth=2,color="red")
plt.xlabel("Value of t")
plt.ylabel("Value of N")
plt.title("Euler Method")
axcolor = 'lightgoldenrodyellow'
axQ0 = fig.add_axes([0.25, 0.15, 0.65, 0.03], axisbg=axcolor)
axNmax = fig.add_axes([0.25, 0.1, 0.65, 0.03], axisbg=axcolor)
axN0 = fig.add_axes([0.25, 0.05, 0.65, 0.03], axisbg=axcolor)
sQ0 = Slider(axQ0, 'init_Temp', 0, 0.1, valinit=Q0)
sNmax = Slider(axNmax, 'N_max', 1000, 100000, valinit=Nmax)
sN0 = Slider(axN0, "init_N",1,10,valinit=N0)