Horje
Compute Jordan normal form of matrix in Python / NumPy Code Example
Compute Jordan normal form of matrix in Python / NumPy
In [1]: import numpy as np

In [2]: from sympy import Matrix

In [3]: a = np.array([[5, 4, 2, 1], [0, 1, -1, -1], [-1, -1, 3, 0], [1, 1, -1, 2]])

In [4]: m = Matrix(a)

In [5]: m
Out[5]: 
Matrix([
[ 5,  4,  2,  1],
[ 0,  1, -1, -1],
[-1, -1,  3,  0],
[ 1,  1, -1,  2]])

In [6]: P, J = m.jordan_form()

In [7]: J
Out[7]: 
Matrix([
[1, 0, 0, 0],
[0, 2, 0, 0],
[0, 0, 4, 1],
[0, 0, 0, 4]])




Python

Related
"setFlag(QGraphicsItem.ItemIsMovable)" crash Code Example "setFlag(QGraphicsItem.ItemIsMovable)" crash Code Example
cmd clear command for anaconda Code Example cmd clear command for anaconda Code Example
python detect tty Code Example python detect tty Code Example
open python file with read write permissions Code Example open python file with read write permissions Code Example
How to install pandas-profiling Code Example How to install pandas-profiling Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9