Main Site

This is Gem Newman's blog. Return to the main site.

Quotation

Showing posts with label math. Show all posts
Showing posts with label math. Show all posts

11 September 2017

LUEE Episode 124: Ancient Discoveries

On this episode of Life, the Universe & Everything Else, Gem, Ashlyn, Laura, and Lauren discuss several important scientific, technological, and mathematical discoveries made in the ancient world.

Life, the Universe & Everything Else is a podcast that delves into issues of science, critical thinking, and secular humanism.

Note: We experienced some technical difficulties near the top of Ashlyn's segment, so listeners may notice a brief drop in audio quality. Sorry!

Links: History of the compass (Wikipedia) | The Shorter Science and Civilisation in China (Joseph Needham and Colin A. Ronan) | Geomagnetic reversal (Wikipedia) | Formation of the Chinese Civilization (china.org.cn) | Contribution of Al-Khwarizmi to Mathematics and Geography (Muslim Heritage) | Muhammad ibn Musa al-Khwarizmi (Wikipedia) | Al-Khwarizmi biography (History
of Mathematics Archive)
| Al-Khwarizmi (The Story of Mathematics) | Who Invented Zero? (Live Science) | 0 (Wikipedia) | The Origin of Zero (Scientific American) | What is the origin of zero? How did we indicate nothingness before zero? (Scientific American) | Who invented the zero? (History.com) | Zero (History of Mathematics Archive) | The Origin of the Number Zero (Smithsonian) | Who invented zero and how? (Quora) | Babylonian numerals (Wikipedia) | Jabir ibn Hayyan (Wikipedia) | History of Science and Technology in Islam | Chemistry (Islamic Spain) | From Alchemy to Chemistry (Muslim Heritage) | Aqua regia (Wikipedia) | History of glass (Wikipedia)

Contact Us: Facebook | Twitter | Email

Listen: Direct Link | Apple Podcasts | Google Play | Stitcher | RSS Feed

16 January 2017

LUEE Episode 116: Risk

On this episode of Life, the Universe & Everything Else, Ashlyn, Laura, Gem, and Lauren talk about how bad we are at assessing risk. Also on this episode: Do we get more risk averse as we get older? Is margarine going to kill you, or will a hippopotamus get you first? Will the world end not with a bang but a Boolean?

Life, the Universe & Everything Else is a program promoting secular humanism and scientific skepticism that is produced by the Winnipeg Skeptics.

Note: Music featured in this episode include samples from "Death from the Skies" by George Hrab (featuring Phil Plait), "Paranoid Android" by Radiohead, and "Binnorie" by Mediæval Bæbes.

Links: Relative risk (Wikipedia) | Spreading disease or spreading deliciousness: the butter vs. margarine debate rages on (dietitian at home) | Global catastrophic risk (Wikipedia) | Death from the Skies! (Wikipedia) | Holocene extinction (Wikipedia) | Existential risk from artificial general intelligence (Wikipedia) | AI Risk Analysts are the Biggest Risk (Singularity Weblog) | There is a blind spot in AI research (Nature News) | Program good ethics into artificial intelligence (Nature News & Comment ) | TRC #429.5: Programming Ethics Into AI (The Reality Check) | Potential Risks from Advanced Artificial Intelligence: The Philanthropic Opportunity (Open Philanthropy Project ) | If Aliens Exist, They May Come to Get Us, Stephen Hawking Says (Space.com) | Risk Preferences and Aging: The "Certainty Effect" in Older Adults' Decision Making (Journal of Psychology and Aging) | Differences in risk aversion between young and older adults (NAN) | Differences in Risk Aversion between Young and Older Adults (Neuroscience and Neuroeconomics) | Aging and loss decision making: increased risk aversion and decreased use of maximizing information, with correlated rationality and value maximization | It is surprisingly rare for an alligator to kill a person (BBC Earth) | Chart: The animals that are most likely to kill you this summer (The Washington Post) | The Odds of Dying | 25 shocking things more likely to kill you than a shark (WNYY) | Choking Prevention and Rescue Tips | 10 Things More Likely to Kill You than Islamic Terror | List of selfie-related injuries and deaths (Wikipedia) | Animal bites (WHO)

Contact Us: Facebook | Twitter | Email

Listen: Direct Link | iTunes | Google Play | Stitcher | RSS Feed

27 March 2015

Pi Day Trivia

On 14 March 2015 the Winnipeg Skeptics held a Pi Day celebration, which featured games, trivia, and lots and lots of pie.

Since not everyone could make it out and people seem to like this sort of thing, here's some pi- (and pie-) related trivia!

