> #Weiji Zheng, 11/09/2020, Assignment 17a ; > #OK TO POST HOMEWORK ; > ; > #Q1 ; > #Use Wikipedia (or otherwise) to find the final outcome of the electoral votes for the presidential elections for 2000, 2004, 2008, 2012, and 2016, and find the number of ways in which it could have been counted to lead to the final outcome, by using the appropriate procedures in ComboProject8.txt. ; > ; > ; > #2000 -> 271 VS. 266 ; > coeff(GFv(USEC(), x), x, 271) 16965465344318 ; > ; > #2004 -> 286 VS. 251 ; > coeff(GFv(USEC(), x), x, 286) 16196017263096 ; > ; > #2008 -> 173 VS. 365 ; > coeff(GFv(USEC(), x), x, 365) 3182416524832 ; > ; > #2012 -> 206 VS. 332 ; > coeff(GFv(USEC(), x), x, 332) 8628577597686 ; > ; > #2016 -> 304 VS. 227 ; > coeff(GFv(USEC(), x), x, 304) 13873406885786 ; > ; > ; > #Q2 ; > #Assuming, rather unrealistically, that the probability of winning for either of the candidates is the same for each state, and that they #are independent of each other, use the popular vote (also given in Wikipedia), use the appropriate procedure to find the (estimated) #probability of the ultimate winner of (i) winning (i.e. scoring at least 270 votes) (ii) scoring that many electoral votes or more. ; > ; > #2000 -> 47.9 VS. 48.4 ; > #2004 -> 50.7 VS. 48.3 ; > #2008 -> 52.9 VS. 45.7 ; > #2012 -> 51.1 VS. 47.2 ; > #2016 -> 46.1 VS. 48.2 ; > #(i) ; > #2000 ; > p := 47.9 / (47.9 + 48.4) p := .4974039460 ; > add(coeff(GFvp(USEC(),479/963,x), x, 270 + k), k = 0 .. 268) 70974155509022104567547919821048097117217483458878433987388350291963058689396191275792700950163524952305454598319635805611197136600105766401012764681371/146197734689759995505033024499174398637868806747286220169272465431409178232027826579409458120916281447839484119573879959739077355705054797755457537221787 ; > evalf(%) .4854668621209032140894278963598502080098 ; > #2004 ; > p := 50.7 / (50.7 + 48.3) p := .5121212121 ; > add(coeff(GFvp(USEC(),507/990,x), x, 270 + k), k = 0 .. 268) 151958136740430645326111390741509753662553882408365713768368972565997770849961511799580320337042586662284437772360605546870818821/278106368284019834975553700094962919414183375617767113232413626310384666309217000000000000000000000000000000000000000000000000000 ; > evalf(%) .5464029381205732513501758287027366423608 ; > #2008 ; > p := 52.9 / (52.9 + 45.7) p := .5365111562 ; > add(coeff(GFvp(USEC(),529/986,x), x, 270 + k), k = 0 .. 268) 314037516775588894571960654782619409992794975254070943502542830440662441712355085545073285580876814993805130828619344281543929795187591770428715513281181/487217256555370468472248441312301673616588728772800480905273789855799167420960516862901862595280457041103629838680864015333965784627891619705065608052736 ; > evalf(%) .6445533538689421880377884325999826424997 ; > #2012 ; > p := 51.1 / (51.1 + 47.2) p := .5198372330 ; > add(coeff(GFvp(USEC(),511/983,x), x, 270 + k), k = 0 .. 268) 241090646375409099259062848088980678862049411391398700387665751507799811526770636659591500095041444737396253686547587966218805194492457555549672930326855/417089646536845510608330019933649423205610533301384321338339424423736541372190162237421872650211156194988030003177303312723821358611333587978122145085767 ; > evalf(%) .5780307623965709268001187481619471707113 ; > #2016 ; > p := 48.2 / (46.1 + 48.2) p := .5111346766 ; > add(coeff(GFvp(USEC(),461/943,x), x, 270 + k), k = 0 .. 268) 22567175088455451075968128010896292532527455085786300222564192975384320089934178382525355409411968403181686812350997974363175156821653078852962845006095/50129841284864760453277868717545481525273653693415798460722917400580382745761147464416898570169005593105586762778637451895012845915124342289087082817807 ; > evalf(%) .4501744771186608489219262878167410753811 ; > ; > #(ii) ; > evalf(add(coeff(GFvp(USEC(),479/963,x), x, 270 + k), k = 1 .. 268)) .4779353430421639946869706585995889558168 ; > evalf(add(coeff(GFvp(USEC(),507/990,x), x, 270 + k), k = 16 .. 268)) .4261964825077029657082572661831165983028 ; > evalf(add(coeff(GFvp(USEC(),529/986,x), x, 270 + k), k = 95 .. 268)) 0.6752534477558712293350353686581956270614e-1 ; > evalf(add(coeff(GFvp(USEC(),511/983,x), x, 270 + k), k = 62 .. 268)) .1599131128310473506237044533908389415863 ; > evalf(add(coeff(GFvp(USEC(),461/943,x), x, 270 + k), k = 34 .. 268)) .2197161241233297928319460281137712801434 ; > ; > ; > #Q3 ; > #Using procedure SimCount(L,p,N,K) with N=2000, K=4, four times and with p=3/10, 2/5,1/2,3/5,7/10, and L=USEC(), see whether the first component of the output (that give estimates for the expectation, standard-deviation, and the 3rd, and 4th moments) agree with each other (remember they are only statistical estimates) and how they are close to the true value obtained by using StatAnal(f,x,K) applied to GFvp(USEC(),p,x). I have no clue about the theoretical (exact) value of the probability that such a count is consistent, but the second output of SimCount(L,p,N,K) give estimates. How close, in the above-mentioned four runs are there to each other? ; > ; > #Should put p values into SimuCount(USEC(),p,2000,4) and evalf(StatAnal(GFvp(USEC(), p, x), x,4)) ; > #i dont know why but my computer cannot do it :( ;