#OK to post homework #Natalya Ter-Saakov, Feb 13, Assignment 6 read "C6.txt": #Problem 1 #Choosing strategies at random(ish) p:=rand(100) #Game 1 G1:=RG(2,2,1000): #[[[450, 565], [189, 672]], [[180, 949], [573, 319]]] #Strategy 1 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G1,p1,p2,10000), i=1..5); evalf(PayOffG(G1,p1,p2)); #Output: # p1 = 3/10, p2 = 23/25 # [277.2081000, 800.6475000], # [276.4227000, 801.1964000], # [276.9537000, 800.4514000], # [275.2305000, 802.4073000], # [278.5245000, 798.4845000] # [276.7440000, 801.0880000] #Strategy 2 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G1,p1,p2,10000), i=1..5); evalf(PayOffG(G1,p1,p2)); #Output: # p1 = 8/25, p2 = 31/50 # [336.6714000, 676.1079000], # [338.1972000, 675.5260000], # [335.0694000, 677.0653000], # [337.0560000, 674.1594000], # [335.1564000, 678.8668000] # [336.2136000, 676.3392000] #Strategy 3 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G1,p1,p2,10000), i=1..5); evalf(PayOffG(G1,p1,p2)); #Output: # p1 = 97/100, p2 = 13/25 # [326.8149000, 617.4450000], # [326.6379000, 617.2751000], # [324.5184000, 617.7847000], # [325.0725000, 617.9833000], # [326.1525000, 618.0019000] # [326.0376000, 617.2672000] #Game2 G2:=RG(2,2,1000): #[[[631, 557], [334, 605]], [[960, 520], [573, 852]]] ##Strategy 1 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G2,p1,p2,10000), i=1..5); evalf(PayOffG(G2,p1,p2)); #Output: # p1 = 17/50, p2 = 3/20 # [548.2851000, 733.8006000], # [542.9881000, 731.9971000], # [545.8780000, 732.1315000], # [546.1334000, 731.4349000], # [547.8156000, 732.4683000] # [545.2000000, 732.7040000] #Strategy 2 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G2,p1,p2,10000), i=1..5); evalf(PayOffG(G2,p1,p2)); #Output: # p1 = 3/25, p2 = 73/100 # [819.9317000, 602.8205000], # [820.7318000, 604.8722000], # [821.0560000, 603.8228000], # [821.2363000, 603.2084000], # [817.6918000, 604.8887000] # [818.9460000, 604.8784000] #Strategy 3 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G2,p1,p2,10000), i=1..5); evalf(PayOffG(G2,p1,p2)); #Output: # p1 = 39/100, p2 = 2/5 # [622.9846000, 666.1414000], # [617.8157000, 667.2850000], # [619.7185000, 667.6743000], # [621.6174000, 666.0169000], # [622.3780000, 665.9511000] # [620.5500000, 667.1740000] #Game3 G3:=RG(2,2,1000): #[[[638, 318], [686, 18]], [[255, 1], [997, 426]]] ##Strategy 1 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G3,p1,p2,10000), i=1..5); evalf(PayOffG(G3,p1,p2)); #Output: # p1 = 1/100, p2 = 1/25 # [967.0703000, 406.5876000], # [965.8759000, 405.9167000], # [967.4700000, 406.8200000], # [965.0955000, 405.6599000], # [964.7722000, 405.6753000] # [964.4876000, 405.2100000] #Strategy 2 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G3,p1,p2,10000), i=1..5); evalf(PayOffG(G3,p1,p2)); #Output: # p1 = 91/100, p2 = 41/50 # [623.0884000, 250.1473000], # [621.6964000, 246.0511000], # [622.7143000, 245.4895000], # [622.9812000, 248.4692000], # [622.4315000, 245.5983000] # [623.4128000, 247.2150000] #Strategy 3 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G3,p1,p2,10000), i=1..5); evalf(PayOffG(G3,p1,p2)); #Output: # p1 = 99/100, p2 = 17/20 # [642.5334000, 270.2602000], # [642.4772000, 273.2863000], # [642.0064000, 270.7714000], # [642.1765000, 270.4138000], # [642.7680000, 270.1332000] # [642.4110000, 270.9175000] #Game 4 G4:=RG(2,2,1000): #[[[68, 919], [135, 566]], [[60, 92], [308, 138]]] #Strategy 1 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G4,p1,p2,10000), i=1..5); evalf(PayOffG(G4,p1,p2)); #Output: # p1 = 91/100, p2 = 87/100 # [77.49180000, 801.0296000], # [78.14470000, 805.6261000], # [77.32120000, 809.4618000], # [77.53970000, 805.4234000], # [78.53910000, 800.9597000] # [78.10770000, 803.3483000] #Strategy 2 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G4,p1,p2,10000), i=1..5); evalf(PayOffG(G4,p1,p2)); #Output: # p1 = 24/25, p2 = 27/50 # [101.5821000, 731.7150000], # [102.0680000, 729.5912000], # [101.5732000, 731.6473000], # [101.8374000, 730.1494000], # [102.5850000, 728.3742000] # [101.8304000, 730.8816000] #Strategy 3 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G1,p1,p2,10000), i=1..5); evalf(PayOffG(G1,p1,p2)); #Output: # p1 = 11/50, p2 = 63/100 # [139.3883000, 261.4931000], # [138.8351000, 257.5121000], # [139.4517000, 258.1176000], # [138.1518000, 256.0401000], # [140.7820000, 253.6239000] # [138.7866000, 258.4814000] #Game 5 G5:=RG(2,2,1000): #[[[468, 244], [942, 317]], [[340, 964], [759, 362]]] #Strategy 1 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G5,p1,p2,10000), i=1..5); evalf(PayOffG(G5,p1,p2)); #Output: # p1 = 41/100, p2 = 1/2 # [614.0345000, 502.8989000], # [613.7875000, 508.2861000], # [611.0733000, 506.9721000], # [609.8910000, 506.5046000], # [615.4251000, 499.8876000] # [613.2550000, 506.1750000] #Strategy 2 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G5,p1,p2,10000), i=1..5); evalf(PayOffG(G5,p1,p2)); #Output: # p1 = 13/100, p2 = 19/100 # [701.7713000, 453.5147000], # [702.0214000, 454.2184000], # [702.0555000, 453.4058000], # [706.0465000, 448.1712000], # [697.8205000, 458.2753000] # [701.8215000, 453.8575000] #Strategy 3 p1:=p()/100; p2:=p()/100; seq(SimulateMG(G5,p1,p2,10000), i=1..5); evalf(PayOffG(G5,p1,p2)); #Output: # p1 = 2/5, p2 = 49/50 # [399.5735000, 672.1241000], # [400.7001000, 669.6647000], # [398.7718000, 675.0115000], # [399.6496000, 671.9228000], # [399.1630000, 673.2818000] # [400.0200000, 669.3600000] #All of the simulations approximate the calculated values #Problem 2 was reading #Problem 3 #TragedyOfTheCommons(v,G,c,n):inputs # (i) An expression,v, for a function that is positive in the variable G, in 0 d G d 1, but whose first and second derivatives are negative there (like in Fig. 1.2.4 in the book with G_max=1); # (ii) a number c, the cost of buying and caring for the goat, (between 0 and 1); # (iii) a positive integer n, the number of farmers; # and outputs the Nash Equlibrium G*. TragedyOfTheCommons := proc(v,G,c,n): fsolve(v-c+G*diff(v,G)/n,G): end: seq(TragedyOfTheCommons(sqrt(1-G),G,0.5,n),n=1..10); #Output: # 0.4108027069, # 0.5240408206, # 0.5790991062, # 0.6120715420, # 0.6341606640, # 0.6500444109, # 0.6620396765, # 0.6714307918, # 0.6789893673, # 0.6852079369 seq(TragedyOfTheCommons((1-G)^(1/4),G,0.5,n),n=1..10); #Output: # 0.5980909164, # 0.7159713145, # 0.7695811633, # 0.8009276122, # 0.8217454810, # 0.8366883478, # 0.8479928247, # 0.8568756419, # 0.8640589838, # 0.8700002405 seq(TragedyOfTheCommons((1-G)^(3/4),G,0.5,n),n=1..10); #Output: # 0.3111336476, # 0.4083516515, # 0.4565628023, # 0.4855049838, # 0.5048474518, # 0.5187020389, # 0.5291205867, # 0.5372433987, # 0.5437555690, # 0.5490938253 seq(TragedyOfTheCommons(sqrt(1-G),G,0.5,n),n=1..10); #Output: # 0.4108027069, # 0.5240408206, # 0.5790991062, # 0.6120715420, # 0.6341606640, # 0.6500444109, # 0.6620396765, # 0.6714307918, # 0.6789893673, # 0.6852079369 #In each case, as the number of farmers grows, so does the total number of goats, to the detriment of the social good.