Код: Выделить всё
omega_z = 422500*2*np.pi
n_dt = 1000 # Resolution (number of time-steps for one omega_z period)
dt = 2*math.pi/(n_dt*omega_z) # Time-step duration
i_init = 2000 # number of periods
n_init = n_dt*i_init # Number of time-steps in total
time_simu = np.linspace(0,n_init*dt,n_init)
sol = solve_ivp(derivs,
t_span = [time_simu[0], time_simu[-1]],
y0 = [2e-6,0],
method='RK45',
t_eval=time_simu,
rtol = 1e-6)
np.savez(filename,
time_simu = time_simu[limits[0]:limits[1]],
r_z = sol.y[0][limits[0]:limits[1]],
v_z = sol.y[1][limits[0]:limits[1]])
Код: Выделить всё
y0
Код: Выделить всё
omega_z = 422500*2*math.pi
dt = 2*math.pi/(n_dt*omega_z)
n_dt = 1000
i_init = 2000
n_init = n_dt*i_init
time_secular = np.linspace(0,n_init*dt,n_init)
# time_simu is the time imported from the data array
< /code>
Сравнение временных шагов < /h2>
Затем, если я сравню временный шаг, я получаю из массива данных (time_simu
Код: Выделить всё
time_secular
Код: Выделить всё
print(time_simu[2] - time_simu[1])
print(time_secular[2] - time_secular[1])
< /code>
Выходы < /p>
2.366865088469783e-09
2.3668650887579883e-09
# ^^^^^^^
Таким образом, разница составляет 2,8820544184511335e-19 , что слишком много, чтобы быть недостающимся точкой в линпрофонах, a + или - 1 в i_init, в Linspace, или когда бы то ни было. Я выполнил операцию в том же порядке, так же, чтобы избежать разных ошибок с плавающей запятой, но, возможно, я что -то упускаю. solve_ivp не может быть причиной, потому что он выводит только x и v , но время я сохраняю его непосредственно от массива. Можно ли быть np.savez ?
Подробнее здесь: https://stackoverflow.com/questions/794 ... mputations