Pi seconds equals one nanocentury

Duff’s rule says that a nanocentury is about π seconds. Assuming a year is 365.25 days, there are 3,155,760,000 seconds in a century. So a nanocentury, one billionth of a century, is 3.15576 seconds, roughly π seconds.

This odd fact is surprisingly useful in back-of-the-envelope calculations. In order to determine whether something is computationally feasible, you have to go from how much work can be done in a second to how much work could be done on calendar time scales. For example, suppose some operation is going to take 1015 steps and you can carry out 106 operations per second. How long would that take? Obviously 109 seconds, but how long is that in familiar units of time? According to Duff’s rule it’s about a third of a century so about 30 years.

Since the square root of 10 is approximately π, you could say there are about square root of 10 seconds in a nanocentury. In fact, the square root of 10 is 3.162 and so it’s closer to the number of seconds in a nanocentury than π is. The advantage to square root of 10 is that it is exactly half an order of magnitude, 101/2. So you could say a century is 9.5 orders of magnitude longer than a second, or a year is 7.5 orders of magnitude longer than a second. Or perhaps more memorably,

A year is about 30 megaseconds.

If you interpret “mega” as 220 rather than 106 this approximation gets even better. (Technically, this would be 30 mebiseconds. SI distinguishes “mega” = 106 = 1,000,000 from “mebi” = 220 = 1,048,576, though the latter isn’t widely used. Most people have either never heard of the new prefixes like “mebi” or think they sound silly and prefer the ambiguity of using “mega” to mean two slightly different things. See Kibi, mebi, gibi.)

I wrote briefly about Duff’s rule a while back in the post Three rules of thumb. That post also includes a great video of Grace Hopper explaining to David Letterman her rule of thumb that light travels about one foot in a nanosecond.

Read More

There isn’t a googol of anything

Before Google, there was googol, the number 10^100, written as a 1 followed by 100 zeroes.

There are about 4 × 10^79 atoms in the universe. (Here’s a derivation of that number.) You could bump that number up a little by counting particles rather than atoms, but not by much. There’s not a googol of anything physical in the universe.

On the other hand, numbers larger than a googol routinely arise in application. When you’re counting potential things rather than physical things you can run into numbers much larger than a googol. This happens all the time in probability calculations. Inconceivably large numbers pop up in intermediate steps on the way to moderate-sized results.

Related posts:

How to calculate binomial probabilities
Floating point numbers are a leaky abstraction

Read More

Probability that a number is prime

The fastest ways to test whether a number is prime have some small probability of being wrong. Said another way, it’s easier to tell whether a number is “probably” prime than to tell with certainty that it’s prime. This post looks briefly at algorithms for primality testing then focuses on what exactly it means to say a number is “probably prime.”

(more…)

Read More

Casablanca and Einstein

Humphrey Bogart and Ingrid Bergman in Casablanca

If you’ve ever seen Casablanca, you’ve heard the song As Time Goes By, but only the chorus.

You must remember this
A kiss is just a kiss, a sigh is just a sigh.
The fundamental things apply
As time goes by.

Did you know the song includes references to relativity and four-dimensional geometry?

Here’s the first verse.

This day and age we’re living in
Gives cause for apprehension
With speed and new invention
And things like fourth dimension.

Yet we get a trifle weary
With Mr. Einstein’s theory.
So we must get down to earth at times
Relax relieve the tension.

And no matter what the progress
Or what may yet be proved
The simple facts of life are such
They cannot be removed.

Here are the full lyrics.

Via Math Mutation podcast #134.

Read More

Probability and Statistics cheat sheet

Matthias Vallentin posted a comment on my post about a math/CS cheat sheet to say that he’s been working on a probability and statistics cheat sheet. Looks great, though at 24 pages it stretches the definition of “cheat sheet” even more than the computer science cheat sheet did.

Anybody know of other cool cheat sheets?

Related links:

Diagram of probability relationships
Diagram of modes of convergence
Diagram of special function relationships

Read More

Serious lessons from Knuth’s joke

On June 30, 2010 Donald Knuth announced iTeX, the successor to TeX. His announcement was an extended parody of much of what people recommend as the “right” way to develop software.

TeX has been extremely successful. The vast majority of math and computer science is published using TeX. And yet Knuth implies that TeX would have been an obscure failure if he had developed it using trendy software development techniques.

Here’s the video of Knuth’s presentation.

Read More

Math/CS cheat sheet

Here’s something called a theoretical computer science cheat sheet. I don’t know whether I agree with the name, but it’s a nice cheat sheet.

The first two pages of the cheat sheet have to do with sums, combinatorics, and recurrence relations, the kinds of things you’d find in Concrete Mathematics and certainly useful in theoretical computer science. The chart mentions the “master method” that I blogged about here. But a large part of the cheat sheet is devoted to calculus and other general mathematics not as directly related to computer science.

There’s a nice summary of finite calculus on page 8, a useful little area of math that’s not very widely known.

Thanks to Bill the Lizard for pointing out the cheat sheet.

Read More