日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > python >内容正文

python

python 生成对称矩阵_对称矩阵| 使用Python的线性代数

發(fā)布時(shí)間:2025/3/11 python 16 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python 生成对称矩阵_对称矩阵| 使用Python的线性代数 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

python 生成對(duì)稱矩陣

Prerequisites:

先決條件:

  • Defining a matrix

    定義矩陣

  • Identity matrix

    身份矩陣

  • Transpose matrix

    轉(zhuǎn)置矩陣

In linear algebra, if the matrix and its transpose are equal, then the matrix is symmetric (MT = M).

在線性代數(shù)中,如果矩陣及其轉(zhuǎn)置相等,則矩陣是對(duì)稱的(MT = M)

In terms of elements of matrices: M(i, j) = M(j, i)

根據(jù)矩陣的元素: M(i,j)= M(j,i)

Following is a python code for demonstrating how to check for Symmetric Matrix.

以下是用于演示如何檢查對(duì)稱矩陣的python代碼。

Method:

方法:

Syntax:M = numpy.array( )transpose_M = M.Tif transpose_M == M:Transpose = True Return:MT

對(duì)稱矩陣的Python代碼 (Python code for symmetric matrices)

# Linear Algebra Learning Sequence # Transpose using different Methodimport numpy as npM = np.array([[2,3,4], [3,45,8], [4,8,78]]) print("---Matrix M---\n", M)# Transposing the Matrix M print('\n\nTranspose as M.T----\n', M.T)if M.T.all() == M.all():print("--------> Transpose is eqaul to M")M = np.array([[2,3,4], [3,45,8]]) print("\n\n---Matrix B---\n", M)# Transposing the Matrix M print('\n\nTranspose as B.T----\n', M.T)if M.T.all() == M.all() and np.shape(M) == np.shape(M.T):print("---------> Transpose is eqaul to B")else:print("---------> Not Transpose!!")

Output:

輸出:

---Matrix M---[[ 2 3 4][ 3 45 8][ 4 8 78]]Transpose as M.T----[[ 2 3 4][ 3 45 8][ 4 8 78]] --------> Transpose is eqaul to M---Matrix B---[[ 2 3 4][ 3 45 8]]Transpose as B.T----[[ 2 3][ 3 45][ 4 8]] ---------> Not Transpose!!

翻譯自: https://www.includehelp.com/python/symmetric-matrices.aspx

python 生成對(duì)稱矩陣

總結(jié)

以上是生活随笔為你收集整理的python 生成对称矩阵_对称矩阵| 使用Python的线性代数的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。