Sensitivity_Resistance.nb
T. Ratliff, Wheaton College, Feb 4, 2016

This worksheet has a few functions to help you calculate the sensitivity and resitance in a weighted voting system. 
omega[q,w] calculates ω, the number of divisions with positive outcome in a system with quota q and list of weights w
Sensitivity[n, PenroseSum] calculates the sensitivity of a system with n voters where PenroseSum is the sum of the Penrose measures of all voters
Resistance[n, omega] calculates the resistance of a system with n voters and omega divisions with positive outcome

Note: The calculation for omega is not very efficient, so you will probably want to limit to systems with about 20 voters or fewer

omega[q_,w_]:= BinCounts[Tuples[{0,1},Length[w]].w,{{q,Infinity}}][[1]];
Sensitivity[n_,PenroseSum_] := Log[ 2^(n-1)*PenroseSum/n]/Log[ Floor[n/2]*Binomial[n,Floor[n/2]]/n];
Resistance[n_,omega_] := N[(2^(n-1) - omega)/(2^(n-1)-1)];

Let’s go through an example of the calculations for the 1958 European Union Council of Ministers
The 1.3125 for the sensitivity comes from using the calculator at Warwick linked from the course webpage.

omega[12,{4,4,4,2,2,1}]

Sensitivity[6,1.3125]

Resistance[6,14]