pyyeti.expmint.expmint_pow¶
- pyyeti.expmint.expmint_pow(A, h)[source]¶
Compute the matrix exponential and its integrals using the power series expansion.
- Parameters:
A ((M, M) array_like or sparse matrix) – 2D Array or Matrix (sparse or dense) to be exponentiated
h (scalar) – Time step
- Returns:
E ((M, M) ndarray) – Matrix exponential of A*h: exp(A*h)
I ((M, M) ndarray) – Integral of exp(A*t) dt from 0 to h
I2 ((M, M) ndarray) – Integral of exp(A*t)*t dt from 0 to h
Notes
This routine is a simple brute-force alternative to the more elegant and optimized
expmint(). The power series expansions for these matrices are (I = identity):E = I + A*h + (A*h)**2/2! + (A*h)**3/3! + ... I1 = h*(I + A*h/2 + (A*h)**2/3! + (A*h)**3/4! + ...) I2 = h*h*(I/2 + A*h/3 + (A*h)**2/(4*2!) + (A*h)**3/(5*3!) + ...)
Examples
>>> from pyyeti import expmint >>> import numpy as np >>> import scipy.linalg as la >>> np.set_printoptions(4) >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> e, i, i2 = expmint.expmint_pow(a, .05) >>> e array([[ 1.0996, 0.1599, 0.2202], [ 0.3099, 1.3849, 0.46 ], [ 0.5202, 0.61 , 1.6998]])
>>> i array([[ 0.052 , 0.0034, 0.0048], [ 0.0067, 0.0583, 0.01 ], [ 0.0114, 0.0133, 0.0651]])
>>> i2 array([[ 0.0013, 0.0001, 0.0002], [ 0.0002, 0.0015, 0.0003], [ 0.0004, 0.0005, 0.0018]])