Question One
In the Star Trek episode "Wolf in the Fold", the Enterprise’s computer (spoiler alert) becomes possessed by the spirit of Jack the Ripper. (God, Star Trek was dumb sometimes...) How does Spock foil the evil computer? (Answer)

Question Two
The digits of pi go on forever in a seemingly random sequence, meaning that it falls into which class of numbers? (Answer)

Question Three
Who said, "If you wish to make an Apple Pie from scratch, you must first invent the universe"? (Answer)

Question Four
While pi is popular, a minority of mathematicians argue that a constant equal to 2π would make for a better circle constant, for a host of (I think very convincing) reasons. What do they call their "2π" constant? (Answer)

Question Five
How long has the Greek letter "π" been used to represent the circle constant? (Answer)

Question Six
This successful World War II operation, which involved persuading the Germans that the Allies planned to invade Greece by planting fake war plans on a corpse in Spain, was named after a suet pie. (Answer)

Question Seven
Pi Day (14 March) is also the birthday of which famous physicist? (Answer)

Question Eight
According to a band member, a vision involving a man atop a flaming pie influenced a famous band’s name. Which band? (Answer)

Question Nine
Some of the earliest attempts to understand pi involved trying to do something that has now become a euphemism for a hopeless or impossible task. What is it? (Answer)

Question Ten
In 2005 the world record for memorizing the digits of pi was claimed by Chao Lu, a Chinese engineering student. How long did he spend reciting pi? (Answer)



I was going to have some questions about radians, but I couldn't figure out how to formulate them in a way that was remotely entertaining. So... there aren’t any. You're welcome.

Answer One
He instructs it to compute pi right down to the last digit, a task that it can never complete.

Answer Two
Irrational numbers

Answer Three
Carl Sagan

Answer Four
Tau. Pi is defined as the ratio of a circle’s circumference to its diameter; but it’s often written as the ratio of a circles circumference to double its radius (remember C = 2πr?). Tau is the ratio of a circle’s radius (rather than circumference) to its diameter, and it simplifies many common mathematical formulae.

Answer Five
About 300 years. It was William Jones who chose the Greek letter "π" to represent the circle constant in 1706. This choice was later popularized by Euler. Before the symbol's introduction, mathematics was a lot wordier, involving things like, "let x be the quantity which, when the diameter is multiplied by it, yields the circumference".

Answer Six
Operation Mincemeat, which was a British disinformation plan that persuaded Germany that they had accidentally intercepted "top secret" Allied documents. These plans were attached to a corpse deliberately left to wash up on a beach in Punta Umbría in Spain, and served to cover the actual Allied invasion of Italy from North Africa.

Mincemeat itself is a mixture of chopped dried fruit, distilled spirits and spices, and sometimes beef or suet. Originally, mincemeat always contained meat, but this is no longer the rule.

Answer Seven
Albert Einstein

Answer Eight
The Beatles. In a 1961 interview with Mersey Beat, John Lennon told the following story: "It came in a vision – a man appeared on a flaming pie and said unto them, 'From this day on you are Beatles with an A.' And so we were."

Answer Nine
Squaring the circle. That is to say: constructing a square with the same area as a given circle using only a compass and straightedge.

Answer Ten
24 hours (and 4 minutes). So if you spent Pi Day eating pie, or doing anything at all other than reciting numbers, be grateful. In 2005, Chao Lu recited 67,890 digits of pi correctly, claiming the previous record from Hiroyuki Goto of Japan. Goto’s record was 42,195 digits. How useful is this? Well, for comparison, you could compute the circumference of a circle around the known universe with an error no greater than the radius of a hydrogen atom using only 39 decimal places.

08 December 2013

MATLAB: WAT

I made a video! It's a brief sketch of some of the really weird things that the MATLAB programming language likes to do. It was (quite obviously) inspired by Gary Bernhardt's talk at CodeMash last year (which is, for the record, shorter and more entertaining). So if you haven't watched his talk, do yourself a favour and watch it instead!



Enjoy!

02 June 2013

LUEE Episode 58: Ghosts and Apparitions, Part 2

Episode 58: Ghosts and Apparitions, Part 2

In this episode of Life, the Universe & Everything Else, Gem Newman talks about the evidence (or lack thereof) for ghosts with Greg Christensen, Ian Leung, and Mark Forkheim. Also on this episode, Gem chats with Hemant Mehta of Friendly Atheist.

Life, the Universe & Everything Else is a program promoting secular humanism and scientific skepticism presented by the Winnipeg Skeptics and the Humanists, Atheists & Agnostics of Manitoba.

Warning: In the first few minutes of the podcast, Greg asks Gem to give a primer on Bayes' Theorem and conditional probability (and why this is at all relevant to ghosts). It involves a little bit of math, so brace yourself.

