python矩阵中插入矩阵_Python | 矩阵的痕迹
生活随笔
收集整理的這篇文章主要介紹了
python矩阵中插入矩阵_Python | 矩阵的痕迹
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
python矩陣中插入矩陣
The sum of diagonal elements of a matrix is commonly known as the trace of the matrix. It is mainly used in eigenvalues and other matrix applications. In this article, we are going to find the trace of a matrix using inbuilt function numpy.trace(a).
矩陣的對角元素之和通常稱為矩陣的跡線。 它主要用于特征值和其他矩陣應用中。 在本文中,我們將使用內置函數numpy.trace(a)查找矩陣的軌跡 。
Python代碼查找矩陣的痕跡 (Python code to find trace of a matrix)
# Linear Algebra Learning Sequence # Trace of matriximport numpy as npprint('Trace of an 3x3 identity matrix : ', np.trace(np.eye(3)))a = np.arange(9).reshape((3,3))print(' Matrix a :\n', a) print('Trace of Matrix a : ', np.trace(a))Output:
輸出:
Trace of an 3x3 identity matrix : 3.0Matrix a :[[0 1 2][3 4 5][6 7 8]] Trace of Matrix a : 12翻譯自: https://www.includehelp.com/python/trace-of-a-matrix.aspx
python矩陣中插入矩陣
總結
以上是生活随笔為你收集整理的python矩阵中插入矩阵_Python | 矩阵的痕迹的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ruby hash方法_Ruby中带有示
- 下一篇: java 的io流需要学吗_Java I