Determining Winning Combinations of Parties with >50% Votes

AI Thread Summary
The discussion focuses on identifying combinations of political parties that collectively achieve over 50% of the votes in a coalition government scenario. A user inquired about a method to determine these combinations without manually calculating each one. A solution was provided in the form of a Groovy script, which efficiently calculates all possible winning combinations. The script reveals that there are 502 combinations ranging from 51% to 100%. The conversation highlights the feasibility of using programming to solve complex mathematical problems in political contexts.
Ryan_m_b
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Messages
5,963
Reaction score
726
This is born out of musings around coalition governments that arise from the party with the most votes not achieving ≥50% of the votes (as opposed to emergency coalitions).

Taking the figures below how would one go about determining all the possible combinations of parties who combined have >50% of the votes without sitting down and working them out one by one?

Kid gloves please :redface: I haven't studied maths for the better part of a decade...

Parties / Percentage of votes

Pink / 21
Orange / 19
Brown / 16
Blue / 10
Green / 10
Tan / 8
Red / 5
Black / 4
Purple / 4
White / 3
 
Mathematics news on Phys.org


Brute force my friend !
Here is a groovy script that answers your question:
Code:
def X=[Pink:21, Orange:19, Brown:16, Blue:10, Green:10, Tan:8, Red:5, Black:4, Purple:4, White:3]
def XS=X.keySet() as List
def N=XS.size()
def F; F={ ix,n ->
	def L0=[XS[ix]]
	if(n==1) return [L0]
	def L=[]
	for(def j=ix; j<N-1; j++) { 
		F(j+1, n-1).each{ L<<(L0+it) }
	}
	L
}
def OK=[:]
for(def i=0;i<N;i++) {
	for(def j=1;j<=N-i;j++) {
		def c=F(i,j)
		c.each{ 
			def s=0; it.each { s+=X[it]} 
			if(s>50) OK[it]=s 
		}
	}
}
OK.keySet().sort{x,y->OK[y]<=>OK[x]}.each{ println "$it: ${OK[it]}%" }
I don't post the result since there are 502 winning combinations going all the way from 51% up to 100% :smile:
 


oli4 said:
Brute force my friend !
Here is a groovy script that answers your question:
I don't post the result since there are 502 winning combinations going all the way from 51% up to 100% :smile:
Wow thanks a lot! To be honest I'm not really sure how to work code lol but it's good to know that there's a relatively simple way to get it done. Thanks!
 
Suppose ,instead of the usual x,y coordinate system with an I basis vector along the x -axis and a corresponding j basis vector along the y-axis we instead have a different pair of basis vectors ,call them e and f along their respective axes. I have seen that this is an important subject in maths My question is what physical applications does such a model apply to? I am asking here because I have devoted quite a lot of time in the past to understanding convectors and the dual...
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...

Similar threads

Back
Top