当前位置:网站首页>第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.矩阵与线性变换(矩阵系数与方程组互转)
边栏推荐
猜你喜欢
谷歌数据中心发生“电力事故”造成 3 人受伤
Network Security Note 6 - Digital Certificates and Public Key Infrastructure
OneFlow source code parsing: operator instructions executed in a virtual machine
chart.js horizontal column chart plugin
Several small projects that I have open sourced over the years
STM32封装ESP8266一键配置函数:实现实现AP模式和STA模式切换、服务器与客户端创建
The web project accesses static resources inside the reference jar
GPU accelerated Pinterest recommendation model, the number of parameters increased by 100 times, and the user activity increased by 16%
[Concept of Theory of Knowledge] "Progress in the Theory of Reason" University of Leuven 2022 latest 220-page doctoral dissertation
3D rotating text animation js special effects
随机推荐
负载均衡原理分析与源码解读
js guessing game source code
ECCV 2022 | 视频理解新框架X-CLIP:仅用微调的成本,达到预训练的全能
【Azure云】服务端点和私有链接有什么区别?观点(1)
LeetCode Algorithm 1403. 非递增顺序的最小子序列
MongoDB数据库笔记
2022.8.7-----leetcode.636
2022.8.9-----leetcode.1413
「业务架构」介绍BPMN第二部分-泳道
dedecms supports one-click upload of Word content
14道高频手写JS面试题及答案,巩固你的JS基础
ZZULIOJ 1124: Merge two sorted arrays
杭电多校七 1008-Triangle Game(博弈)
ESP8266-Arduino编程实例-MQ-7一氧化碳传感器驱动
ESP8266 Tutorial 1 - Introduction to ESP8266 Hardware Platform
3 injured in 'electrical accident' at Google data center
技能大赛训练题:组策略一
内存问题难定位,那是因为你没用ASAN
《MySQL高级篇》六、索引的创建与设计原则
GPU accelerated Pinterest recommendation model, the number of parameters increased by 100 times, and the user activity increased by 16%