December 2017
Intermediate to advanced
386 pages
10h 42m
English
In order to calculate the Jordan form of a matrix, we will using the jordan_form function available within the sympy package.
In the following code, we will look into obtaining the Jordan form of a given matrix in Python.
import numpy as npfrom sympy import Matrix
a = np.array([[5, 4, 2, 1], [0, 1, -1, -1], [-1, -1, 3, 0], [1, 1, -1, 2]])
m = Matrix(a)
P, J = m.jordan_form()
JMatrix([[1.0, 0, 0, 0],[ 0, 2.0, 0, 0],[ 0, 0, 4.0, 1],[ 0, 0, 0, 4.0]])
Read now
Unlock full access