Due midnight Thursday October 29
Collaboration policy for COS 109:
Working together to really understand the material in problem sets and
labs is encouraged, but once you have things figured out, you must part
company and compose your written answers independently. That helps
you to be sure that you understand the material, and it obviates questions
of whether the collaboration was too close.
You must list any other class members with whom you collaborated.
Problem set answers need not be long, merely clear enough that we can understand what you have done, though for computational problems, show enough of your work that we can see where your answer came from. Please type your answers if at all possible. Thanks.
Don't forget that if the data you start with is approximate, the results cannot be precise.
In parts (f) and (g) the expression "i is odd" is pseudo-Python, not legal Python. If you want to try your answers with a real Python compiler, the valid expression uses the modulus operator % and would be written as if i % 2 == 1.
(a) i = 1 while i <= 4: print(i) i = i + 1 print(i) (b) i = 1 while i <= 4: i = i + 1 print(i) print(i) (c) i = 1 while i < 4: i = i + 2 print(i) (d) i = 4 while i > 0: print(i) i = i - 1 (e) i = 4 while i >= 0: i = i - 4 print(i) print(i) (f) i = 1 while i <= 10: if i is odd: print(i) i = i + 3 (g) i = 1 while i <= 10: if i is odd: print(i) else: print(i + 1) i = i + 3
(a) A post by Paul Graham, founder of Y-Combinator, at paulgraham.com says "If you have 100 users, you need to get 10 more next week to grow 10% a week. And while 110 may not seem much better than 100, if you keep growing at 10% a week you'll be surprised how big the numbers get. After a year you'll have 14,000 users, and after 2 years you'll have 2 million." Are his numbers approximately right or not, and why? (This is a good place to refresh your memory of the Rule of 72 rather than reaching for your calculator.)
(b) From TIAA/CREF Participant, 8/03: "In his will, Franklin left 1000 pounds sterling to the cities of Philadelphia and Boston, with the stipulation that the funds be lent out at 5 percent interest a year. Because of compounding, Franklin figured that in 100 years his bequests to these cites would be worth 131,000 pounds." Assuming that 5% was achieved, was his estimate much too high, much too low, or about right, and why do you say so? (The Franklin Institute in Philadelphia owes its existence to his bequest.)
(c) Suppose a Petri dish can hold 1,000,000 bacteria. If the dish starts off with 1 bacterium and the population grows at 3% per minute, approximately how many minutes will it take to fill up the dish?
(d) How many minutes will it take if the dish can hold about 2,000,000 bacteria?
"Fifty billion plastic water bottles are discarded annually by Americans; 20 billion barrels of oil are used to make this plastic and 25 million tons of greenhouse gases are released into the atmosphere." (from an environmental site, September, 2015)
(a) Assess the claim of 50 billion bottles: plausible or not, and why?
(b) Assess the claim of 20 billion barrels: plausible or not, and why?
(c) Assess the claim of 25 million tons: plausible or not, and why?
(d) Boxed water is claimed to be more environmentally friendly than plastic. The picture below shows the offerings from one company. Rank them in increasing order of cost in dollars per liter (and show that cost for each).
(e) Another ostensibly environmentally friendly format is 12 ounce aluminum cans. About how much does it cost in dollars per liter?
(f) People who are not so environmentally conscious often get their water from the tap. In Princeton, it costs 6 tenths of a cent per US gallon (120 ounces). How much is that in dollars per liter?
Please use this Word template for your answers. It would be a great help if you could type your answers.
Submit your problem set in PDF format by uploading a file called pset6.pdf to https://tigerfile.cs.princeton.edu/COS109_F2020/Pset6. You can submit as many times as you like; we will only look at the last one.