I am trying to solve the following ordinary differential equation: f'(t) = -2 if 300 <= t <= 303 else 0
import scipy.integrate as integr
import matplotlib.pyplot as plt
Y0=25
def f(Y,t):
a= -2 if 300 <=t <= 303 else 0
return a
T=np.linspace(0,500,5000)
sol=integr.odeint(f,Y0,T)
plt.plot(T,sol)
plt.show()
However the result is only a flat line :
[1]: https://i.stack.imgur.com/KAK4F.png
Whereas it works fine if the interval is bigger : 150 <= t <= 350 instead of 300 <= t <= 303
Any idea why?
Thanks in advance