Links: Solstice Party (22 June 2013) | Drinking Skeptically (11 June 2013) | Bayes' Theorem | Sleep Paralysis | Apophenia | Pareidolia | Friendly Atheist | Steinbach Pastor Voices Opposition to Bill 18 | I Sold My Soul on eBay | The Young Atheist's Survival Guide

Contact Us: Facebook | Twitter | Email

Listen: Direct Link | iTunes | RSS Feed

Bayes' Theorem
P(A|B) = P(B|A) • P(A) / P(B)

The probability that it is raining, given the fact that it is cloudy:
P(Raining|Cloudy) = P(Cloudy|Raining) • P(Raining) / P(Cloudy)

The probability that ghosts exist, given the fact that you heard a weird noise:
P(Ghosts|Noise) = P(Noise|Ghosts) • P(Ghosts) / P(Noise)

In this instance, P(Noise|Ghosts) is the probability that you'd hear a weird noise, assuming ghosts exist, P(Ghosts) is the prior probability that ghosts exist, and P(Noise) is the probability that you'll hear weird noises (generally speaking).

The example numbers plugged in during the podcast:
P(Ghosts|Noise) = 0.95 • 0.05 / 0.60 = 0.08

So in this case, hearing a strange noise might increase your belief in ghosts from 5% to 8%; definitely not a smoking gun.

14 January 2013

SkeptiCamp Winnipeg 2012: A Sampling Sampler

On Saturday, 29 September 2012, the Winnipeg Skeptics held their third annual SkeptiCamp event. SkeptiCamp Winnipeg is a conference for the sharing of ideas. It is free and open to the public: anyone can attend and participate! Presentations and discussions focus on science and free inquiry, and the audience is encouraged to challenge presenters to defend their ideas.



Dr. Laura Targownik is a professional gastroenterologist and health services researcher (and yes, she was already heard your colonoscopy joke). She is most interested in discussing how to improve the public's understanding of medical issues, better living through statistics, and in improving resources for skeptical families.

SkeptiCamp is an open conference celebrating science and critical thinking. For more information please visit SkeptiCamp.org.

04 September 2012

Lies, Damned Lies, and Timestamps

So I just spent the last several hours working out an absurdly awesome solution to a time zone representation problem in MATLAB—after having spent a fair portion of the last year rewriting the way MATLAB handles dates and timedeltas (which, contrary to what MathWorks seems to believe, are not the same thing) from the ground up.

