#OK to post homework #Lucy Martinez, 02-13-22, Assignment 6 restart: read `C6.txt`: #----------------------Problem 1-----------------------# #Using procedure RG(a,b,K) of Lecture 5 (also contained in C6.txt ), Create five random games with a=2, b=2, # K= 1000, and for each of these games, pick three random choices of p1 and p2 and run SimulateMG(G,p1,p2,K) # with K=10000, each five times. Make sure that you get similar-looking answers, and compare them to # the output of evalf(PayOffG(G,p1,p2)) # Game 1: G1:=RG(2,2,1000); # G1 := [[[954, 299], [99, 549]], [[196, 282], [351, 16]]] SimulateMG(G1,1/7,1/7,10000); # [313.5553000, 118.4685000] SimulateMG(G1,1/7,1/7,10000); # [315.8190000, 117.0373000] SimulateMG(G1,1/7,1/7,10000); # [310.0414000, 125.0955000] SimulateMG(G1,1/7,1/7,10000); # [315.3049000, 118.8309000] SimulateMG(G1,1/7,1/7,10000); # [312.3834000, 121.2168000] evalf(PayOffG(G1,1/7,1/7)); # [501.9183673, 450.4693878] # Game 2: G2:=RG(2,2,1000); # G2 := [[[478, 582], [374, 846]], [[651, 473], [693, 949]]] SimulateMG(G2,1/12,0.65,10000); # [665.9169000, 940.2553000] SimulateMG(G2,1/12,0.65,10000); # [667.7671000, 940.8527000] SimulateMG(G2,1/12,0.65,10000); # [666.8101000, 940.5437000] SimulateMG(G2,1/12,0.65,10000); # [665.9488000, 940.2656000] SimulateMG(G2,1/12,0.65,10000); # [666.8101000, 940.5437000] evalf(PayOffG(G2,1/12,0.65)); # [647.0250000, 642.5000000] # Game 3: G3:=RG(2,2,1000); # G3 := [[[498, 630], [921, 718]], [[603, 972], [611, 128]]] SimulateMG(G3,7/12,1/3,10000); # [706.4345000, 570.1080000] SimulateMG(G3,7/12,1/3,10000); # [705.4760000, 571.0272000] SimulateMG(G3,7/12,1/3,10000); # [708.4892000, 571.1714000] SimulateMG(G3,7/12,1/3,10000); # [709.5210000, 577.8034000] SimulateMG(G3,7/12,1/3,10000); # [712.0313000, 575.4334000] evalf(PayOffG(G3,7/12,1/3)); # [708.4722222, 572.2777778] # Game 4: G4:=RG(2,2,1000); # G4 := [[[949, 205], [863, 730]], [[470, 961], [694, 648]]] SimulateMG(G4,1/5,2/7,10000); # [681.1969000, 705.8397000] SimulateMG(G4,1/5,2/7,10000); # [681.5089000, 708.1801000] SimulateMG(G4,1/5,2/7,10000); # [683.7733000, 704.7270000] SimulateMG(G4,1/5,2/7,10000); # [682.1247000, 704.7573000] SimulateMG(G4,1/5,2/7,10000); # [681.2981000, 705.3629000] evalf(PayOffG(G4,1/5,2/7)); # [681.5142857, 705.9428571] # Game 5: G5:=RG(2,2,1000); # G5 := [[[890, 818], [873, 769]], [[778, 548], [364, 447]]] SimulateMG(G5,4/9,5/7,10000); # [759.2406000, 644.3612000] SimulateMG(G5,4/9,5/7,10000); # [762.4147000, 647.8939000] SimulateMG(G5,4/9,5/7,10000); # [760.8064000, 647.3895000] SimulateMG(G5,4/9,5/7,10000); # [760.4020000, 646.6308000] SimulateMG(G5,4/9,5/7,10000); # [760.4827000, 646.1005000] evalf(PayOffG(G4,4/9,5/7)); # [707.5238095, 641.9841270] #----------------------Problem 3-----------------------# TragedyOfTheCommons:=proc(v,G,c,n) local deriv, sol: sol:=solve(v-c+(G/n)*diff(v,G)=0,G): sol: end: seq(TagedyOfTheCommons(sqrt(1-G),G,0.5,n),n=1..10); # 0.4108027069, 0.5240408206, 0.5790991062, 0.6120715420, 0.6341606640, 0.6500444109, 0.6620396765, 0.6714307918, 0.6789893673, 0.6852079369 seq(TagedyOfTheCommons((1-G)^(1/4),G,0.5,n),n=1..10); # 0.5980909164, 0.7159713145, 0.7695811633, 0.8009276122, 0.8217454810, 0.8366883478, 0.8479928247, 0.8568756419, 0.8640589838, 0.8700002405 seq(TagedyOfTheCommons((1-G)^(3/4),G,0.5,n),n=1..10); # 0.3111336476, 0.4083516515, 0.4565628023, 0.4855049838, 0.5048474518, 0.5187020389, 0.5291205867, 0.5372433987, 0.5437555690, 0.5490938253