added optional pade expansion degree argument for matrix exponentiation