Saturday, November 19, 2016

HP Prime and TI-84 Plus: Method of Equal Proportions: Number of U.S. Representatives

HP Prime and TI-84 Plus:  Method of Equal Proportions:  Number of U.S. Representatives 

Introduction

The 2016 United States Elections still fresh on the minds of some Americans, even with talk of repealing the Electoral College.  But how does the Electoral College work? 

Each of the 50 states receives a set amount of electoral votes, which is based on the number of House Representatives and Senate members.  Each state gets two Senators. The number of House Representatives is determined by popular.  Every ten years, specifically 1990, 2000, 2010, 2020, and so on, the United States takes nationwide census.  That population becomes the basis of determining the number of House of Representatives.   Currently, there are 435 members of the House.

After the election, each state gives the set number of electoral votes to the candidate who wins the popular vote in that state.  For example, California, where I’m from, has 55 electoral votes.  If Candidate A wins by popular vote in California, that candidate gets 55 votes.  The exceptions are Maine and Nebraska, which use a congressional district method. 

Note:  In the Electoral College, 3 additional votes goes to the District of Columbia.  However, since D.C. is not a state, it won’t get seats in the House of Representatives. 

The Method of Equal Proportions: Determining the Number of Seats

In order to represent the population as fair as possible, methods must be used to distribute the number of seats.  The method currently used is the Method of Equal Proportions, which has been in use since 1940.

The first step is to give each state one seat at the House of Representatives.  For the United States, after each state gets one seat, there are 385 seats to assign.

The population of the states are recalculated by the following formula:

A_n = P / √(m * (m + 1))

where P = the state population, and m = the next potential seat (so for example, if the state currently has 5 seats, m = 6)

A recursive method, the method used in the program EQPROP is used:

A_1 = P / √2

A_n+1 = A_n * √(n/(n+2))

where n = the number the seats the state currently has

Example:  Small Hypothetical Nation

Suppose we have a small hypothetical nation, called the Country of Celestia that consists of five states.  The government is similar to the United States, having both a House and Senate.  Each state has 2 Senators.  The five states have the following population for which 24 seats need to be distributed:

Virgo
148,000
Andromeda
107,500
Orion
95,500
Sagittarius
95,000
Pegasus
93,000
Total
539,000

As the first step, each state gets 1 seat.  That means there are 19 seats remaining. (24  - 5)  I am going to use the recursive definition.

We need to adjust the population (to determine the priority number) by dividing each population by √2.  Note:  calculations in this example are rounded to the nearest integer.

Virgo
104,652
1
Andromeda
76,014
1
Orion
67,259
1
Sagittarius
67,175
1
Pegasus
65,761
1

The next seat (6 out of 24), will go to Virgo because Virgo has the highest adjusted population.  Then Virgo’s next adjusted population will be:  104,652 * √(1/3) = 60,421

Virgo
60,421
2
Andromeda
76,014
1
Orion
67,259
1
Sagittarius
67,175
1
Pegasus
65,761
1

Seat #7, goes to Andromeda, because Andromeda now has the largest adjusted population at 76,014.  Adjusting the population:  76,014 * √(1/3) = 43,887, and Andromeda gets another seat.

After 7 seats, this is what the adjusted population looks like:

Virgo
60,421
2
Andromeda
43,887
2
Orion
67,259
1
Sagittarius
67,175
1
Pegasus
65,761
1

We continue:

