當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python sympy.Matrix.row()用法及代碼示例

借助sympy.Matrix.row()方法,我們可以提取矩陣的行。

用法: sympy.Matrix.row()
返回:Return the row of a matrix.

範例1:


在給定的示例中,我們可以看到sympy.Matrix().row()方法用於提取矩陣的行。
# Import all the methods from sympy 
from sympy import *
  
# use the row() method for matrix 
gfg_val = Matrix([[1, 2], [2, 1]]).row(1) 
  
print(gfg_val)

輸出:

[2, 1]

範例2:

from sympy import *
  
# use the row() method for matrix 
gfg_val = Matrix([[1, 2], [2, 3], [23, 45]]).row(2) 
  
print(gfg_val)

輸出:

[23, 45]



相關用法


注:本文由純淨天空篩選整理自Jitender_1998大神的英文原創作品 Python | sympy.Matrix.row() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。