I am looking for equivalent of Matlab's expm() function in python. Can someone help me? Here is the Matlab explanation for the expm() function.
https://www.mathworks.com/help/matlab/ref/expm.html
Thank you
CodePudding user response:
I think the python equivalent is scipy.linalg.expm
See scipy documentation: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.expm.html
The following code replicates the Matlab example given in your link to the documentation.
import numpy as np
from scipy.linalg import expm
A = np.array([[1, 1, 0], [0, 0, 2], [0, 0, -1]])
expm(A)
Out[3]:
array([[2.71828183, 1.71828183, 1.08616127],
[0. , 1. , 1.26424112],
[0. , 0. , 0.36787944]])