www.BrettDaniel.com

Early Days of a Programmer

I have been around computers for my entire life. I remember playing DOOM across the home network; dialing into a bulletin board system on a 14.4 Kbit/s modem; helping my father install one of the first 1 gigabyte hard disks; and writing games in Excel's macro language. I recently came across two photos showing even earlier examples of the technology I had around me.

Here is a picture of my sister, father, and I using a cutting-edge (in 1987) Compaq 286. Obviously, my sister and I were already pair programming, 13 years before the advent of eXtreme Programming.

My sister, father, and I working on a Compaq 286 in 1987

And here we are in 1988 playing a video game on our Commodore 64. Note the Atari joysticks.

My sister and I playing a game on a Commodore 64 in 1988

What is your earliest memory involving computers?

Previously

Quote on Progress

"Everything is amazing right now, and nobody's happy." —Louis C.K (via)

Probability of Two Submarines Colliding

Two nuclear submarines collided in the Atlantic, prompting my friend Sam to wonder, "what is the probability of two submarines colliding in the ocean?" Ignoring that we now know the true probability is 1, we can estimate the probability of collision by calculating the ratio of the volume of water through which the world's fleet of submarines travels in, say, 30 years to the total volume of the earth's oceans.

Fortunately, the news article, Wikipedia, and the rest of the internet have most of the values we need:

In 30 years (2.6×105 hours), one submarine will travel about 46 km/h × 2.6×105 h ≈ 1.2×107 km. That is about 8.5×107 times its own length. One submarine displaces 15,000 tons (1.36×10-5 km3) of water, so during that time it will travel through a volume of about 1.36×10-5 × 8.5×107 = 1,178 km3. With 250 such submarines, the total volume traveled comes to 2.94×105. The ratio of that to the volume of the world's oceans is 2.94×105 / 1.3×10^9 = 2.3×10-4.

Therefore, the probability that a fleet of 250 randomly-traveling Le Triomphant-sized submarines will have at least one collision in 30 years is around 1 in 5000.

This assumes that the average displacement of all subs deployed during those 30 years is roughly equivalent to 250 Le Triomphant class-sized subs. I have no idea if that is a valid assumption because I was unable to find a definite number for how many submarines are currently active, much less the year-to-year count or average size. Does anyone want to scrape Wikipedia's list of submarine classes to aggregate the average displacement and deployment numbers by year? Also, the number of submarines has decreased since the end of the cold war.

Check my math with the following Python script.

print "Q. What is the probability of two subs accidentally colliding in the ocean?"
print "   http://www.dailymail.co.uk/news/worldnews/article-1146124/"

def years_to_hours(years):
    days_per_year = 365.24
    hours_per_day = 24.0
    return years * days_per_year * hours_per_day

def tons_to_cubic_km(tons):
    lbs_per_ton = 2000.0
    liters_per_lb = 1.0 / 2.2 # of water
    cubic_km_per_liter = 1.0e-12
    return tons * lbs_per_ton * liters_per_lb * cubic_km_per_liter

ocean_volume = 1.3e9 #km^3  http://hypertextbook.com/facts/2001/SyedQadri.shtml
number_of_subs = 250.0 # http://en.wikipedia.org/wiki/Nuclear_navy
travel_time = years_to_hours(30.0)

# Submarine Characteristics
# http://en.wikipedia.org/wiki/Le_Triomphant_(S_616)
# http://en.wikipedia.org/wiki/HMS_Vanguard_(S28)
sub_displacement = tons_to_cubic_km(15000.0)
sub_speed = 46.0 #km/h
sub_length = 0.14 #km

# calculation
travel_distance = sub_speed * travel_time
volume_traversed = (travel_distance / sub_length) * sub_displacement
fleet_volume = number_of_subs * volume_traversed
ratio = fleet_volume / ocean_volume

print "A. %g" % ratio

Update

Lucas says the following on the mailing list on which I originally posted the calculation:

nice! I don't know if the analysis is right, but it gives us an upper bound at least!

Brett's calculation is equivalent to the following: set out 250 subs that randomly teleport to cover the right volume. None of the subs ever visits space that it or any other sub has been before. Now, what's the probability of choosing a spot that a sub has been if I were to randomly teleport a new sub into the ocean after 30 years?

I imagine this will over estimate a bit.

Since the total volume of the subs is much much smaller than the volume of the ocean, I think we can safely ignore "overlapping" yet non-colliding paths. Other than that, I think it is a good characterization.

Previously

1234567890 Day

Yesterday Unix time passed 1234567890 seconds. Back in 2001, I noted that 1000000000 was nearing. Also noteworthy, January 19, 2038 isn't far off.

Spoon Patch

Encountered a limitation of Spoon while using it on a research project; wrote a workaround; bundled the workaround into a patch.

A Fable

Once upon a time, in a small village near a lake, a boy was born. On his first birthday, as was tradition in the village, his mother took him to the village elders to receive his name. Each elder held the child, gave a blessing, then passed him along to the next. The final elder, the oldest and wisest, rose when his turn came. He bowed his head and a look of deep sadness fell across his creased and bearded face.

"This child shall be named Sleeping Heron," the elder began, "for I foresee he will lose a leg. I know not when, but once it comes to pass, the boy will stand like Brother Heron who fishes in our lake."

The elder returned Sleeping Heron to his mother. She clutched him to her breast and wept.

"Is there nothing I can do to stop this terrible thing?" she pleaded.

The elder solemnly shook his head.

Sleeping Heron grew strong and, despite the elder's prediction, came to love running. At seven, he could circle the lake faster than any other boy his age. At 15, he had raced and beaten every man—and several animals—in the village. At 18, he became the village messenger and a scout for the men that protected the village from bandits. He spent his days carrying messages to neighboring villages, patrolling the countryside, and watching the main road into the village.

One day, from his hiding place overlooking the road, Sleeping Heron overheard two travelers speaking of a tournament in the great city three days' travel from the village. It was scheduled to celebrate the fall harvest, just one week away. To Sleeping Heron's delight, there would be several races in which athletes from all over the region would compete in the city's grand coliseum.

He left immediately, running the entire way. The tournament began, and Sleeping Heron quickly rose through the rankings. Some races he won easily, in others he struggled. He reached the final race but did not win. This did not disappoint him. Finally he had the challenge he had always yearned for.

After the race, his exhausted competitors asked Sleeping Heron to explain his name. He told them of the elder's prediction so many years earlier.

"If you are going to lose a leg, why do you run?" they all asked.

He replied, "if you had wings, even for just one day, would you not fly?"