Compute the matrix exponential using Taylor series.
A : array, shape(M,M)
Matrix to be exponentiated
q : integer
Order of the Taylor series
expA : array, shape(M,M)
Matrix exponential of A
scipy.linalg.expm2
scipy.linalg.logm