当前位置:网站首页>第3章-线性方程组(3)
第3章-线性方程组(3)
2022-08-10 10:32:00 【伊伊_f】
from sympy.matrices import *
from sympy import symbols,Eq,solve
1.多阶方程组
a11,a12,a13,a14=symbols('a11 a12 a13 a14')
a21,a22,a23,a24=symbols('a21 a22 a23 a24')
a31,a32,a33,a34=symbols('a31 a32 a33 a34')
a41,a42,a43,a44=symbols('a41 a42 a43 a44')
x1,x2,x3,x4=symbols('x1 x2 x3 x4')
b1,b2,b3,b4=symbols('b1 b2 b3 b4')
f1=Eq(a11*x1+a12*x2+a13*x3+a14*x4,b1)
f2=Eq(a21*x1+a22*x2+a23*x3+a24*x4,b2)
f3=Eq(a31*x1+a32*x2+a33*x3+a34*x4,b3)
f4=Eq(a41*x1+a42*x2+a43*x3+a44*x4,b4)
solve([f1,f2,f3,f4],[x1,x2,x3,x4])
结果:
2.二阶方程组
f1=Eq(a11*x1+a12*x2,b1)
f2=Eq(a21*x1+a22*x2,b2)
solve([f1,f2],[x1,x2])

2. 求方程组解
from sympy.matrices import *
from sympy import symbols,Eq,solve
x1,x2,x3,x4=symbols('x1 x2 x3 x4')
f1=2*x1+x2-5*x3+x4-8
f2=x1-3*x2-6*x4-9
f3=2*x2-x3+2*x4+5
f4=x1+4*x2-7*x3+6*x4
fm=solve([f1,f2,f3,f4],[x1,x2,x3,x4])
fm
![]()
或者
x1,x2,x3,x4=symbols('x1 x2 x3 x4')
f1=Eq(2*x1+x2-5*x3+x4,8)
f2=Eq(x1-3*x2-6*x4,9)
f3=Eq(2*x2-x3+2*x4,-5)
f4=Eq(x1+4*x2-7*x3+6*x4,0)
fm=solve([f1,f2,f3,f4],[x1,x2,x3,x4])
fm
![]()
边栏推荐
猜你喜欢

The web project accesses static resources inside the reference jar

mysql5.7安装部署-yum安装

Text selection rounded style border-radius

PPT | 「课件」企业中高层人员安全管理培训(118页)

Redis6 (1) - Introduction to NoSQL Database and Installation of Redis

干货!ASSANet:让PointNet++更快更强

【知识论概念】《理由论的进展》鲁汶大学2022最新220页博士论文

让软件飞——“X+”技术揭秘

mysql5.7 installation and deployment - yum installation

STM32封装ESP8266一键配置函数:实现实现AP模式和STA模式切换、服务器与客户端创建
随机推荐
大连理工&鹏城&UAE提出用于伪装目标检测的混合尺度三重网络ZoomNet,性能SOTA!
Three-phase 380V rectified voltage
ESP8266-Arduino编程实例-MQ-9 一氧化碳可燃气体传感器驱动
JWT implements login authentication + Token automatic renewal scheme
用.bat文件做Airtest脚本的多设备批量运行
"Time Series Database" uses cassandra to scan time series data
mysql5.7 installation and deployment - yum installation
干货!ASSANet:让PointNet++更快更强
ZZULIOJ 1116 Delete elements [delete]
[Microservice Architecture] Microservices and SOA Architecture (2)
使用cpolar远程连接群晖NAS(升级固定链接2)
MySQL executes the query process
[C language] Header file #include
, conio is Console Input/Output (console input and output) 突破次元壁垒,让身边的玩偶手办在屏幕上动起来!
ESP8266-Arduino编程实例-MQ-8氢气传感器驱动
Gartner再次重申了“数据编织”的重要价值
2022.8.9-----leetcode.1413
database transaction
序列化技术ProtoBuf
The usage and difference between getParameter() and getAttribute()