当前位置:网站首页>第2章-矩阵及其运算-矩阵创建(1)
第2章-矩阵及其运算-矩阵创建(1)
2022-08-10 10:32:00 【伊伊_f】
from sympy.matrices import *
1. 2x2矩阵
Matrix([[1,0], [0,1]])
2.Matrix套嵌
Matrix((
Matrix((
(1,0,0),
(0,1,0)
)),
(0,0,-1)
))
3. 行向量(行矩阵)
Matrix([[1, 2, 3]])
4. 列向量(列矩阵)
Matrix([1, 2, 3])
5.指定行列数
创建2x3矩阵
Matrix(2, 3, [1, 2, 3, 4, 5, 6])
6. 定义函数
def f(i,j):
if i==j:
return 1
else:
return 0
Matrix(4,4,f)
7.使用lambda
Matrix(3, 4, lambda i,j: 1 - (i+j) % 2)
8.单位矩阵
(1)eye(3)
(2)eye(2,3)
9.全零矩阵
(1)zeros(3)
(2)zeros(2,3)
10. 全1矩阵
(1)ones(3)
(2)ones(2,3)
11.对角线矩阵
diag(1,2,3,4)
12.变量矩阵
from sympy.matrices import *
from sympy import symbols
a1,a2,a3,a4=symbols('a1 a2 a3 a4')
b1,b2,b3,b4=symbols('b1 b2 b3 b4')
A=Matrix(2,2,['a1','a2','a3','a4'])
B=Matrix(2,2,['b1','b2','b3','b4'])
C=A*B
C
13.矩阵与线性变换(矩阵系数与方程组互转)
边栏推荐
猜你喜欢
leetcode:334. 递增的三元子序列
ESP8266 Tutorial 1 - Introduction to ESP8266 Hardware Platform
owl.carousel poster card Slider carousel switch
【Azure云】服务端点和私有链接有什么区别?观点(1)
In August the DB list latest scores - database Engines
组合模式:Swift 实现
PPT | 「课件」企业中高层人员安全管理培训(118页)
Gold, nine, silver and ten job-hopping seasons: technical interview questions and answers on Alibaba, Baidu, JD.com, and Meituan
Flutter实战-请求封装(五)之Isolate线程改造
"Chief Engineer" Principal (Principal) engineer's way of training
随机推荐
ESP8266 教程2 — 烧录AT固件
Gartner再次重申了“数据编织”的重要价值
Text selection rounded style border-radius
[C language] Header file #include
, conio is Console Input/Output (console input and output) Three-phase 380V rectified voltage
Redis (six) - transaction and lock mechanism of Redis6 (unfinished, to be supplemented)
js对象转FormData对象(一般用于上传)
gin-gonic/gin使用详解
ESP8266 Tutorial 2 - Burn AT Firmware
3 injured in 'electrical accident' at Google data center
mysql5.7安装部署-yum安装
【Azure云】服务端点和私有链接有什么区别?观点(1)
SQL中的字符串截取函数
LeetCode Algorithm 1721. 交换链表中的节点
突破次元壁垒,让身边的玩偶手办在屏幕上动起来!
对话陈赐靓:哪吒要让高端产品大众化
js猜拳小游戏源码
bus事件总线 使用
bus event bus use
OSSCore 开源解决方案介绍