December 2017
Intermediate to advanced
386 pages
10h 42m
English
Before getting into the details of checking whether a matrix is diagonalizable or not, let us see how to convert any 1D array into a diagonal matrix.
import numpy as np
a= np.array([1,2,3])
np.diag(a)
array([[1, 0, 0], [0, 2, 0], [0, 0, 3]])
You should note that all the elements within the one-dimensional array form the diagonal of the output matrix generated by the diag function within the numpy package. Moreover, the other elements of the output array (apart from the diagonal elements) are 0. In the following code, we will look into checking whether a matrix is diagonalizable or not.
As discussed earlier, ...
Read now
Unlock full access