Python solve_ivp [scipy.integrate]:你的积分过程输出点数怎么设置?

Python solve_ivp [scipy.integrate]: how to set the number of output points of your integration process?

我想对具有不同初始条件的同一个微分方程进行积分,我想比较我得到的每个点。不幸的是,如果我这样做:

sol = solve_ivp(my_model, [0, leng], [1,1,1], method="LSODA", args=(rho, sigma, beta), dense_output=False)

sol_2 = solve_ivp(my_model, [0, leng], [1+0.001,1+0.001, 1-0.001], method="LSODA", args=(rho, sigma, beta), dense_output=False)

这两个积分过程得到的点数不同

我不想使用插值程序,因为我想使用 真实数据

我可以设置解的点数吗?

比较初始条件不同的实例的一种变体是将它们全部整理到一个大系统中,在该系统中它们都使用相同的步骤序列同时求解

def multi_Lorenz(t,u):
    return np.concatenate([Lorenz(t,uu) for uu in u.reshape([-1,3])])

u0 = np.concatenate([[1+k*1e-5,1+k*1e-5,1-k*1e-5] for k in range(11)])
res = solve_ivp(multi_Lorenz,[1,25],u0, method="LSODA")

plt.figure(figsize=(14,6))
plt.plot(res.t, res.y[::3].T)
plt.grid(); plt.show()

解决方案系列的可见分裂位于 t=22,但是在作为参考的 k=0 图表的差异中,初始差异的十倍增加几乎立即发生在尖峰中大约 t=1 并保持在 t=12

之前的范围内
N = max(k for k,t in enumerate(res.t) if t<12)
plt.figure(figsize=(14,6))
plt.plot(res.t[:N], (res.y[3::3,:N]-res.y[0,:N]).T)
plt.grid(); plt.show()