sympy - sympy 提高矩阵元素的权力?
问题描述
我有一个sympy.Matrix
带有象征性的元素。我想将每个元素提升到k
一些k
符号或数字的幂。有没有一种操作可以做到这一点?
解决方案
您可以applyfunc
为此使用:
In [2]: M = Matrix([[1, 2], [3, 4]])
In [3]: M.applyfunc(lambda e: e**2)
Out[3]:
⎡1 4 ⎤
⎢ ⎥
⎣9 16⎦
https://docs.sympy.org/latest/modules/matrices/matrices.html#operations-on-entries
推荐阅读
- r - 如何根据公式生成的名称创建向量列表
- google-chrome - 运行带有扩展的 vscode chrome 调试器
- javascript - 如何在 uglifyJsPlugin 中恢复控制台警报
- javascript - 使用书签启动 WebPageTest.org 的测试
- django - 不断地从服务器向客户端发送数据
- node.js - nodejs lambda发布请求超时
- magento2 - Magento 2 - 在 Braintree 信用卡表格中添加自动填充
- java - 删除工具栏中 ImageView 和后退箭头之间的空间
- java - Spring应用程序基本身份验证通过keycloack
- java - 异步加载 JButton 图标