Python - Differential Equation - ODE 003 | ![]() |
![]() |
ODE 003 - Code We have the ordinary differential equation: 5*dy/dt = - y(t) + u(t) where y = y(t), the initial value y(0) = 0 and u steps from 0 to 2 at t = 10. To the left you see the code for a Python program solving this differential equation numerically and drawing the graph. The function odeint from the library scipy.integrate solve this differential equation. odeint has three parameters: model : function call where you have the mathematical model in the diff.eq. y0 : initial value t : time arrayThe two first parameters (model and y0) are transferred to the first parameter y in the model function. The body part (line 15-20) of model contains the mathematical model of the diff.eq. |
![]() |
ODE 003 - Graph |