from __future__ import division, print_function # Python 3 from sympy import init_printing init_printing(use_latex='mathjax',use_unicode=False) # Affichage des résultats from sympy import Matrix Matrix([[2, 5, 6], [4, 7, 10], [1, 0, 3]]) Matrix(2, 3, [1, 2, 3, 4, 5, 6]) Matrix([1,2,3,4]) M = Matrix([[5, 2], [-1, 7]]) N = Matrix([[0, 4], [0, 5]]) M + N M * N 4 * M M ** 5 M**-1 N**-1 from sympy import I M = Matrix(( (1,2+I,5), (3,4,0) )) M M.transpose() from sympy import I M = Matrix(( (1,2+I,5), (3,4,0) )) M M[0,1] M[1,1] M.row(1) M.col(0) from sympy import ones,zeros ones(2) zeros((2, 4)) from sympy import eye eye(3) from sympy import diag diag(1,2,3) diag(1, 2, Matrix([[7,8],[2,3]])) M = Matrix([[1, 2, 0, 3], [2, 6, 5, 1], [-1, -4, -5, 2]]) M.rref() M = Matrix([[1, 2, 0, 3], [2, 6, 5, 1], [-1, -4, -5, 2]]) M.nullspace() M = Matrix([[2, 5, 6], [4, 7, 10], [1, 0, 3]]) M.det() M = Matrix([[3, -2, 4, -2], [5, 3, -3, -2], [5, -2, 2, -2], [5, -2, -3, 3]]) from sympy.abc import x M.charpoly(x) M.charpoly(x).as_expr() from sympy import factor factor(_) M w = Matrix((1,2,3,4)) v = Matrix((1,1,1,0)) w v M * w M * v 5 * v M.eigenvals() M.eigenvects()