# OK to post homework # Vikrant, Mar 13 2022, Assignment 14 # ================================================================================ # 0. Code that has been given. # ================================================================================ read("C14.txt"): # ================================================================================ # 1. SSVc on election data. # ================================================================================ (* # Scraped data from wikipedia and generated maple code. # 1949_Israeli_Constituent_Assembly_election P0:=["Mapai", "Mapam", "United Religious Front", "Herut", "General Zionists", "Progressive Party (Israel)", "Sephardim and Oriental Communities", "Maki (historical political party)", "Democratic List of Nazareth", "Fighters' List", "Women's International Zionist Organization", "Yemenite Association"]: S0:=[46, 19, 16, 14, 7, 5, 4, 4, 2, 1, 1, 1]: SVs0:=SSVc(S0, 61): [seq([P0[i],SVs0[i]],i=1..nops(P0))]; # 1951_Israeli_legislative_election P1:=["Mapai", "General Zionists", "Mapam", "Hapoel HaMizrachi", "Herut", "Maki (historical political party)", "Progressive Party (Israel)", "Democratic List for Israeli Arabs", "Agudat Yisrael", "Sephardim and Oriental Communities", "Poalei Agudat Yisrael", "Mizrachi (political party)", "Progress and Work", "Yemenite Association", "Agriculture and Development"]: S1:=[45, 20, 15, 8, 8, 5, 4, 3, 3, 2, 2, 2, 1, 1, 1]: SVs1:=SSVc(S1, 61): [seq([P1[i],SVs1[i]],i=1..nops(P1))]; # 1955_Israeli_legislative_election P2:=["Mapai", "Herut", "General Zionists", "National Religious Front", "Ahdut HaAvoda", "Mapam", "Religious Torah Front", "Maki (historical political party)", "Progressive Party (Israel)", "Democratic List for Israeli Arabs", "Progress and Work", "Agriculture and Development"]: S2:=[40, 15, 13, 11, 10, 9, 6, 6, 5, 2, 2, 1]: SVs2:=SSVc(S2, 61): [seq([P2[i],SVs2[i]],i=1..nops(P2))]; # 1959_Israeli_legislative_election P3:=["Mapai", "Herut", "National Religious Party", "Mapam", "General Zionists", "Ahdut HaAvoda", "Religious Torah Front", "Progressive Party (Israel)", "Maki (historical political party)", "Progress and Development", "Cooperation and Brotherhood", "Agriculture and Development"]: S3:=[47, 17, 12, 9, 8, 7, 6, 6, 3, 2, 2, 1]: SVs3:=SSVc(S3, 61): [seq([P3[i],SVs3[i]],i=1..nops(P3))]; # 1961_Israeli_legislative_election P4:=["Mapai", "Herut", "Liberal Party (Israel)", "National Religious Party", "Mapam", "Ahdut HaAvoda", "Maki (historical political party)", "Agudat Yisrael", "Poalei Agudat Yisrael", " Cooperation and Brotherhood", " Progress and Development"]: S4:=[42, 17, 17, 12, 9, 8, 5, 4, 2, 2, 2]: SVs4:=SSVc(S4, 61): [seq([P4[i],SVs4[i]],i=1..nops(P4))]; # 1965_Israeli_legislative_election P5:=["[[Alignment (political party)#First Alignment|Labor Alignment]]", "Gahal", "National Religious Party", "Rafi (political party)", "Mapam", "Independent Liberals (Israel)", "Agudat Yisrael", "[[Maki (political party)|Rakah]]", "Poalei Agudat Yisrael", "Progress and Development", "Cooperation and Brotherhood", "Meri (political party)", "Maki (historical political party)"]: S5:=[45, 26, 11, 10, 8, 5, 4, 3, 2, 2, 2, 1, 1]: SVs5:=SSVc(S5, 61): [seq([P5[i],SVs5[i]],i=1..nops(P5))]; # 1969_Israeli_legislative_election P6:=["Alignment (political party)", "Gahal", "National Religious Party", "Agudat Yisrael", "Independent Liberals (Israel)", "National List", "[[Maki (political party)|Rakah]]", "Progress and Development", "Poalei Agudat Yisrael", "Cooperation and Brotherhood", "Meri (political party)", "Free Centre", "Maki (historical political party)"]: S6:=[56, 26, 12, 4, 4, 4, 3, 2, 2, 2, 2, 2, 1]: SVs6:=SSVc(S6, 61): [seq([P6[i],SVs6[i]],i=1..nops(P6))]; # 1973_Israeli_legislative_election P7:=["Alignment (political party)", "Likud", "National Religious Party", "Religious Torah Front", "Independent Liberals (Israel)", "[[Maki (political party)|Rakah]]", "Ratz (political party)", "Progress and Development", "Moked", "Arab List for Bedouin and Villagers"]: S7:=[51, 39, 10, 5, 4, 4, 3, 2, 1, 1]: SVs7:=SSVc(S7, 61): [seq([P7[i],SVs7[i]],i=1..nops(P7))]; # 1977_Israeli_legislative_election P8:=["Likud", "Alignment (political party)", "Democratic Movement for Change", "National Religious Party", "Hadash", "Agudat Yisrael", "Development and Peace (political party)", "Shlomtzion (political party)", "Left Camp of Israel", "United Arab List (1977)", "Poalei Agudat Yisrael", "Ratz (political party)", "Independent Liberals (Israel)"]: S8:=[43, 32, 15, 12, 5, 4, 1, 2, 2, 1, 1, 1, 1]: SVs8:=SSVc(S8, 61): [seq([P8[i],SVs8[i]],i=1..nops(P8))]; # 1981_Israeli_legislative_election P9:=["Likud", "Alignment (Israel)", "National Religious Party", "Agudat Yisrael", "Hadash", "[[Tehiya]]", "[[Tami (political party)|Tami]]", "[[Telem (political party)|Telem]]", "Shinui", "Ratz (political party)"]: S9:=[48, 47, 6, 4, 4, 3, 3, 2, 2, 1]: SVs9:=SSVc(S9, 61): [seq([P9[i],SVs9[i]],i=1..nops(P9))]; # 1984_Israeli_legislative_election P10:=["Alignment (political party)", "Likud", "[[Tehiya]]-[[Tzomet]]", "National Religious Party", "Hadash", "Shas", "Shinui", "Ratz (political party)", "[[Yahad (defunct political party)|Yahad]]", "Progressive List for Peace", "Agudat Yisrael", "[[Morasha]]", "[[Tami (political party)|Tami]]", "[[Kach and Kahane Chai|Kach]]", "[[Ometz (political party)|Ometz]]"]: S10:=[44, 41, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1]: SVs10:=SSVc(S10, 61): [seq([P10[i],SVs10[i]],i=1..nops(P10))]; # 1988_Israeli_legislative_election P11:=["Likud", "Alignment (political party)", "Shas", "Agudat Yisrael", "Ratz (political party)", "National Religious Party", "Hadash", "Tehiya", "Mapam", "Tzomet", "Moledet", "[[Shinui|Centre-Shinui]]", "Degel HaTorah", "Progressive List for Peace", "Arab Democratic Party (Israel)"]: S11:=[40, 39, 6, 5, 5, 5, 4, 3, 3, 2, 2, 2, 2, 1, 1]: SVs11:=SSVc(S11, 61): [seq([P11[i],SVs11[i]],i=1..nops(P11))]; # 1992_Israeli_legislative_election P12:=["Israeli Labor Party|Labor Party", "Likud", "Meretz", "Tzomet", "National Religious Party", "Shas", "United Torah Judaism", "Hadash", "Moledet", "Arab Democratic Party (Israel)"]: S12:=[44, 32, 12, 8, 6, 6, 4, 3, 3, 2]: SVs12:=SSVc(S12, 61): [seq([P12[i],SVs12[i]],i=1..nops(P12))]; # 1996_Israeli_general_election P13:=["Israeli Labor Party", "[[Likud]]\\u2013[[Gesher (political party)|Gesher]]\\u2013[[Tzomet]]", "Shas", "National Religious Party ", "Meretz", "Yisrael BaAliyah", "[[Hadash]]-[[Balad (political party)|Balad]]", "United Torah Judaism", "[[Third Way (Israel)|Third Way]]", "[[United Arab List|Ra'am]]-[[Arab Democratic Party (Israel)|Mada]]", "Moledet"]: S13:=[34, 32, 10, 9, 9, 7, 5, 4, 4, 4, 2]: SVs13:=SSVc(S13, 61): [seq([P13[i],SVs13[i]],i=1..nops(P13))]; # 1999_Israeli_general_election P14:=["[[One Israel]]", "Likud", "Shas", "Meretz", "Yisrael BaAliyah", "Shinui", "[[Centre Party (Israel)|Centre Party]]", "National Religious Party", "United Torah Judaism", "United Arab List", "National Union (Israel)", "Yisrael Beiteinu", "Hadash", "Balad (political party)", "[[One Nation (Israel)|One Nation]]"]: S14:=[26, 19, 17, 10, 6, 6, 6, 5, 5, 5, 4, 4, 3, 2, 2]: SVs14:=SSVc(S14, 61): [seq([P14[i],SVs14[i]],i=1..nops(P14))]; # 2003_Israeli_legislative_election P15:=["Likud", "Israeli Labor Party", "Shinui", "Shas", "National Union (Israel)", "Meretz", "National Religious Party", "{{nowrap|[[United Torah Judaism]]}}", "[[Hadash]]\\u2013[[Ta'al]]", "One Nation (Israel)", "Balad (political party)", "Yisrael BaAliyah", "United Arab List"]: S15:=[38, 19, 15, 11, 7, 6, 6, 5, 3, 3, 3, 2, 2]: SVs15:=SSVc(S15, 61): [seq([P15[i],SVs15[i]],i=1..nops(P15))]; # 2006_Israeli_legislative_election P16:=["Kadima", "Israeli Labor Party", "Shas", "Likud", "Yisrael Beiteinu", "{{nowrap|[[National Union (Israel)|National Union]]\\u2013[[National Religious Party|NRP]]}}", "Gil (political party)", "United Torah Judaism", "Meretz", "[[United Arab List|Ra'am]]\\u2013[[Ta'al]]", "Hadash", "Balad (political party)"]: S16:=[29, 19, 12, 12, 11, 9, 7, 6, 5, 4, 3, 3]: SVs16:=SSVc(S16, 61): [seq([P16[i],SVs16[i]],i=1..nops(P16))]; # 2009_Israeli_legislative_election P17:=["Kadima", "[[Likud]]-[[Ahi (political party)|Ahi]]", "Yisrael Beiteinu", "Israeli Labor Party", "Shas", "United Torah Judaism", "{{nowrap|[[United Arab List|Ra'am]]\\u2013[[Ta'al]]}}", "National Union (Israel)", "Hadash", "Meretz", "[[The Jewish Home|Jewish Home-
New Mafdal]]", "Balad (political party)"]: S17:=[28, 27, 15, 13, 11, 5, 4, 4, 4, 3, 3, 3]: SVs17:=SSVc(S17, 61): [seq([P17[i],SVs17[i]],i=1..nops(P17))]; # 2013_Israeli_legislative_election P18:=["[[Likud Yisrael Beiteinu|Likud Yisrael Beiteinu]]", "Yesh Atid", "Israeli Labor Party", "The Jewish Home", "Shas", "United Torah Judaism", "Hatnua", "Meretz", "United Arab List", "Hadash", "Balad (political party)", "Kadima"]: S18:=[31, 19, 15, 12, 11, 7, 6, 6, 4, 4, 3, 2]: SVs18:=SSVc(S18, 61): [seq([P18[i],SVs18[i]],i=1..nops(P18))]; # 2015_Israeli_legislative_election P19:=["Likud", "Zionist Union", "Joint List", "Yesh Atid", "Kulanu", "The Jewish Home", "Shas", "Yisrael Beiteinu", "United Torah Judaism", "Meretz"]: S19:=[30, 24, 13, 11, 10, 8, 7, 6, 6, 5]: SVs19:=SSVc(S19, 61): [seq([P19[i],SVs19[i]],i=1..nops(P19))]; # April_2019_Israeli_legislative_election P20:=["Likud", "[[Blue and White (political alliance)|Blue and White]]", "Shas", "United Torah Judaism", "[[Hadash]]\\u2013[[Ta'al]]", "Israeli Labor Party", "Yisrael Beiteinu", "{{nowrap|[[Union of Right-Wing Parties|URWP]]}}", "Meretz", "Kulanu", "[[United Arab List|Ra'am]]\\u2013[[Balad (political party)|Balad]]"]: S20:=[35, 35, 8, 8, 6, 6, 5, 5, 4, 4, 4]: SVs20:=SSVc(S20, 61): [seq([P20[i],SVs20[i]],i=1..nops(P20))]; # September_2019_Israeli_legislative_election P21:=["Blue and White (political alliance)", "Likud", "Joint List", "Shas", "Yisrael Beiteinu", "United Torah Judaism", "[[Yamina (political alliance)|Yamina]]", "[[Labor-Gesher]]", "[[Democratic Union (Israel)|Democratic Union]]"]: S21:=[33, 32, 13, 9, 8, 7, 7, 6, 5]: SVs21:=SSVc(S21, 61): [seq([P21[i],SVs21[i]],i=1..nops(P21))]; # 2020_Israeli_legislative_election P22:=["Likud", "Blue and White (political alliance)", "Joint List", "Shas", "United Torah Judaism", "Labor-Gesher-Meretz", "Yisrael Beiteinu", "Yamina"]: S22:=[36, 33, 15, 9, 7, 7, 7, 6]: SVs22:=SSVc(S22, 61): [seq([P22[i],SVs22[i]],i=1..nops(P22))]; # 2021_Israeli_legislative_election P23:=["Likud", "[[Yesh Atid]]", "Shas", "Blue and White (political alliance)", "[[Yamina]]", "Israeli Labor Party", "United Torah Judaism", "Yisrael Beiteinu", "[[Religious Zionist Party|Religious Zionist]]", "Joint List", "[[New Hope (Israel)|New Hope]]", "Meretz", "[[United Arab List|Ra'am]]", "[[Telem (2019 political party)|Telem]]", "[[The Jewish Home|Jewish Home]]"]: S23:=[30, 17, 9, 8, 7, 7, 7, 7, 6, 6, 6, 6, 4, 0, 0]: SVs23:=SSVc(S23, 61): [seq([P23[i],SVs23[i]],i=1..nops(P23))]; # Next_Israeli_legislative_election P24:=["Likud", "Yesh Atid", "Shas", "Blue and White (political alliance)", "[[Yamina]]", "Israeli Labor Party", "United Torah Judaism", "Yisrael Beiteinu", "[[Religious Zionist Party|Religious Zionist]]", "Joint List", "[[New Hope (Israel)|New Hope]]", "Meretz", "United Arab List"]: S24:=[29, 17, 9, 8, 7, 7, 7, 7, 7, 6, 6, 6, 4]: SVs24:=SSVc(S24, 61): [seq([P24[i],SVs24[i]],i=1..nops(P24))]; *) # ================================================================================ # 2. Shapley-Shubik for players [1,2,...,2n] and cutoff n(2n+1)+1. # ================================================================================ f:= proc(n) local i: SSVc([seq(i,i=1..2*n)],n*(2*n+1)+1): end: for n from 1 to 20 do print(f(n)); od: