Мой код намного сложнее, но я могу воспроизвести проблему на следующем примере:
Код: Выделить всё
import numpy as np
from scipy.integrate import solve_ivp
def funct(t, y):
return -np.sqrt(y)
def event(t, y):
return y[0]-0.1
if __name__ == '__main__':
event.terminal = True
sol = solve_ivp(funct, t_span=[0, 3], y0=[1], events=event)
Now, I know that the event is computed via an iteration method, so my question would be: is it possible to avoid that during the iterations, the value of y is going below a given threshold and avoid the error/warning? So, something like "if y < 0 then reject the step" or something similar?
Источник: https://stackoverflow.com/questions/781 ... -and-event