python - 在python中获取矩阵的形容词
问题描述
我在解决通过给定辅因子矩阵的公式找到矩阵的佐词时遇到了一些问题
c[i][j] = (-1)**(i+j)*m[i][j]
其中 m 代表矩阵的行列式。
x = np.array([[1,3,5],[-2,-4,-5],[3,6,1]] , dtype = 'int')
我只能做到这一点,不知道如何继续,请帮助
找到辅因子我有这个提示 def COF(C) 创建一个空矩阵 CO
for row
for col
sel_rows = all rows except current row
sel_columns = all cols except current col
MATij = [selected rows and selected columns]
compute COij
return CO
解决方案
import numpy as np
x = np.array([[1,3,5],[-2,-4,-5],[3,6,1]] , dtype = 'int')
m = np.linalg.det(x)
c =[[i for i in range(3)] for j in range(3)]
for i in range(3):
for j in range(3):
c[i][j] = (-1)*(i+j)*m
推荐阅读
- r - 在 R 中的多个子组列上创建具有 wilcox.test p 值的表
- html - 什么是更好的实践用途或可访问性?
- javascript - 为什么第一行不是函数?
- python - 如何跟踪 discord.py 中的列表
- c++ - 我可以避免在模板实例化期间明确写出我的类模板参数类型吗?
- python - 如何使用 Selenium 在循环中追加
- python-3.x - 两个或多个列表的所有可能组合(包括所有子集组合)
- javascript - 如何在 Electron 中将窗口图标设置为缓冲区图像?
- python - 如何在不使用打印的情况下在函数内部的python中垂直返回列表的所有值
- c++ - 在按钮上绘制资源图标