본문 바로가기
파이썬

파이썬에서 행렬을 표현하는 방법

by º기록 2020. 11. 21.
반응형

파이썬으로 행렬을 어떻게 표현할 수 있습니까?

 

해결 방법

 


from numpy import matrix
from numpy import linalg
A = matrix( [[1,2,3],[11,12,13],[21,22,23]]) # Creates a matrix.
x = matrix( [[1],[2],[3]] )                  # Creates a matrix (like a column vector).
y = matrix( [[1,2,3]] )                      # Creates a matrix (like a row vector).
print A.T                                    # Transpose of A.
print A*x                                    # Matrix multiplication of A and x.
print A.I                                    # Inverse of A.
print linalg.solve(A, x)     # Solve the linear equation system.

 

참조 페이지 https://stackoverflow.com/questions/3127404

 

 

반응형

댓글