56星座屋
当前位置: 首页 星座百科

关于mathematica的初级问题(研读分享一看就会的图文教程-Mathematica)

时间:2023-07-05 作者: 小编 阅读量: 1 栏目名: 星座百科

众所周知,对一些典型的常微分方程,能求解出它们的一般表达式,并用初始条件确定表达式中的任意常数。对于更加广泛的、非线性的一般的常微分方程,通常不存在初等函数解析解。其中由于龙格-库塔法的精度较高,计算量适中,所以使用得较广泛。数值解的最大优点是不受方程类型的限制,即可以求任何形式常微分方程的特解,但是求出的解只能是数值解。

分享兴趣、传播快乐、增长见闻、留下美好,大家好,这里是LearningYard学苑,今天小编为大家带来文章:一看就会的图文教程-Mathematica(4)。

Share your interests, spread happiness, increase your knowledge, and stay good. Hello, everyone. This is LearningYard Academy. Today, the editor brings you an article: A graphic tutorial-Mathematica (4).

01 今日内容介绍:Introduction of today's content:

上一期为大家介绍了用Mathematica建立政府-企业的两方演化博弈模型,并进行了计算(附上链接「研读分享」一看就会的图文教程-Mathematica(3)),今天我们一起学习如何用Matlab实现演化博弈的仿真。

In the last issue, I introduced the use of Mathematica to build a government-enterprise two-party evolutionary game model, and performed calculations (attach the link). Today we will learn how to use Matlab to realize evolutionary game simulation.

02 为什么要仿真Why emulate?

案例1(见下文):我们对之前建立博弈模型仿真,是为了直观地观察政府(y=政府决定管制企业的逆向物流的概率)、企业决策的概率(x=企业决定构建逆向物流的概率)之间的关系。

案例2(见下文):引入时间t作为自变量,观察随着时间的变化,政府和企业会倾向于哪种决策。

案例3(见下文):更进一步地,我们可以增加新的供应链参与者(如消费者)考察,消费者企业-政府的三方博弈如何进行。

Case 1 (see below): We established the game model simulation before, in order to intuitively observe the government (y=the probability that the government decides to regulate the reverse logistics of the enterprise) and the probability of corporate decision-making (x=the probability that the enterprise decides to construct the reverse logistics) The relationship between.

Case 2 (see below): Introduce time t as an independent variable, and observe which decisions the government and enterprises prefer over time.

Case 3 (see below): Further, we can add new supply chain participants (such as consumers) to examine how the consumer-business-government tripartite game is conducted.

03 如何仿真How to simulate?

上期结论

首先需要解释一下上一期提到的“复制动态方程”的含义。First, I need to explain the meaning of the "copy dynamic equation" mentioned in the previous issue.

(附上上一期算例分析中得到的结果。)

(Attach the results obtained in the analysis of the previous calculation.)

常微分方程

其次,我们要了解如何求解常微分方程?Second, we need to understand how to solve ordinary differential equations?

众所周知,对一些典型的常微分方程,能求解出它们的一般表达式,并用初始条件确定表达式中的任意常数。但实际中存在有这种解析解的常微分方程的范围十分狭窄,往往只局限在线性常系数微分方程(含方程组),以及少数的线性变系数方程。对于更加广泛的、非线性的一般的常微分方程,通常不存在初等函数解析解。由于实际问题求解的需要,求近似的数值解成为了解决问题的主要手段。常见的求数值解的方法有欧拉折线法、阿当姆斯法、龙格-库塔法与吉尔法等。其中由于龙格-库塔法的精度较高,计算量适中,所以使用得较广泛。

数值解的最大优点是不受方程类型的限制,即可以求任何形式常微分方程的特解(在解存在的情况下),但是求出的解只能是数值解。

As we all know, some typical ordinary differential equations can be solved in their general expressions, and initial conditions can be used to determine any constants in the expressions. However, in practice, the scope of ordinary differential equations with such analytical solutions is very narrow, often limited to linear constant coefficient differential equations (including equations), and a few linear variable coefficient equations. For more extensive, non-linear general ordinary differential equations, there is usually no analytical solution of elementary functions. Due to the need for solving practical problems, seeking approximate numerical solutions has become the main method to solve problems. Common methods for finding numerical solutions include Euler's broken line method, Adams method, Runge-Kutta method and Gil method. Among them, the Runge-Kutta method has high accuracy and moderate calculation amount, so it is widely used.

The biggest advantage of numerical solution is that it is not limited by the type of equation, that is, it can find the special solution of any form of ordinary differential equation (when the solution exists), but the solution obtained can only be a numerical solution.

Ode45函数:

说明:ode45函数是基于龙格库塔法(Runge-Kutta法),专门用于解微分方程的功能函数。

格式:[T,Y] = ode45(‘定义常微分函数的文件名(该函数文件必须返回一个列向量)’,T的范围,y的初始值)。其中,T为离散的自变量值,Y为离散的函数值。

意义:ode函数是基于T的变化,将常微分方程的求解结果,展示在Y中,Y会以列向量的格式输出为结果。所以,T被称为返回列向量的时间点,Y被称为返回对应T的求解列向量。

Ode45 function:

Description: The ode45 function is based on the Runge-Kutta method (Runge-Kutta method), and is specifically used to solve the functional function of differential equations.

Format: [T,Y] = ode45 ('the file name that defines the ordinary differential function (the function file must return a column vector)', the range of T, the initial value of y). Among them, T is the value of the discrete independent variable, and Y is the value of the discrete function.

Significance: The ode function is based on the change of T, and displays the solution result of the ordinary differential equation in Y, and Y will be output as a result in the format of a column vector. Therefore, T is called the time point of returning the column vector, and Y is called returning the solution column vector corresponding to T.

04 本期方法总结Summary of methods in this issue

1. 首先,无论是两方博弈还是三方博弈的仿真,需要先定义常微分函数,运用matlab中的function函数来定义。

比如在两方博弈中,存在由概率x,y表示的一组微分方程(对应本算例中得到的复制动态方程),我们需要先将原微分方程转做换元处理。下图中用一个例子来帮助理解。

1. First of all, whether it is a two-party game or a three-party game simulation, you need to define the ordinary differential function first, and use the function function in matlab to define it.

For example, in a two-party game, there is a set of differential equations represented by probabilities x and y (corresponding to the replicated dynamic equation obtained in this example). We need to first convert the original differential equation into a conversion element. An example is used in the figure below to help understand.

2.然后,进行绘图工作(用plot命令绘制命令)。

Then, carry out the drawing work (use the plot command to draw the command).

05 基于两方博弈的仿真Simulation based on two-party game

案例1:基于企业和政府的两方博弈仿真

Case 1: Two-party game simulation based on enterprise and government.

案例2:引入时间t的两方博弈仿真

Case 2: Two-party game simulation at time t is introduced.

06 基于三方博弈的仿真Simulation based on the tripartite game

案例3:基于企业、政府、消费者的三方博弈

Case 3: Based on the three-party game simulation of enterprises, governments, and consumers.

07 将案例3用二维图表示Represent Case 3 in a two-dimensional diagram

往期精彩:

一看就会的图文教程-Mathematica(1)

一看就会的图文教程-Mathematica(2)

「研读分享」一看就会的图文教程-Mathematica(3)

-END-

今天的分享就到这里啦!

感兴趣的同学可以留言与小编交流,

咱们下周见!

参考资料:

[1] 田琦师姐的学习文档。

[2] matlab中常微分方法,MATLAB常微分方程https://blog.csdn.net/weixin_35812582/article/details/115814959.

[3] matlab求解常微分方程(组)---dsolve、ode系列函数详解(含例程)https://blog.csdn.net/lynn15600693998/article/details/86597068.

[4] 知乎:浅谈用Matlab求解微分方程https://zhuanlan.zhihu.com/p/162296418.

翻译:Google翻译。

本文由LearningYard学苑整理并发出,部分资料来自网络,若有侵权请联系!

    推荐阅读
  • 形成酸雨的主要气体是什么(形成酸雨的主要气体)

    以下内容大家不妨参考一二希望能帮到您!形成酸雨的主要气体是什么酸雨是指PH小于5.6的雨雪或其他形式的降水,形成的主要气体有二氧化硫、三氧化硫、硫化氢、二氧化氮。酸雨主要是人为的向大气中排放大量酸性物质所造成的。酸雨又分硝酸型酸雨和硫酸型酸雨。

  • 木棉花的花语是什么(木棉花的意义)

    接下来我们就一起去了解一下吧!珍惜眼前的幸福,珍惜身边的人给他们快乐与幸福。它的花期通常在3月或者4月份,在这一段时间盛开,而传说中四月的第十一天,是木棉花盛开的日子,所以4月11被定为木棉花的日子。

  • 炒凉皮不碎技巧(炒凉皮不碎有什么技巧)

    以下内容大家不妨参考一二希望能帮到您!炒凉皮不碎技巧炒凉皮不碎技巧:就是在做凉皮时不能炒太久,变软会失去筋度。胡萝卜切丝,蒜薹切段,葱切花,猪肉切丝,大蒜拍扁。成品凉皮一张张卷起切粗条,抖散备用。生抽,白糖,盐,鸡精,醋,胡椒粉调成汁备用。热锅倒适量食用油烧热加入大蒜,肉丝翻炒至金黄,加入胡萝卜丝和蒜薹炒熟,凉皮翻炒均匀后随即淋入调好的汁儿翻炒均匀。

  • 近几年灭绝的鱼(瞭望在长江源寻鱼)

    长江被誉为我国淡水渔业的摇篮、鱼类基因的宝库。据青海省渔业部门统计,长江流域青海段分布有土著鱼类21种。因此,严格意义上长江源的关键鱼类指的是裂腹鱼中的小头裸裂尻鱼。2019年,李伟带领团队参加长江源科考时,将小头裸裂尻鱼列为长江源鱼类研究的代表对象。2019年4月,科考小组五个人,两台车,开始了沿河寻觅之旅。“全球平均气温上升已是科学界的共识,位于青藏高原的长江源是全球气候变化的敏感区。”科考发现,江源地区

  • 鹧鸪在什么时候季节鸣叫(鹧鸪的孵化期有多长)

    鹧鸪在什么时候季节鸣叫鹧鸪一般会在繁殖季节鸣叫,繁殖期为3-6月,3-4月间开始求偶交配。求偶期间鸣叫更为频繁,常在山岩、树桩、灌木或乔木枝上鸣叫,尤以黎明和黄昏时更甚,往往是一鸟先鸣叫,其他雄鸟一起跟随,此起彼伏。鹧鸪的孵化期在21天左右,雏鸟出壳后不久即可跟随亲鸟活动。鹧鸪的繁殖期为每年的3-6月,3-4月间开始求偶交配,每窝产卵3-6枚,多时可达8枚,卵为椭圆形或梨形,颜色为淡皮黄色至黄褐色。

  • 秋天的诗词(这些都是关于秋天的诗句)

    迢迢新秋夕,亭亭月将圆《戊申岁六月中遇火》,今天小编就来说说关于秋天的诗词?《戊申岁六月中遇火》自古逢秋悲寂寥,我言秋日胜春朝。《秋词》是处红衰翠减,苒苒物华休。惟有长江水,无语东流。宋·柳永《八声甘州》落时西风时候,人共青山都瘦。《昭君怨》雨色秋来寒,风严清江爽。《酬裴侍御对雨感时见赠》秋声万户竹,寒色五陵松。唐·李颀《望秦川》秋色无远近,出门尽寒山。宋·苏轼《九日次韵王巩》

  • 广州有几种车牌(广州车牌你有吗)

    在广州的普通上班族,有房贷还想拥有一辆车,已经不容易了。但有车想让个广州牌,那更是难上加难,再加之限行,参与摇号,竞价的人是越来越多,那中标的机会更是渺茫了!截止日期是8日24时止。9月拟配置的中小客车增量指标共16313个,是这样分配的:1.以摇号方式向单位和个人配置节能车增量指标7285个,其中,单位指标100个,个人指标7185个。

  • qq注销账号有哪几个步骤(QQ将开注销帐号功能)

    1999年2月10日,一个名为OICQ、只有几百K的软件正式上线。当时,腾讯方面表示,这是QQ团队对帐号注销功能的灰度测试。网友截图出于安全考虑,也有网友表示支持有人说,QQ不推出注销服务有自己的考虑,这是为了防止用户QQ密码被他人知道后恶意注销,给用户带来无法挽回的损失。腾讯2018年第三季度财报显示,QQ智能终端月活跃账户同比增长6.9%至6.979亿。

  • 高跟鞋不合脚怎么办(穿高跟鞋不合脚怎么办)

    4、合理利用袜子,如果不喜欢垫各种鞋垫的朋友,可以穿一双船袜,再穿高跟鞋,那样既不影响穿着效果,也不影响美观,也是比较简单和实用的方法。

  • 年四旺名字打分104分 年四旺事迹

    文章目录:一、年四旺相关名字打分113二、年四旺相关名字评分115三、年四旺相关名字推荐四、年四旺相关名字大全五、其他人还看了一、年四旺相关名字打分113年灯石志明年橘纪红兵武尊道后书法孔多塞年贷款孙敬媛年立秋里蓝业珍冯景华年见朱诗词林于思冯桂年粤日林格孟昭毅年家薛邑马布鱼鲁初雪苏沫沫卜庆中年上年掌柜秦源达刘登龙严学锋国韵酒年线高成江裘梦年维泗红沙日年周王克斌王翔千毛淑红龙威信李万和年神范小慧王大