(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 8735, 293]*) (*NotebookOutlinePosition[ 9790, 329]*) (* CellTagsIndexPosition[ 9746, 325]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{Cell[TextData["CHAPTER 8"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData["Procedures for use in evolutionary game theory"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["The package ", Evaluatable->False, AspectRatioFixed->True], StyleBox["GameTheory", Evaluatable->False, AspectRatioFixed->True, FontWeight->"Bold"], StyleBox[" contains four procedures, ", Evaluatable->False, AspectRatioFixed->True], StyleBox["AllEquilibria", Evaluatable->False, AspectRatioFixed->True, FontWeight->"Bold"], StyleBox[", ", Evaluatable->False, AspectRatioFixed->True], StyleBox["NashEquilibria", Evaluatable->False, AspectRatioFixed->True, FontWeight->"Bold"], StyleBox[", ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ESState", Evaluatable->False, AspectRatioFixed->True, FontWeight->"Bold"], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["ESStrategy", Evaluatable->False, AspectRatioFixed->True, FontWeight->"Bold"], StyleBox[ ". Each procedure takes the payoff matrix of a game as its argument and \ returns a list of the corresponding equilibria. First read in the package and \ find further information about the procedues:", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["<True], Cell[TextData["?AllEquilibria"], "Input", AspectRatioFixed->True], Cell[TextData[ "These procedures are only used explicitly in these solutions in Exercise 6, \ but you may like to use them for other examples."], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["1"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Use pencil and paper."], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["2"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "For the dynamic stability we evaluate dp/dt = f(p) from Equations 7.5 and \ 8.15, check that there is an equilibrium at p = 0.5, and find f'(p) at this \ point."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["whawk=-p+2(1-p);\nwdove=1-p;"], "Input", AspectRatioFixed->True], Cell[TextData["wbar=p whawk + (1-p) wdove;"], "Input", AspectRatioFixed->True], Cell[TextData["f=(whawk-wbar)p;"], "Input", AspectRatioFixed->True], Cell[TextData["Solve[f==0,p]"], "Input", AspectRatioFixed->True], Cell[TextData["D[f,p]/.p->0.5"], "Input", AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["3"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Use pencil and paper."], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["4"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "The following is a general method for studying dynamic stability"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["A={{0,5,-4},{-7,0,8},{-1,2,0}};"], "Input", AspectRatioFixed->True], Cell[TextData["Clear[p]\nfreq=Array[p,3];\nw=A.freq;\nwbar=w.freq;"], "Input", AspectRatioFixed->True], Cell[TextData[ "jac=Table[D[(w[[i]]-wbar)p[i],p[j]]\n\t\t\t-D[(w[[i]]-wbar)p[i],p[3]],\n\t\t\ \t\t{i,2},{j,2}];"], "Input", AspectRatioFixed->True], Cell[TextData["Eigenvalues[jac/.{p[1]->1/3,p[2]->1/3,p[3]->1/3}]"], "Input", AspectRatioFixed->True], Cell[TextData["We now calculate the payoffs for strategies I and J"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["stratI={1/3,1/3,1/3};\nstratJ={0,1/2,1/2};"], "Input", AspectRatioFixed->True], Cell[TextData["stratI.A.stratI"], "Input", AspectRatioFixed->True], Cell[TextData["stratJ.A.stratI"], "Input", AspectRatioFixed->True], Cell[TextData["stratI.A.stratJ"], "Input", AspectRatioFixed->True], Cell[TextData["stratJ.A.stratJ"], "Input", AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["5"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "The following program solves the continuous time differential equation \ numerically from an appropriate set of initial values. [This calculation uses \ a lot of memory. If you don't have enough, reduce the time span to, say, \ 5.]"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "A={{1,10,-10},{-10,1,10},{10,-10,1}};\nx={p[t],q[t],r[t]};\n\ w=100+A.x/.r[t]->1-p[t]-q[t];\nwbar=w.x/.r[t]->1-p[t]-q[t];\n\ soln=NDSolve[{p'[t]==(w[[1]]-wbar) p[t],\n\tq'[t]==(w[[2]]-wbar) q[t],\n\t\t\ p[0]==q[0]==.2},\n\t\t{p,q},{t,10}]\nPlot[Evaluate[p[t]/.soln],{t,0,10}]\n\ Plot[Evaluate[q[t]/.soln],{t,0,10}]\n\ Plot[Evaluate[1-p[t]-q[t]/.soln],{t,0,10}]"], "Input", AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["6"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["I use the game with payoff matrix (9) as an example:"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["A={{1,4},{0,2}};"], "Input", AspectRatioFixed->True], Cell[TextData["NashEquilibria[A]"], "Input", AspectRatioFixed->True], Cell[TextData["ESState[A]"], "Input", AspectRatioFixed->True], Cell[TextData["ESStrategy[A]"], "Input", AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["7, 8, 9, 10"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Use pencil and paper."], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["11"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Find the equilibrium value:"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["w=(1-(1-x)(1-y)/2)(1-x^2);"], "Input", AspectRatioFixed->True], Cell[TextData["diff=D[w,x]/.y->x"], "Input", AspectRatioFixed->True], Cell[TextData["vstar=x/.FindRoot[diff==0,{x,.5}]"], "Input", AspectRatioFixed->True], Cell[TextData["Check that it is a Nash equilibrium:"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["D[w,{x,2}]/.{x->vstar,y->vstar}"], "Input", AspectRatioFixed->True], Cell[TextData["Check for continuous stability:"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["D[w,{x,2}]+D[w,x,y]/.{x->vstar,y->vstar}"], "Input", AspectRatioFixed->True], Cell[TextData["Plot the best-reply function:"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["d=D[w,x]"], "Input", AspectRatioFixed->True], Cell[TextData["v[y_]:=x/.FindRoot[d==0,{x,.5}]"], "Input", AspectRatioFixed->True], Cell[TextData["Plot[{v[y],y},{y,0.01,0.99}]"], "Input", AspectRatioFixed->True]}, Open]]}, Open]] }, FrontEndVersion->"Macintosh 3.0", ScreenRectangle->{{0, 640}, {0, 460}}, WindowToolbars->{}, CellGrouping->Manual, WindowSize->{520, 365}, WindowMargins->{{36, Automatic}, {15, Automatic}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False}, MacintoshSystemPageSetup->"\<\ AVU/IFiQKFD000000V:^/09R]g0000000OVaH097bCP0AP1Y06`0I@1^0642HZj` 0V:gT0000001nK500TO9>000000000000000009R[[0000000000000000000000 00000000000000000000000000000000\>" ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1731, 51, 86, 2, 70, "Section", Evaluatable->False], Cell[CellGroupData[{ Cell[1840, 55, 126, 2, 70, "Subsection", Evaluatable->False], Cell[1969, 59, 1245, 44, 70, "Text", Evaluatable->False], Cell[3217, 105, 67, 1, 70, "Input"], Cell[3287, 108, 67, 1, 70, "Input"], Cell[3357, 111, 201, 4, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[3590, 117, 81, 2, 70, "Subsection", Evaluatable->False], Cell[3674, 121, 95, 2, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[3801, 125, 81, 2, 70, "Subsection", Evaluatable->False], Cell[3885, 129, 235, 5, 70, "Text", Evaluatable->False], Cell[4123, 136, 81, 1, 70, "Input"], Cell[4207, 139, 80, 1, 70, "Input"], Cell[4290, 142, 69, 1, 70, "Input"], Cell[4362, 145, 66, 1, 70, "Input"], Cell[4431, 148, 67, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[4530, 151, 81, 2, 70, "Subsection", Evaluatable->False], Cell[4614, 155, 95, 2, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[4741, 159, 81, 2, 70, "Subsection", Evaluatable->False], Cell[4825, 163, 139, 3, 70, "Text", Evaluatable->False], Cell[4967, 168, 84, 1, 70, "Input"], Cell[5054, 171, 104, 1, 70, "Input"], Cell[5161, 174, 149, 3, 70, "Input"], Cell[5313, 179, 102, 1, 70, "Input"], Cell[5418, 182, 125, 2, 70, "Text", Evaluatable->False], Cell[5546, 186, 95, 1, 70, "Input"], Cell[5644, 189, 68, 1, 70, "Input"], Cell[5715, 192, 68, 1, 70, "Input"], Cell[5786, 195, 68, 1, 70, "Input"], Cell[5857, 198, 68, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[5957, 201, 81, 2, 70, "Subsection", Evaluatable->False], Cell[6041, 205, 306, 6, 70, "Text", Evaluatable->False], Cell[6350, 213, 414, 7, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[6796, 222, 81, 2, 70, "Subsection", Evaluatable->False], Cell[6880, 226, 126, 2, 70, "Text", Evaluatable->False], Cell[7009, 230, 69, 1, 70, "Input"], Cell[7081, 233, 70, 1, 70, "Input"], Cell[7154, 236, 63, 1, 70, "Input"], Cell[7220, 239, 66, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[7318, 242, 91, 2, 70, "Subsection", Evaluatable->False], Cell[7412, 246, 95, 2, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[7539, 250, 82, 2, 70, "Subsection", Evaluatable->False], Cell[7624, 254, 101, 2, 70, "Text", Evaluatable->False], Cell[7728, 258, 79, 1, 70, "Input"], Cell[7810, 261, 70, 1, 70, "Input"], Cell[7883, 264, 86, 1, 70, "Input"], Cell[7972, 267, 110, 2, 70, "Text", Evaluatable->False], Cell[8085, 271, 84, 1, 70, "Input"], Cell[8172, 274, 105, 2, 70, "Text", Evaluatable->False], Cell[8280, 278, 93, 1, 70, "Input"], Cell[8376, 281, 103, 2, 70, "Text", Evaluatable->False], Cell[8482, 285, 61, 1, 70, "Input"], Cell[8546, 288, 84, 1, 70, "Input"], Cell[8633, 291, 81, 1, 70, "Input"] }, Closed]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)