spring_sweep_ode, a Python code which computes a grid of solutions to a parameterized system of ordinary differential equations (ODE) that represent the motion of a spring with mass m, damping b, and stiffness k.
Consider the parameterized second order differential equation:
m x'' + b x' + k x = 0which represents the behavior of a spring mass system with a mass of m, a spring constant of k and a damping coefficient b.
We now suppose that we are interested in properties of the solution x(t) over the time interval from 0 to 25 seconds, as we vary the physical properties b and k. In particular, we would like to know the maximum value of x(t) over the time interval for each choice of the physical parameters.
To answer this question, we must solve the ODE for each choice of the parameters.
The basic function has the form:
function peakVals = ode_fun ( bVals, kVals )where
The computer code and data files described and made available on this web page are distributed under the MIT license
spring_sweep_ode is available in a MATLAB version and an Octave version and a Python version.
python_ode, Python codes which sets up various systems of ordinary differential equations (ODE).