Impulse Response Integration Method

A tool for simulating dynamical systems.

This method works by measuring the impulse response of the system. If the system is linear and time-invariant then the impulse response completely describes the system. The exact state of the system can be computed by convolving the initial state of the system with the impulse response. This method uses these facts to solve integration problems with efficient matrix-vector multiplications.

Details

Users specify their system with both:

The users system is assumed to be linear and time-invariant.

This method uses the impulse response to advance the state of the system in fixed time steps of length time_step. First compute the impulse response in high fidelity using the Crank-Nicholson method with a variable length time-step. Sample the response at time_step after the impulse. Measure the impulse response of every state and store them in a matrix. Then to advance the state of the integration, multiply that matrix by the state vector.

The impulse response matrix is a square matrix, and so its size is the length of the state vector squared. Naively, this could cause performance issues for systems which have a very large state vector. However in most systems with very large state vectors: most of the states do not interact with each other over the relatively short time_step at which it measures the impulse response. As a result, the impulse responses are mostly zeros and the impulse response matrix can be compressed into a sparse matrix.

If the users system has external inputs then extra steps are necessary to model their interactions. Inputs are not represented in the state vector and the impulse response function is not defined for inputs. Instead the impulse response matrix is measured as a function of the inputs, which are assumed to be constant over the time course of each integration time step. To efficiently compute the function ImpulseResponseMatrix(Inputs): first evaluate this function at a great many input points; then construct an approximation from the exactly known points. An advantage of approximate solutions over closed form equations is that the approximation can handle non-linearities, which allows this method to work for linear systems where the coefficients are non-linear functions of the inputs.

The impulse response integration method runs fast, but can consume a significant amount of time and memory at start up to compute and store the impulse responses.

Example: The Hodgkin Huxley Model

The Hodgkin Huxley model describes the initiation and propagation of action potentials in neurons.

Citation: Ryan Siciliano, 2012, The Hodgkin-Huxley Model: Its Extensions, Analysis and Numerics.

Example: Measuring equivalent resistance

This comic strip poses an interesting problem. The problem does have a known analytic solution, 4/pi - 1/2, but it can also be approximated using numerical methods. I demonstrate how to do this using the impulse response library.

Numerical Solution

Implementation and Results

The source code is an annotated example of how to use this library. Link: impulseresponse/examples/nerdsniping.rs

Result of running the code with a 32x32 grid: text $ time cargo run --example nerd_sniping --release Model Size: 1024 Nodes Equivalent Resistance: 0.8825786612296072 Ohms Exact Answer: 4/PI - 1/2 = 0.7732395447351628 Ohms

Now lets increase the size of the grid to 633x633, and observe that the equivalent resistance is closer to the correct value: text $ cargo run --example nerd_sniping --release Model Size: 400689 Nodes Equivalent Resistance: 0.8416329950362197 Ohms Exact Answer: 4/PI - 1/2 = 0.7732395447351628 Ohms Runtime: 2 days.

The measurement error is approximately 8%.

More Examples