41 Ordinary Differential Equations
Ordinary Differential Equations (ODEs) describe how systems change with respect to a single variable, often how they change with time from some specified starting conditions allowing us to solve Initial Value Problems (IVPs). Most of the interesting cases are untidy and non-linear and numerical solutions are necessary to get practical solutions to interacting systems of multiple elements, all changing with time.
Euler’s Method
Transient response for the first order behaviour of a temperature sensor can be represented as an Ordinary Differential Equation (ODE) and solved by Euler’s Method (Python 7.1). Higher order ODEs can be reduced to a set of first order equations that can similarly be solved in parallel (Python 7.2). Euler’s Method has serious problems with numerical instabilities that become explosively obvious if you don’t use a short enough time step. In practice you should always use a more stable solution technique (Python 7.5), and Euler’s Method should be reserved for instructive examples.
Dynamics of the Tank Puzzle
Solving Systems of Differential equations is easy with Euler’s Method. This example shows how, based on a common social media puzzle meme (Python 7.2.1). The first video sets up the flow physics of the problem with a model we can use in our solution. We can follow exactly the same approach to get the rate of change of temperature, dT/dt, for different elements in a system from an energy balance, or to solve the second order equations that result from any system of masses and forces. (video 13:33)
The second video in this example shows how to complete the simulation of the system and see how the tanks fill if the flow isn’t really low. (video 17:50)