Having come up with a really fun, fairly optimal partial implementation of the median function that ignores NaN values just yesterday, I was pretty pumped. And then my cousin Henk (who's also a programmer) linked me to these two articles about time that caused me to grin like a maniac:

Falsehoods Programmers Believe About Time
More Falsehoods Programmers Believe About Time

If you're a programmer, or if you've ever had to work with multiple time zones in a professional capacity, you will like them! So, er, read them and stuff.

06 March 2012

2012: A Meta-Debunking

You may have seen this image floating around Facebook lately:


You may even have shared it yourself—and that's okay. There are so many things wrong with the "2012 Mayan Apocalypse" (the belief that the world will end at the conclusion of the thirteenth b'ak'tun of the ancient Mayan calendar) that it can be tempting to just pile on whenever the subject comes up.

But I'm afraid I'm going to have to burst this particular doomsday bubble: the Mesoamerican Long Count calendar is not a solar calendar, so the idea of a leap day makes absolutely no sense.

The Long Count calendar, which (supposedly) ends in December (except that it doesn't) is basically just a tally of the number of days that have elapsed since 11 August 3114 BCE (the creation-date of the universe*).

While it seems that their solar calendar would have required occasional adjustment if they wanted to keep in in line with the seasons, it's unclear what a leap year would even mean in the context of the Long Count calendar—which is what we're talking about in the context of 2012.

This image (and those like it) is guilty of speaking of a single "Mayan calendar", when the ancient Maya used several (at least three) different calendars for different purposes. Let me explain.

When someone says "calendar" these days, he or she is typically referring to the modern Gregorian calendar, which is a solar calendar. Solar calendars use leap days (according to certain rules, with varying degrees of complexity) to attempt to keep the equinoxes (and thus the seasons) aligned to certain calendar dates (with varying degrees of success). This is necessary because a calendar year contains 365 days, while a solar year contains an average of 365.24219 solar days (the length of the year and the day having little to nothing to do with each other).

A solar calendar is not your only option, however. Lunar calendars add additional complications, because the rate at which the Moon orbits the Earth is not directly related to the rate at which the Earth orbits the Sun. If a lunar calendar attempts to keep the seasons aligned to certain calendar dates (a lunisolar calendar), then leap months (intercalcations) are inserted from time to time (instead of leap days) to keep everything in order.

So which one of these is Mesoamerican Long Count calendar? Well, as I said before, it's not any of those. There were no years or months in the Long Count: just a number of days that counted up and up and up in a (slightly modified) base 20 system. The third "digit" of the calendar corresponded to a period of 360 days, but we know that the Mayan year was 365 days. The ancient Maya did use a solar calendar, called the Haab', which did not employ a leap year, so in that sense the image above is correct—but the Haab' has nothing to do with the purported apocalypse.

The point is, everyone who has ever attempted to convert a date from the Long Count calendar into our own Gregorian calendar would be aware that the Long Count doesn't use leap years—because the whole concept of a leap year doesn't make any sense in a calendar that doesn't use years to begin with! This means that what the image is actually saying is that everyone who has ever attempted to convert a date from the Long Count calendar into the Gregorian calendar somehow managed to forget that we use leap years!

Sigh.

Don't get me wrong: there's absolutely no reason to think that the world will end on the 20th (or the 21st) of December (or even that the ancient Maya predicted that it would!). But, contrary to the claim being made here, everything that I've been able to find indicates that 20 December 2012 is indeed the last day of the thirteenth b'ak'tun. I do know that the Long Count is set to roll over to the fourteenth b'ak'tun on our modern Gregorian date of 21 December 2012 (a fact confirmed by the New York Times, incidentally).

There are plenty of good reasons to believe that the supposed 2012 apocalypse is a load of fetid dingo's kidneys; there's no need to go invoking bad ones.

* Of course, you and I both know that the universe wasn't created on 11 August 3114 BCE: it actually came into existence on 23 October 4004 BCE!

19 August 2011

Stand back: I'm going to try Boolean logic!

Fair warning: unless you're really into hardcore computer geekery, you're probably going to want to ignore this post. This has nothing much to do with skepticism, so feel free to skip it.

I do a lot of work in MATLAB, a programming language not without its quirks. One of its (many) missing features is the ternary operator, also known as the inline if statement. I'll give you a trivial example.

In many languages, you can do something like this:

fprintf(file, 'The statement is %s!\n', statement ? 'true' : 'false');

In MATLAB, however, you have to do this:

if statement
    fprintf(file, 'The statement is true!\n');
else
    fprintf(file, 'The statement is false!\n');
end

Even if you don't understand the statements above, you probably get the idea. The first one is a lot more succinct than the second. There are cases in which you would need to completely restructure your function in order to remove a ternary operator. Although the uses of this operator are fairly esoteric, suffice it to say that this is a useful feature to have.

I came across a problem which really needed to be solved with an inline if. I was fooling around with function handles, and eventually came up with the following (warning: MATLAB code ahead):

iif = @(condition, ifTrue, ifFalse)(feval(@ result, trueOrFalse)(result{trueOrFalse + 1}), {ifFalse ifTrue}, condition));

Yes, that is a function handle declaration with a nested anonymous function. If you're not accustomed to dealing with function handles, I wouldn't be offended if you bowed out now.

In any event, this code allows me to replicate the inline if functionality that MATLAB is missing! Observe:

fprintf(file, 'The statement is %s!\n', iif(statement, 'true', 'false'));

Not bad! Needless to say, I felt pretty good about myself.

Of course, my friend Curt had to come along and burst my bubble. He pointed out that I was so obsessed with writing things in one line that I'd overlooked the fact that I could have just as easily written iif as a standard function and still used it as an inline if:

function result = iif(condition, ifTrue, ifFalse)
    if condition
        result = ifTrue;
    else
        result = ifFalse;
    end
end

I can still execute the iif function in one line, as above, but this version is clearly easier to read. I benchmarked the two of them several times with 10,000 random comparisons that evaluated to true or false. The function version of iif completed the benchmark in under 0.1 seconds, while the evaluating the function handle took a dismal 2.2 seconds.

Blast.

03 March 2011

02 December 2010

SkeptiCamp Winnipeg: Videos, Part 2

Scott Carnegie has posted the second round of SkeptiCamp videos at the Winnipeg Skeptics Blog. (And here's a link to part one, in case you missed it.)

Gem Newman: "The Pleasure of Figuring Things Out"



Jeffrey Olsson: "How Do We Know Anything?"

23 October 2010

SkeptiCamp: The Pleasure of Figuring Things Out

Today, the Winnipeg Skeptics are hosting Winnipeg's first SkeptiCamp. Video of all of the talks are on the way, but below you'll find the text of the brief talk that I'm giving to kick off SkeptiCamp.



So today is the twenty-third of October. Those of you who pay any attention whatever to the field of cosmogony (or read Pharyngula) will know that today marks a very important date. Yes, according to Bishop Ussher, today is Earth's birthday—today, our planet (and, indeed, all of the cosmos) turns 6013. Also, as Terry Pratchett and Neil Gaiman pointed out, the Earth is a Libra.*

Have any of you ever heard of the Monty Hall problem? It's based on the television show Let's Make a Deal, and it goes something like this:

You're on Let's Make a Deal, and Monty Hall has offered you a chance to win big: you're asked to select one of three doors. Behind one of the doors is a fabulous new car! But behind the other two are hilarious gag prizes that no one would ever want!

You point your finger toward one of the doors, trembling with excitement. Monty Hall smiles, steps up to one of the other doors, and opens it, revealing a goat! And then, with a twinkle in his eye, Monty Hall offers you a choice: you can either keep what's behind the door that you originally selected or you can switch to the third (unrevealed) door.

Now, here's the question: What should you do?

I've heard that even mathematicians argue about this one, because the solution is so contrary to common sense. [If you're really dying to know what the solution is, click here.]

But that's the problem: common sense only gets you so far. You've probably heard it said before that "Common sense is neither common nor sensible." It's great for the little things, like determining whether your brother split the piece of pie fairly or roughly how long it will take to get to grandma's house—but when common sense fails, it can fail spectacularly. Try using common sense to ascertain the shape of the earth, the motions of the planets, the age of the universe, the origin of life, the causes of and cures for disease, or even the solution to a fairly simple math problem, and the whole thing falls apart: you either get an answer that is spectacularly wrong or spectacularly useless. In fact, I would wager that the entire scientific enterprise is built upon moving beyond common sense.

I really enjoy figuring things out. I love learning something new. Our species thrives on innovation—that really seems to be our niche.


Have you ever heard the old proverb "curiosity killed the cat"? I hate that saying. When I was a kid, I asked a lot of questions. I imagine that I wasn't alone in this. Anyone have kids? They're curious, right? Right. So I asked a lot of questions. I was mostly raised by my father, and he was—is—a great dad. (Sure, he had some strange ideas—but moms and dads and aunts and uncles and brothers and sisters and husbands and wives and children and friends and pretty much everyone who isn't you is going to have some pretty strange ideas, right? You deal with it.) But my dad is a really great dad, and one of the many really great qualities that really made that really great dad great was the fact that he always, without fail, every time encouraged my curiosity. And that is, if you'll excuse me saying so, really great. If I asked questions, he'd answer them, but he'd also ask questions back. He made me think about things, and no question was ever off-limits.

I think that curiosity is really important. But... not everyone agrees with me. Try this quotation on for size:

"There is another form of temptation, even more fraught with danger. This is the disease of curiosity. It is this which drives us to try and discover the secrets of nature, those secrets which are beyond our understanding, which can avail us nothing and which man should not wish to learn."

Anyone know where that quotation comes from? That's from Saint Augustine's Confessions, and I like it in probably exactly the same way that Professor X likes Magneto. That kind of thinking is very dangerous. It leaves people dying of plagues and famines, it stifles innovation, it encourages an insular society closed to new ideas, it discourages free inquiry into the mysteries of nature, and ultimately it can avail us nothing.

This isn't about religion, so I'll put this train back on its tracks in just a second, but I want to share one more thought with you on the subject. Julian Begini expressed this quite well, I think: "It is arguable," he said, "that humanism has a better grip on life's mysteries than religion. For example, I'm genuinely in the dark about how the universe started, whereas plenty of religious believers have that hole in their understanding plugged by their deity."

I'd rather not know than have a non-answer. To me, saying "God did it" is like saying "it's magic!" You're not actually answering the question.

Okay, that's enough about that: I don't want to get preachy. Nobody likes preachy, right?

You know, I briefly considered calling this talk "The Disease of Curiosity". I frankly thought that would be a brilliant idea. Thankfully, my wife talked me out of it. We now have fewer talks that sound like they're about contracting a venereal disease.

Okay. Let's learn something!



You know what I learned? I learned that despite being a happily married heterosexual man, I have a huge crush on Adam Savage.

I'm the lead developer of a Winnipeg software company specialising in machine learning applications. As part of my job, I have to interview many prospective full-time, part-time, and co-op employees. I conduct about twenty interviews each year. These people are smart people, and the positions that they're interviewing for are challenging ones—many are going to be working in one or many programming languages with which they have little to no experience, they'll be working on cutting-edge expert systems, and, quite frankly, they won't be paid very well. For this reason, the interview process that we employ is what can only be called grueling.

These people's job will be to figure stuff out. You probably won't be surprised to learn that I prize the ability to solve a novel problem more highly than I do a knowledgebase. If an applicant tells me that she has a working knowledge of Scilab, Python, FreeMat, PERL, and SQL, that's great! But it won't get her a free pass. And so, as a warm-up, I like to ask a few riddles.

So.

You are presented with four cards lying on a table. Each card has a number on one side and a letter on the other, and the visible faces read "A", "B", "2", and "3". You are provided with an hypothesis, and it is this: each of these cards that has a vowel on one side has an even number on the other. You have permission to flip over two of the cards. If you want to conclusively confirm or disconfirm this hypothesis, which two should you flip?


I'll let you think about that for a moment. Once again, the hypothesis is: each card with a vowel on one side has an even number on the other.

Poll the audience for each of the six solutions: A & B, 2 & 3, A & 2, B & 3, A & 3, B & 2.

This problem is pulled directly from the pages of John Allen Paulos' Innumeracy, a wonderful and eminently readable book from which I try to plagiarise at least once a day.

One of the things that this problem does very well is showcase confirmation bias: that is to say our tendency to look for confirmatory evidence and ignore disconfirmatory evidence. While many will opt for flipping "A" and "2", flipping "2" will actually add no new information to the system. Remember that the hypothesis was that each card with a vowel on one side has an even number on the other, NOT that each card with an even number on one side has a vowel on the other. If "2" has a vowel on the other side, it is consistent with our hypothesis but does not confirm it, as "3" could still have a vowel on its reverse; if, however, "2" has a consonant on the other side, it will neither confirm nor disconfirm our hypothesis because it does not fit into the problem space. "A" and "3" are the correct cards to flip, because in all cases revealing their other sides will positively confirm or disconfirm our hypothesis.

Anyone remember the Infinite Improbability Drive from Hitchhiker's Guide? The basic idea was that if you could calculate precisely how improbable it was that you would spontaneously appear somewhere else, you could do just that. It also had the nasty side-effect of causing incredibly improbable things to happen.

Shall we make something really improbable happen? Let's talk about numbers for a bit. I work with numbers all day, and I love 'em. They're weird little monsters, though. I asked my computer to generate two sequences of twenty-five (pseudo)random numbers between 1 and 10, and then I sorted them so that you could easily see the distributions.

Sequence One:
3 7 2 2 9 3 7 4 7 5 9 3 10 2 6 9 3 3 6 8 3 2 6 10 10

Sequence Two:
3 2 6 5 6 8 7 4 5 3 10 8 4 7 8 3 5 9 1 1 1 3 10 8 2

Distribution One:

2 2 2 2
3 3 3 3 3 3
4
5
6 6 6
7 7 7
8
9 9 9
10 10 10
Distribution Two:
1 1 1
2 2
3 3 3 3
4 4
5 5 5
6 6
7 7
8 8 8 8
9
10 10

Which of those number sequences looks more random?

What do you notice when you look at the numbers on the left? The first thing jumped out at me was that there were no ones! The probability of selecting 25 random integers between one and ten and not receiving any ones is only about 7%! Did I make a mistake when I input the query?

Did you catch what I did just there? It isn't actually any more likely that I would arrive at that particular sequence of numbers than that I would pick seven every single time. Prior to the numbers being picked, the probability of arriving at any number sequence with that distribution of ones and twos and threes and so-ons was about one in 200 million, and the probability of arriving at that specific sequence of numbers was one in 10 septillion.

Afterward? The probability was one in one. It's important to remember that the chances of arriving at any random sequence of numbers is the same, and anything that was picked would be equally improbable. So next time someone tells you about some "one in a million thing" that just happened to them, you may have cause to be less impressed. Astoundingly improbable things happen all the time.

Now, I have to admit something: I lied to you all a moment ago when I said that I asked my computer to generate two sets of numbers. To my eyes, the sequence on the left doesn't look nearly as random as the sequence on the right. There are way too many threes, there are no ones, and three of the numbers were only selected a single time! Those are the things that I tried to correct when I hand-crafted the list on the right. Contrary to our expectations, randomness can actually be remarkably clumpy.

For those of you who are interested, I calculated the probability of arriving at that numeric distribution binomially, and it's entirely possible that I made a mistake. Feel free to work through it yourself. You'll need these equations, which you may remember from high-school pre-cal:

Pr = nCr · pr · (1 - p)n – r
nCr = n! ÷ (r! · (n – r)!)


When you watch MythBusters, what is it that draws you in?

For me, it isn't the explosions. I love to watch Adam and Jamie trying to figure things out. Why? Well, partly it's because I want to know the answer, and I want to see how they intend on arriving at it. But more than that, I love to watch how excited they are. It's contagious! Be excited about learning. I'm sure that most of you can remember a teacher that you had in high-school who was really enthusiastic about his or her subject matter. That's a wonderful thing!

And as media expands, those people can rise to the top. Today we have Adam Savage, Jamie Hyneman, Phil Plait, Neil deGrasse Tyson, Brian Dunning, Rebecca Watson, Simon Singh, Richard Wiseman, the Novella brothers... the list seems endless.

Carl Sagan isn't around, anymore. Neither is Richard Feynman. But their legacy lives on. We need people to be excited about learning and about problem solving and about science, because we don't want our society to stagnate.

How about one for the road? This is a problem that is fairly well designed to confound computer scientists, and it's currently my favourite puzzle. Let's say that you are given a balance scale and eight weights. The eight weights are identical in appearance, but one is very slightly heavier than the rest. You can use the balance scale twice, putting any number of weights on each side and observing the result. Is it possible to conclusively determine which of the eight weights is heaviest in this way?


I'm not going to reveal the answer to you. If you think that you've got it, feel free to seek me out later, but please don't announce it to everyone, because you'll spoil the fun.

So what am I trying to say? What it really comes down to is this: this disease of curiosity against which Augustine railed has led to all of the amazing advancements in science and technology of which we avail ourselves on a daily basis. Curiosity is pretty much the best thing we've got going for us.

When you spend a lot of time trying to figure things out, sometimes you just won't get it. And that's okay. There have been times that I've literally spent five hours trying to solve a particular mathematics problem, for no other reason than that I wanted to know the answer. Sometimes, you're just not going to figure it out—but that's no reason not to try. I'd always rather see somebody fail than see that person not try at all.

It's a cliché, I know, but from failure you learn a whole lot more than you do from success. In Last Chance to See, Douglas Adams said that "human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so." Let's prove him wrong.

Oh. And you should switch.



* Technically, in 4004 BCE, I believe that the Earth would be a Scorpio, although 23 October is firmly Libra in today's sidereal astrology. But for some reason, Libra makes the joke better. This explanation, however, does not.



Spoiler alert! If you don't want to learn the solution to the Monty Hall Problem, read no further!

Do you think that it doesn't matter either way? Each door has a 50% chance of having a goat on the other side? Well, if so, then you'd be wrong. You should switch doors.

It's important to remember that Monty can and will always reveal a goat. Since we're dealing with a relatively small problem space, let's explore it. First, we'll assume that you decide you'll always stay. We'll label the winning door D1. There are three possibilities:

  1. You pick D1. He reveals a goat (either D2 or D3). You stay. You win!
  2. You pick D2. He reveals D3. You stay. You lose!
  3. You pick D3. He reveals D2. You stay. You lose!

So if you stay, one time in three you'll win.

Next, assume that you decide you'll always switch. Again, we'll label the winning door D1. There are three possibilities:

  1. You pick D1. He reveals a goat (either D2 or D3). You switch. You lose!
  2. You pick D2. He reveals D3. You switch to D1. You win!
  3. You pick D3. He reveals D2. You switch to D1. You win!

If you switch, two times in three you'll win.

A less intuitive (more "mathy") way of explaining it is that the door that you pick initially has a probability of ⅓ of being a winner. The other two doors, taken together, have a collective probability of ⅔ of having a winner among them. When Monty reveals that one of them is a goat (which he always will), that set of two doors still has a ⅔ chance of containing a winner. Since you know that one of them is a goat, the other has a ⅔ probability of winning.

14 December 2009

The Pleasure of Figuring Things Out

Not to be confused with The Pleasure of Finding Things Out, a (by all accounts excellent) book by Richard Feynman.

Caveat: This entry will be somewhat more self-indulgent than usual. You have been warned.

I recently bought some delightful new invisible bookshelves; they ingeniously wrought to create the illusion that the books are hanging unsupported in the air. I am thus far very pleased with them, and intend to buy several more.



After affixing them to the wall, yesterday, it occurred to me that many of the books that I intended to put on them were quite weighty, and might exceed their carrying capacity. I checked the packaging and, sure enough, nine kilograms (about twenty pounds, for you Americans) was the limit.

I spent a moment scratching my head, and decided to consult my bathroom scale. I wasn't sure if it was sensitive enough to discern such small masses with any accuracy, but I figured that if it came down to that I could always weigh myself while holding the books, and subtract my weight without them, the way one might weigh a cat, dog, snake, turtle, microraptor, or any other household pet. This was rendered moot, of course, when I stepped into the lavatory and discovered that I didn't own a bathroom scale.

Many people would have, at this point, run out to the store to buy the device; indeed, I briefly considered doing just that, as such things are useful to have on hand in case one has guests and a spontaneous weight-loss competition happens to arise. But that would have been no fun, and besides, the missus was out with the truck, and I wasn't looking forward to the walking to the store when it was thirty below.

So I fetched a broom handle, some floorboards left over from when I laid down the hardwood last summer, a lightweight mop bucket, a measuring cup, and the stack of books in question. I had all the makings of a balance scale: just add water.

Using the measuring cup, I filled the mop bucket with nine litres of water (for those of you who recall highschool physics, the litre is a derived metric unit defined as the volume of one kilogram—or grave, if you want to be archaic—of water*), then took a little bit out to make up for the mass of the bucket—I didn't want to be too precise. I used a measuring tape and pencil to mark the midpoint of the floorboards' length, set them across the broom handle at this point, and set the bucket of water on one end. Ensuring that the midpoint of the boards remained over the broom handle, I set the stack of books on the other end.

If the books lifted the bucket, then they were too heavy. Simple.


My cat, Spot, is puzzled by the contraption.

Science!

*Or rather, it used to be.

28 September 2009

The Law of Infinitesimals

I was recently involved in a discussion of homeopathy, and I brought up Avagadro's constant in passing, noting that Hahnemann proposed ludicrous serial dilutions before the value of the constant was known. I was then asked how the value of this number related to homeopathic dilutions. I replied vaguely that it was mostly an order of magnitude thing. My companion pressed me for details, so I sat down and walked her through it, because I like math and also because I think that such inquiry is important. Samuel Hahnemann's principle of serial dilution (the idea that the further a substance is diluted, the more potent is its effect) is a ludicrous one, and actually doing the calculations can be very enlightening.

Let's begin with the assumption that our homeopathic medium is water. What we need to begin is the molecular mass of water; this is easy to calculate, if you have a periodic table handy. Water (H20) contains two hydrogen atoms (one proton each) and one oxygen atom (eight protons and eight neutrons, usually), making for atomic masses of 1 u and 16 u, respectively. This makes the molecular mass of water 1 + 1 + 16 = 18 u.

Now, if you remember high school chemistry (I won't blame you if you don't), 1 unified atomic mass unit (I just found out that chemical and physical amu were deprecated!) is equal to 1 gram/mole. This means that water, at an atomic mass of 18 u, has a mass of 18 grams per mole of particles. And here's where we come to the importance of Avagadro's constant: one mole is approximately 6.02 x 1023 (this number was arrived at by calculating the number of atoms in 12 grams of carbon-12, in case you're interested).

If we want to take a hard look at our dilution, we need the number of molecules in our dilution medium before we begin. So if we have 18 grams per mole (which, for water, is 18 millilitres per mole—thank you, metric system!) and one mole is 6.02 x 1023... Well, let's do the math!

18 g/mol = 0.0556 mol/g
0.0556 mol/g = 0.0556 x 6.02 x 1023/g
0.0556 x 6.02 x 1023/g = 3.34 x 1022/g

Or you could just have WolframAlpha calculate it for you. But that wouldn't be nearly as fun!

How about alcohol? Ethanol being more popular (and less deadly) than methanol, we'll use that:

46 g/mol = 0.0217 mol/g
0.0217 mol/g = 0.0217 x 6.02 x 1023/g
0.0217 x 6.02 x 1023/g = 1.03 x 1022/g

So what does this tell us? Well, a standard homeopathic dilution is 30C (or 60X), which means one part "active" ingredient in 10030 (or 1060) parts water or alcohol. But here's the kicker: we just calculated the maximum number of "parts" into which it is possible to divide water! Unless you go splitting the atom, you can't divide 1 cc of water into more than 3.34 x 1022 parts. Let's say we're dealing with a full litre of the stuff (approximately two pints, for you Americans): we're still only dealing with 3.34 x 1025 molecules—we're still off by a whopping thirty-five orders of magnitude!

So what's the maximum dilution at which you're more likely than not to have at least one molecule of the original substance? You use logarithms! Assuming one litre of water (1 kg):

log10 3.34 x 1025 = 25.5

Alternatively, assuming 1.27 litres of ethanol (1 kg):

log10 1.03 x 1025 = 25.0

That would be a dilution of 25X (approximately 13C). At dilutions above 13C, you are unlikely to have a single molecule of the original substance left!

The solution? (Pun unintentional, but appreciated!) Water has memory! For an erudite discussion of this subject matter, may I suggest Storm, by Tim Minchin?