expm_multiply(A, B, start=None, stop=None, num=None, endpoint=None)
The optional arguments defining the sequence of evenly spaced time points are compatible with the arguments of numpy.linspace
.
The output ndarray shape is somewhat complicated so I explain it here. The ndim of the output could be either 1, 2, or 3. It would be 1 if you are computing the expm action on a single vector at a single time point. It would be 2 if you are computing the expm action on a vector at multiple time points, or if you are computing the expm action on a matrix at a single time point. It would be 3 if you want the action on a matrix with multiple columns at multiple time points. If multiple time points are requested, expm_A_B[0] will always be the action of the expm at the first time point, regardless of whether the action is on a vector or a matrix.
The operator whose exponential is of interest.
The matrix or vector to be multiplied by the matrix exponential of A.
The starting time point of the sequence.
The end time point of the sequence, unless :None:None:`endpoint`
is set to False. In that case, the sequence consists of all but the last of num + 1
evenly spaced time points, so that :None:None:`stop`
is excluded. Note that the step size changes when :None:None:`endpoint`
is False.
Number of time points to use.
If True, :None:None:`stop`
is the last time point. Otherwise, it is not included.
The result of the action $e^{t_k A} B$ .
Compute the action of the matrix exponential of A on B.
>>> from scipy.sparse import csc_matrix
... from scipy.sparse.linalg import expm, expm_multiply
... A = csc_matrix([[1, 0], [0, 1]])
... A.toarray() array([[1, 0], [0, 1]], dtype=int64)
>>> B = np.array([np.exp(-1.), np.exp(-2.)])
... B array([ 0.36787944, 0.13533528])
>>> expm_multiply(A, B, start=1, stop=2, num=3, endpoint=True) array([[ 1. , 0.36787944], [ 1.64872127, 0.60653066], [ 2.71828183, 1. ]])
>>> expm(A).dot(B) # Verify 1st timestep array([ 1. , 0.36787944])
>>> expm(1.5*A).dot(B) # Verify 2nd timestep array([ 1.64872127, 0.60653066])
>>> expm(2*A).dot(B) # Verify 3rd timestep array([ 2.71828183, 1. ])See :
The following pages refer to to this document either explicitly or contain code examples using this.
scipy.sparse.linalg._expm_multiply.expm_multiply
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them