Post Reply 
HP Prime and TI-84 Plus: Method of Equal Proportions: Number of U.S. Representative
11-19-2016, 03:13 PM
Post: #1
HP Prime and TI-84 Plus: Method of Equal Proportions: Number of U.S. Representative
For more details, refer to the blog entry: http://edspi31415.blogspot.com/2016/11/h...equal.html

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


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.


Code:
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;
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)