当前位置:网站首页>第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
边栏推荐
- 什么是抽象类
- ES关于文档的基本操作
- MongoDB数据库笔记
- 谷歌数据中心发生“电力事故”造成 3 人受伤
- 首次入选OSDI顶会!腾讯提出超大规模推荐系统的模型低延时更新方案
- Redis(六)——Redis6的事务和锁机制(未完成,待补)
- Gold, nine, silver and ten job-hopping seasons: technical interview questions and answers on Alibaba, Baidu, JD.com, and Meituan
- ESP8266 Tutorial 2 - Burn AT Firmware
- CodeChef STRMRG String Merging (dp)
- Techches Transformer the join wisdom source the author cao, visual basic model study
猜你喜欢
runtime-core.esm-bundler.js?d2dd:218 Uncaught TypeError: formRef.value?.validate is not a function
STM32 encapsulation ESP8266 a key configuration function: implementations of AP mode and the STA mode switch, server and the client to create
EasyCVR级联时,修改下级平台名称将不同步至上级平台
14道高频手写JS面试题及答案,巩固你的JS基础
STM32封装ESP8266一键配置函数:实现实现AP模式和STA模式切换、服务器与客户端创建
越折腾越好用的 3 款开源 APP
大连理工&鹏城&UAE提出用于伪装目标检测的混合尺度三重网络ZoomNet,性能SOTA!
In August the DB list latest scores - database Engines
短视频软件开发——平台同质化如何破局
让软件飞——“X+”技术揭秘
随机推荐
组合模式:Swift 实现
是什么影响了MySQL性能?
MongoDB database notes
What is affecting MySQL performance?
LeetCode Algorithm 1721. 交换链表中的节点
让软件飞——“X+”技术揭秘
GO文件相关操作使用
Three-phase 380V rectified voltage
商城限时秒杀功能系统
LeetCode Algorithm 1403. 非递增顺序的最小子序列
【FAQ】【Push Kit】 华为怎么设置角标
PTA 7-2 Summation and Counting of Diagonal Elements of Square Matrices Solution
三相380V整流后的电压
2022.8.8-----leetcode.761
FastReport.Net 2022.2.17 Crack
大连理工&鹏城&UAE提出用于伪装目标检测的混合尺度三重网络ZoomNet,性能SOTA!
runtime-core.esm-bundler.js?d2dd:218 Uncaught TypeError: formRef.value?.validate is not a function
金九银十跳槽旺季:阿里、百度、京东、美团等技术面试题及答案
js guessing game source code
Summary of whitespace, space and escape characters in C language