[Numpy-discussion] Matrix Expontial for differenr t.

Till Stensitzki mail.till@gmx...
Mon Jan 28 10:31:26 CST 2013

Hi group,
is there a faster way to calculate the 
matrix exponential for different t's 
than this:

def sol_matexp(A, tlist, y0):
    w, v = np.linalg.eig(A)
    out = np.zeros((tlist.size, y0.size))
    for i, t in enumerate(tlist):
        sol_t = np.dot(v,np.diag(np.exp(-w*t))).dot(np.linalg.inv(v)).dot(y0)
        out[i, :] =  sol_t
    return out

This is the calculates exp(-Kt).dot(y0) for a list a ts.


More information about the NumPy-Discussion mailing list