【问题标题】:How to solve the determinant matrix with words using python? there are how solve using the word x in python? [duplicate]如何使用python用单词解决行列式矩阵?在python中使用单词x如何解决? [复制]
【发布时间】:2020-06-09 16:39:10
【问题描述】:

如何使用 python 求解这个矩阵的行列式? 在python中使用x这个词是怎么解决的?

p = np.array([[x, 1],
              [1, x]])

【问题讨论】:

  • 试试np.linalg.det(p)。

标签: python arrays matrix word determinants


【解决方案1】:

numpy.linalg.det() 函数计算输入矩阵的行列式。

例子:

import numpy as np
a = np.array([[1,2], [3,4]]) 
print np.linalg.det(a)

【讨论】:

  • 你好,python中使用x这个词怎么解决?
  • 如果您想在 Python 中进行“符号计算”(重新排列符号而不是使用实际数字),您将需要 sympy 库。试试看: x = symbols(['x']) # 把x转成符号变量 p = np.array([[x, 1], [1, x]])
猜你喜欢
  • 1970-01-01
  • 2017-04-18
  • 2021-10-12
  • 2022-07-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-12-17
  • 2021-06-22
相关资源
最近更新 更多