我正在使用 scipy.integrate 的 odeint 包求解一组耦合微分方程。
对于整合时间,我有:
t=numpy.linspace(0,8e+9,5e+06)
Run Code Online (Sandbox Code Playgroud)
其中 5e+06 是时间步长。
然后我绘制我有这样的方程:
plt.xscale('symlog') #x axis logarithmic scale
plt.yscale('log',basey=2) #Y axis logarithmic scale
plt.gca().set_ylim(8, 100000) #Changing y axis ticks
ax = plt.gca()
ax.yaxis.set_major_formatter(matplotlib.ticker.ScalarFormatter())
ax.xaxis.set_major_formatter(matplotlib.ticker.ScalarFormatter())
plt.title("Example graph")
plt.xlabel("time (yr)")
plt.ylabel("quantity a")
plt.plot(t,a,"r-", label = 'Example graph')
plt.legend(loc='best')
Run Code Online (Sandbox Code Playgroud)
其中 a 是时间因变量。(这只是众多图表中的一张。)
然而,图表看起来有点参差不齐,而不是振荡,我得到这个错误:
OverflowError: Exceeded cell block limit (set 'agg.path.chunksize' rcparam)
Run Code Online (Sandbox Code Playgroud)
我不太确定这个错误意味着什么,我看过其他答案,但不知道如何实现“agg.path.chunksize”。
此外,集成 + 绘图需要大约 7 个小时,而且还有一些 CPU 处理技巧,所以我真的不想实现任何会增加时间的东西。
我怎样才能克服这个错误?
我试图减少时间步长,但是我得到了这个错误:
Excess work done on this call (perhaps wrong Dfun type).
Run with full_output = …Run Code Online (Sandbox Code Playgroud)