MATH MODELING CLASS USING MATH LAB I ALREADY KNOW THE ANSWER FOR PART 1 FOCUS ON
ID: 3885673 • Letter: M
Question
MATH MODELING CLASS USING MATH LAB I ALREADY KNOW THE ANSWER FOR PART 1 FOCUS ON PART 2
In the posed elevator problem, your assistant notified you that there are 60 workers operating on each of 5 floors atop the ground floor in your office building - 300 in total. The elevator occupancy is 10 people, and there are 3 elevators in total. In the worst-case scenario in terms of total transition time, on each elevator ride at least one person is getting off at each floor. Naturally, we can ask: what is the probability that an elevator with 10 passengers has none of the 5th floor workers? For that trip, it should reduce the elevator travel time by t45 + texit + t54 = 5 + 15 + 5 = 25sec. To see how often this might happen, we can perform random draws of elevator occupants, and average over a long time. This is a way to check the validity of certain modeling assumptions.
Part 1 Write a script which computes random draws for the 10 elevator occupants, and perform this 1000 times. Count the number of times a 5th floor occupant is present, and divide the that count by 1000. A basic structure for this may look like:
N=1000;
f o r . . . % loop ove r a l l N t r i e s
Elev= % g e n e r a t e v al u e s f o r Elev u si ng pseudorandom numbers
i f % put a c o n di ti o n on v al u e s to check f o r a 5 th f l o o r worker
% inc remen t co u n t e r
e l s e
% do no thing ( can l e a v e e l s e s ta temen t blank )
end
% do more t hi n g s i f n e c e s s a r y
end
% output count / N A very useful matlab command to look up would be "randi" or similarly "rand
PART 2
A back-of-the-napkin calculation for this probability can be done using simple
combinatorics. Assume that the full pool of workers are available to enter this
particular elevator. The probability of there being no 5th floor workers on the
elevator is given by:
Combinations without 5th floor employees/Combinations of all workers =(240C10* 60C0)/300C10
the binomial coefficient stated as "N choose k". Calculate this probability using
the MATLAB command "nchoosek".
Answer the following questions in your lab report:
• 1. How does your value calculated in Part 1 compare to the result of th
calculation shown in Part 2?
• 2. What is probability that a given elevator only contains workers from the
1st, 2nd, and 3rd floors?
• 3. (Tougher) Given your answers to 1. and 2., can you justify and calculate
a more realistic expected transition time than if you were to simply assume
each elevator goes to each floor on its travel?
Explanation / Answer
public static void main(String[] args) { int [] num = new int[1000]; //an array of 1000 integers int i; //used as an array index for( i= 0; i < 1000; i++) num[i] = 1+(int) (Math.random()*((10-1)+1)); //math.Random generates a number between 0 and 1, this method calls for numbers //to be between 1 and 10. To make this possible, I need to multiply //the math.random by the max-min and add 1 to make sure it generates //1,000 random integers between 1 and 10. int count1; //used to count how many integers are equal to 1 System.out.println ("Integers equal to 1"); //this loop prints the values in the array for(i=0; i<1000; i++) if (num[i] == 1) { i++; System.out.println(i + "of the random 1000 integers are equal to 1."); }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.