> #Attendence Q1: > #Why are Republicans red and Democrats blue? ; > #Since the election showing on the TV needs to distinguish which state supports republicans and which state supports democrats, and there are many different color for both republicans and democrats that may confused people. Since 2004, most people would say red state and blue state refering republicans and democrats. ; > ; > #Attendence Q2: > #In the 2008 election whoever won, in how many ways could he have gotten the exact numer of electoral votes that they actually got? ; > #365 votes ; > #coeff(f,x,365) ; > USEC:=proc(): > [3$8,4$5,5$3,6$6,7$3,8$2,9$3,10$4,11$4,12,13,14,15,16$2,18,20$2,29$2,38,55]; > end: > GFv:=proc(L,x) local i: > sort(expand(mul(1+x^L[i],i=1..nops(L)))): > end: > coeff(GFv(USEC(), x), x, 365) 3182416524832 ; > ; > #Attendence Q3: > #What is the probability that it is consistent in such an election with 1000 states ; > C:= n->evalf(binomial(n, trunc(n/2))/2^n) Typesetting:-mprintslash([(C := n -> evalf(binomial(n,trunc(1/2*n))/(2^n)))],[n -> evalf(binomial(n,trunc(1/2*n))/(2^n))]) ; > C(1000) .2522501818e-1 ; > ; > #Attendence Q4: > #How often will we get 500*x[0]+500*x[1] ; > LC:=proc(p) local a,b,ra: > a:=numer(p): > b:=denom(p): > ra:=rand(1..b)(): > > if ra<=a then > 1: > else > 0: > fi: > end: > add(x[LC(1/2)], i=1..1000); 500*x[0]+500*x[1] ; > #After 14 times, I got 500/500 ; > ; > #Attendence Q5: > #Run SimuCount([1$100], 1/2, 10000,4)[2] ; > #How close is it to C(100)? ; > SimuCount([1$100], 1/2, 10000, 4)[2] .1591000000 ; > C(100) .7958923739e-1 ; > ; > #Attendence Q6: > #Are there other countries with the electoral college system? ; > #what is the counterpart of USEC() ; > #Yes, for example, India. ; > #The ratio of total votes of each candidate may not equal to the ratio of total electors. ; > ; > ; > ;