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.

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: 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: $ 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: $ 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