Linear algebra: How to diagonalize a matrix using SymPy with Python

Опубликовано: 19 Октябрь 2024
на канале: tondekush
183
2

Alternative videos here:
Numpy video:    • How to diagonalize a matrix and solvi...  
MATLAB video:    • How to diagonalize a matrix with MATLAB  

Code:
from sympy import *
init_printing()
M = Matrix(3,3,[3,2,0,-1,0,0,2,4,-3])
M.is_diagonalizable()
(P,D) = M.diagonalize()
D == P.inv()*M*P
#mathematics #python #linearalgebra