Exponential Integration Routine:

A linear dynamical system:

$$\dot{x} = Ax + c(t)$$

Has the exact solution:

$$x(t) = e^{tA}x(0) + \int_0^t e^{(t-\tau)A}c(\tau) d\tau$$

Over a small time interval, $\Delta t$, we can approximate the input, $c(t)$, as a constant. Pulling this term out of the integral we get:

$$x(t + \Delta t) = e^{\Delta t A}x(t) + c(t) \int_0^{\Delta t} e^{(\Delta t - \tau)A} d\tau$$

Which evaluates to:

$$x(t + \Delta t) = e^{\Delta t A}x(t) + A^{-1} (e^{\Delta t A} - 1) c(t) $$

To simplify notation, we define $\Phi = e^{\Delta t A}$, which exactly describes how the state evolves over a time step $\Delta t$ when the input is zero, $c(t) = 0$.

$$x(t + \Delta t) = \Phi x(t) + A^{-1} (\Phi - 1) c(t)$$

In [9]:
length([0:0.1:10])


Out[9]:
101

In [2]:
function test(x)
    x*2
end

test(10)


Out[2]:
20

In [6]:
100.0/0.1 == 1000


Out[6]:
true

In [8]:
expm(eye(10))


Out[8]:
10x10 Array{Float64,2}:
 2.71828  0.0      0.0      0.0      …  0.0      0.0      0.0      0.0    
 0.0      2.71828  0.0      0.0         0.0      0.0      0.0      0.0    
 0.0      0.0      2.71828  0.0         0.0      0.0      0.0      0.0    
 0.0      0.0      0.0      2.71828     0.0      0.0      0.0      0.0    
 0.0      0.0      0.0      0.0         0.0      0.0      0.0      0.0    
 0.0      0.0      0.0      0.0      …  0.0      0.0      0.0      0.0    
 0.0      0.0      0.0      0.0         2.71828  0.0      0.0      0.0    
 0.0      0.0      0.0      0.0         0.0      2.71828  0.0      0.0    
 0.0      0.0      0.0      0.0         0.0      0.0      2.71828  0.0    
 0.0      0.0      0.0      0.0         0.0      0.0      0.0      2.71828

In [ ]: