研读分享一看就会的图文教程Mathematica(4)
分享兴趣、传播快乐、增长见闻、留下美好,大家好,这里是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学苑整理并发出,部分资料来自网络,若有侵权请联系!
杜淳回到以前不容易,安稳用作品说话就好新剧我是真的爱你成为了当下的热门影视剧,靠谱的主演和现实的故事成为了观众爱上这部作品的理由,虽然也有贩卖焦虑的质疑声音此起彼伏,但是对于走心的故事来说还是挺有参考意义的。主演杜淳的
黄轩白百何,我的超级英雄实力可以现在的荧屏影视作品可是相当精彩,各种不同类型的作品轮番登场,更让人惊喜的是曾经的追求流量成风貌似渐渐平息了很多,拼质量和拼口碑的时代来临了,这才是正常健康的行业状态!最近又有一部十
新人入驻需要注意的那些事在注册头条的一千多个日子里,一直都是刷新闻,刷综艺,刷视频,完全没想过会有收益。三天前,才决定试一试,两天破百,开始收益,今天已经有300多个友友的支持了。通过这些天的学习和交流,
果味生活记录第12天明天起,开始新生活今天,是进入头条的第1612天,是千粉之日的第12天,也是我码字回归的第12天。断更昨天,有段时间不联系的小丁突然打电话,让我去做她们办公室的版面设计。电话中说,原来合作的设计师满
又一部年代剧开播,老戏骨们作配,能否超越孙俪的那年花开?文华子最近,一部反映儒商传奇故事的电视剧塞上风云记,在央视电视剧频道开播。作为一部传奇年代剧,往往会将家国情怀淋漓尽致的展现,而这部剧也是如此。故事发生在清朝末年至民国时期,讲述的
浪姐王丽坤淘汰时,郁可唯不知所措抠耳朵,白冰想笑但忍住文郑大州乘风破浪的姐姐新一期如约而至,第三期公演顺利播出。此次淘汰的三个姐姐,与之前网络爆料的完全一致,分别是金莎王丽坤和孟佳。第三次公演总共4个五人团,分别是万茜团的Gentle
浪姐中张雨绮唱跳都不好,但却圈粉无数,她不只是憨文洛小阳乘风破浪的姐姐从一开播,就迅速成为爆款综艺。30位姐姐在这档节目中,再次发光发亮,对于这些已经逐渐消失在大众视野的姐姐们来说,无疑再次迎来了她们事业的第二春。在这30位姐姐
倪萍多次隔空夸董卿,为何很少听到她夸周涛?文郑大州倪萍周涛董卿这三位主持人曾经是央视的三代一姐,她们三个在央视的舞台上,都曾经给观众留下深刻的印象。尤其是春晚,她们都可以说是春晚的一张名片。作为三代央视一姐,她们无论从外在
黄晓明赵薇俞飞鸿,玫瑰之战这阵容可以现在的剧集作品与大银幕作品之间的差异越来越小,不管是阵容还是制作质量上已经越来越深得人心,隔三岔五就出一部的大作成为了观众的期待,既满足了自己看大阵容的愿望,又解决了大荧幕意犹未尽
林更新吴谨言吴奇隆主演,我的砍价女王偶像爱情职业都有面对越来越专业口味越来越挑剔的观众,影视作品也是在绞尽脑汁地变换着手法,除了在硬件上越来越有诚意之外,一些综合实力强大的混搭作品就成为了流行,能够满足不同要求观众的需求,何乐而不为
赵丽颖张译野蛮生长亮眼,励志商战似曾相识现在的赵丽颖早已经是大家心目中的人气女神了,虽然为了家庭蛰伏了一段时间,但是丝毫没有影响她的人气热度,一出场就是王者归来的范儿。虽然很多粉丝因为赵丽颖的离婚事件多了一些惋惜,但是对