COS 109: Problem Set 6

Tue Oct 22 14:53:45 EDT 2024

Due midnight Wednesday October 30

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.

1. One Rule of 72 to Rule Them All

One reason for using the Rule of 72 instead of whipping out your trusty calculator program is that the input data is always approximate! Saying that something doubles in 4 years is an estimate, not a law of nature, so computing a growth rate to 3 "significant" figures makes no sense. Don't use a calculator.

According to the new IEEE International Roadmap for Devices and Systems Mass Data Storage, hard disk drive capacity will double in just four years, to 60TB in 2028 from 30TB in 2024.

(a) What is the approximate rate of capacity growth per quarter, assuming (counterfactually) a smooth exponential improvement?

(b) Storage density, measured in bits per square inch, has to increase steadily to achieve these higher capacities. Suppose for the sake of argument that storage density today is 1 TB / square inch for a 30 TB disk. If area density will be 16 TB / square inch in 2040, what is the rate of growth of area density per year?

2. Big and Small Numbers

The 2023 Nobel prize in Physics went to Pierre Agostini, Ferenc Krausz and Anne L'Huillier "for experimental methods that generate attosecond pulses of light for the study of electron dynamics in matter." One news story said, "An attosecond is one quintillionth of a second. The number of attoseconds in a single second is the same as the number of all the seconds that have elapsed since the universe burst into existence 13.8 billion years ago."

(a) Compute the approximate number of seconds since the beginning of the universe.

(b) How close is it to the number of attoseconds in a second?

(c) The story went on to say "Electrons move at a whopping 43 miles a second." Very roughly how many attoseconds would it take for an electron to move from Friend 008 to Forbes College?

3. Round and Round It Goes

Here's some straightforward and totally boring practice in figuring out what sequences of instructions do. For each of the following fragments of Python, state what sequence of values, if any, is printed.

Note that the statement i = i + 1 means "take the old value if i, add 1 to it, and put the result back in i." That is, increment i by 1. This use of = to mean "assign a value to" is standard in almost all programming languages.

Parts (f) and (g) use the modulus operator %, which for the expression i % n computes the remainder of dividing i by n. For example, if i % 2 == 1 tests whether i is odd.

(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 = 3
     while i > 0:
         print(i)
         i = i - 1

(e) i = 6
     while i >= 0:
         i = i - 2
         print(i)
     print(i)

(f) i = 1
     while i <= 10:
         if i % 2 == 1:
             print(i)
         i = i + 3

(g) i = 1
     while i <= 10:
         if i % 2 == 1:
             print(i)
         else:
             print(i + 1)
         i = i + 3

Submission

Please use this Google Doc 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 Gradescope. You can submit as many times as you like; we will only look at the last one.