2005/02/26

memory 2: celsius to fahrenheit

Eugenio borrowed me "Your memory" by Kenneth Higbee, Ph.D. Very interesting. I was finally able to remember the formula F=9/5C + 32 because of a phrase like "Friday is another 9 to 5 day at college. But I only have 32 minutes more to go before weekend starts."

Well, actually knowing the formula isn't gonna help a lot. When I lived in Canada I knew the following table by heart; it's more useful for day-to-day things:

C F
0 32 = 30+2
10 50 = 50+0
20 68 = 70-2
30 86 = 90-4



(tbc)

playing in the lottery

Last week the MegaSena was above 20 million reais (about 7 million US), I took the form but couldn't convince myself to play. The problem is that I never know which numbers to fill in.

The reasoning goes like this
1) Obviously, filling in 1, 2, 3, 4, 5, 6 is ridiculous
2) The probability of another combination of 6 (out of 60) has the same probability
3) Therefor any other comination is ridiculous.
4) Conclusion: playing is ridiculous

Nevertheless, if you play you have a(n infinitesmal small) probability of winning, whereas as you don't play you will not win.

Another reasoning goes like this:
1) The probability of winning is 1 in (6 choose 60) = 50.063,860
2) Air line incident (i.e. irregularity, not necessarily an accident) statistics are measured per million flights.
3) I how can I know that if one very unlikely event happens (winning lottery), that the other (airline crash) won't happen too.
My wife says I should play, win the lottery but than never fly buy plane, but I don't trust her (she is only heir).

Soon: how human intuition fails with conditional probabilities.

2005/02/23

converting pdf to text

I needed to convert some pdf files to text,
some of which I then converted to .doc .

I tried several tools but believe the best is
http://www.foolabs.com/xpdf/download.html

The windows version does not come with a fancy
interface (I think); you have to run through MS-DOS.

You need to check the output. For instance,
page numbers, page headers, page footers and
watermark will appear too. In one case,
the watermark "MINUTA" (draft in Portuguese)
was broken into "MI" and "NUTA" scattered
over the page.

Another problem is that it doesn't treat accents well.
I tried to write an AWK script to patch this,
but it didn't work in all cases (the hatted (^) letters
didn't come out well).

The best thing to do is to enter the text afterwards in
a program that does spelling correction, and in a few
minutes you correct everything.

2005/02/22

how to calculate the day of the week

EugĂȘnio told me today that by remembering twelve digits, we can know which is the first Sunday of each month and hence calculate all other days: 266-315-374-264.

There is however a neater trick:
in 2005, the following dates always fall on a Monday:
0/2 (last day of January)

0/3 (last day of February)
4/4,
6/6,
8/8,
10/10,
12/12,
7/11,
11/7,
9/5,
5/9,

This day has been baptised Doomsday (because it is
the last day of February), and in 2005 it is Monday,
in 2006 a Tuesday, in 2007 a Wednesday. 2008 is a leapyear;
by then I will explain how to deal with this case :-)

The mnemonic for May/July/September/November is:
"I have a 9 to 5 job at 7-11";
Seven-Eleven is a convenience store that opens
at 7 in the morning and closes at 11 at night.

Anyway, just remebering the "9 to 5 job" part is enough.

The trick is attributed to John Conway, whose books
("On Numbers and Games", and "Winning Ways")
I have tried to read several times. With no success, though.
BTW, the original text is far more complicated than the
explanations now available on the Internet.


See for instance
http://quasar.as.utexas.edu/BillInfo/doomsday.html
http://rudy.ca/doomsday.html
or search for "doomsday conway"