I try to use events in scipy.integrate.solve_ivp function, but dont understand one thing. From example in docs(https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.solve_ivp.html) i know that i can stop integrate when y position come below 0. It works when i want to track change of sign. But for example i want to stop intagrate when the y-position of my projectile is above 3000 m. I try to add "if condition" in hit_ground function, but it doesnt work.
def hit_ground(t, y):
if y[1] > 3000:
return y[1]
I try to start integrate with y0 = [0, 0, 500, radians(45)], where 500 is velosity an 45 is angle
This is the error i get after i try to run code with this changes:
TypeError: '<=' not supported between instances of 'NoneType' and 'int'
Without this changes it works correctly.