# OK to post homework # Vikrant, Feb 13 2022, Assignment 7 # ================================================================================ # 0. Code that has been given. # ================================================================================ read("C7.txt"): # ================================================================================ # 1. Valentine. # ================================================================================ (* randomize(296337491): with(plots): RoseCardioid:= t->t^2*(1 - sin(t)): layers:= 10: R:= { plot(RoseCardioid(t),t=0..layers*Pi+Pi/2,coords=polar,axes=none,color="Red"), plot(RoseCardioid(t),t=-layers*Pi+Pi/2..0,coords=polar,axes=none,color="Crimson") }: c:= ["RosyBrown","Pink"]: T:= {textplot([990,-1550,"I love Bernoulli(1/2)!"],rotation=Pi/4)}: g:= 10: for i from 0 to 3 do s:= 30+20*i: t:= [seq([RoseCardioid(Pi*t/g)-t,Pi*t/g,2-LoadedCoin(1/2),rotation=Pi*t/g+Pi/2,font=["times","roman",s/5]],t=s+3..s+g)]: T:= T union {textplot(t,coords=polar,color=c[LoadedCoin(1/2)])}: s:= -30-20*i: t:= [seq([RoseCardioid(Pi*t/g)+t,Pi*t/g,2-LoadedCoin(1/2),rotation=Pi*t/g+Pi/2,font=["times","roman",-s/5]],t=s..s+g-3)]: T:= T union {textplot(t,coords=polar,color=c[LoadedCoin(1/2)])}: od: display(R union T); *) # ================================================================================ # 2. TypeCounts22. # ================================================================================ TypeCounts22:= proc(K1,K2) local G,i: local Gs:= [seq(RG(2,2,K1),i=1..K2)]: evalf( [ nops([seq(`if`(nops(NE(G))=1,1,NULL),G in Gs)]), nops([seq(`if`(nops(NE(G))=2 and nops(MNE22(G))-nops(NE(G))=0,1,NULL),G in Gs)]), nops([seq(`if`(nops(NE(G))=0 and nops(MNE22(G))=1,1,NULL),G in Gs)]), nops([seq(`if`(nops(NE(G))=2 and nops(MNE22(G))-nops(NE(G))=1,1,NULL),G in Gs)]) ]/K2 ): end: (* randomize(1783538750): for i from 1 to 5 do print(TypeCounts22(10^8,10^4)): od: # Experiment 1 # [0.7512000000, 0., 0.1258000000, 0.1230000000] # Experiment 2 # [0.7445000000, 0., 0.1243000000, 0.1312000000] # Experiment 3 # [0.7503000000, 0., 0.1249000000, 0.1248000000] # Experiment 4 # [0.7517000000, 0., 0.1227000000, 0.1256000000] # Experiment 5 # [0.7480000000, 0., 0.1280000000, 0.1240000000] *) # ================================================================================ # 3. Why two pure Nash Equilibria implies the existence of a strictly mixed one. # ================================================================================ # Just exhaust all 16 configurations of Best Response Correspondences and we will find exactly two with two Pure Nash Equilibria, and both of them have a strictly Mixed Nash Equilibrium. # ================================================================================ # 4. Limiting values of TypeCounts22 experiments. # ================================================================================ # [3/4, 0, 1/8, 1/8]. # For the first, exactly 12 of the 16 configurations of Best Response Correspondences have exactly one Pure Nash equilibrium. # For the second, none of the 16 configurations of Best Response Correspondences have exactly two Pure Nash equilibria and no strictly Mixed Nash Equilibria. # For the third, exactly 2 of the 16 configurations of Best Response Correspondences have no Pure Nash equilibria and exactly one strictly Mixed Nash Equilibrium. # For the fourth, exactly 2 of the 16 configurations of Best Response Correspondences have exactly two Pure Nash equilibria and exactly one strictly Mixed Nash Equilibrium. # ================================================================================ # 5. PayOffGG. # ================================================================================ PayOffGG:= proc(G,p1,p2) local i,j: if add(p1)<>1 or add(p2)<>1 or nops(G)<>nops(p1) or nops(G[1])<>nops(p2) then return(FAIL): fi: expand(add(add(p1[i]*p2[j]*G[i][j],i=1..nops(p1)),j=1..nops(p2))): end: