Engineering, Differential Equations, Science Education, Mathematics Education.
matplotlib.pyplot as plt # function that returns dy/dt def model(y,t): dydt = -0.2 * y return dydt # initial condition y0 = 5 # time points t = np.linspace(0,20) # solve ODE y = odeint(model,y0,t) # print final value of y print("Final value of y is: " + str(y[-1])) # plot results plt.plot(t,y)