Virgo
Andromeda
Orion
Sagittarius
Pegasus
Seat #
Adj. Pop.
# Seats
Adj. Pop.
# Seats
Adj. Pop.
# Seats
Adj. Pop.
# Seats
Adj. Pop.
# Seats
8
60421
2
43887
2
38832
2
67175
1
65761
1
9
60421
2
43887
2
38832
2
38784
2
65761
1
10
60421
2
43887
2
38832
2
38784
2
37967
2
11
42724
3
43887
2
38832
2
38784
2
37967
2
12
42724
3
31033
3
38832
2
38784
2
37967
2
13
33094
4
31033
3
38832
2
38784
2
37967
2
14
33094
4
31033
3
27458
3
38784
2
37967
2
15
33094
4
31033
3
27458
3
27424
3
37967
2
16
33094
4
31033
3
27458
3
27424
3
26847
3
17
27021
5
31033
3
27458
3
27424
3
26847
3
18
27021
5
24038
4
27458
3
27424
3
26847
3
19
27021
5
24038
4
21269
4
27424
3
26847
3
20
27021
5
24038
4
21269
4
21243
4
26847
3
21
22837
6
24038
4
21269
4
21243
4
26847
3
22
22837
6
24038
4
21269
4
21243
4
20796
4
23
22837
6
19627
5
21269
4
21243
4
20796
4
24
19777
7
19627
5
21269
4
21243
4
20796
4

Final Distribution for Celestia (our example):  Virgo, 7 House seats, Andromeda, 5 House seats, Orion, Sagittarius, and Pegasus get 4 each.

On to the programming!

The Program EQPROP

The program EQPROP takes two arguments:  the list of populations, and the number of House of Representative seats to be assigned.  The program assumes that two Senators will also be assigned.

Output:  A matrix of three columns:
Column 1:  The population of each state.  The population is sorted in descending order.
Column 2:  The number of House Representatives.
Column 3:  The number of House Representatives plus the 2 senators.

For the TI-84 Plus:  L1 is used as the population list, lists L2, L3, and L4 are used for calculations, and the results are returned in Matrix [A].

HP Program EQPROP

EXPORT EQPROP(lp,n)
BEGIN
// Method of equal proportions
// 2016-11-18 EWS
// population, no of seats

LOCAL la,s,lr,k,m,p,w;

// initialization
lp:=REVERSE(SORT(lp));
la:=lp/√2;
s:=n-SIZE(lp);
lr:=MAKELIST(1,X,1,SIZE(lp));

// loop
FOR k FROM s DOWNTO 1 STEP 1 DO
m:=MAX(la);
p:=POS(la,m);
w:=lr(p);
la(p):=la(p)*√(w/(w+2));
lr(p):=w+1;
END;

// output, organize matrix
// [population, senate, + house]
LOCAL l2,m2,l3;
l3:=lr+2;
l2:={lp,lr,l3};
l2:=TRN(list2mat(l2,3));
m2:=l2(1);
RETURN m2;

END;

TI-84 Plus Program EQPROP

"EQUAL PROPORTIONS"
"2016-11-18 EWS"
Input "POP. LIST: ",L
Input "NO. OF SEATS: ",N
SortD(L)
L→L
N-dim(L)→S
L→L
Fill(1,L)
L/√(2)→L
"LOOP"
For(K,S,1,­1)
max(L)→M
"POS"
1→P
While L(P)≠M
1+P→P
End
"REST"
L(P)→W
L(P)*√(W/(W+2))→L(P)
W+1→L(P)
End
"OUTPUT"
L+2→L
List>matr(L,L,L,[A])
Pause [A]


Sources:

Burnett, Kristin D.  “Congressional Apportionment:  2010 Census Briefs”  U.S. Census Bureau.  November 2011.  Download the PDF file here:  http://www.census.gov/library/publications/2011/dec/c2010br-08.html

Wikipedia   “Electoral College (United States)”  https://en.wikipedia.org/wiki/Electoral_College_(United_States)  Retrieved November 16, 2016

Wikipedia “United States Congressional Apportionment”  https://en.wikipedia.org/wiki/United_States_congressional_apportionment#cite_note-22   Retrieved November 16, 2016

This blog is property of Edward Shore, 2016


Spotlight: Akron Brass FireCalc Pocket Computer

Spotlight: Akron Brass FireCalc Pocket Computer Welcome to a special Monday Edition of Eddie’s Math and Calculator blog. Thi...