Science & Nature Archive

Thursday, May 23, 2013

Tuesday Boy Problem Solved by Simulation

Math PuzzleThe other day, I came across a logic/math problem I hadn't heard before, The Tuesday Birthday Problem. It goes like this:

I have two children, one of whom is a son born on a Tuesday. What is the probability that I have two boys?

This puzzle was apparently first presented at a convention for mathematicians, magicians and puzzle enthusiasts (yeah, that's a pretty specialized convention) by Gary Foshee. Immediately after giving the puzzle, he followed up with this.

The first thing you think is 'What has Tuesday got to do with it?' Well, it has everything to do with it.

I know my first inclination was to dismiss that extra fact. How could it have any effect on the probability of the sex of the other child. I first read this puzzle late at night when I was tired, so I didn't feel like putting too much thought into it. Instead, I just read the explanations of how that extra bit of information alters the odds. But I still wasn't ready to buy those explanations just yet. But rather than try to think through the explanation that night, I decided to tackle it from a different angle. Instead of trying to figure out the odds, I'd just program a simulation and see how it played out.

In fact, this is a very simple simulation. I didn't program it in the most efficient manner, but it got the job done. Here's what I did. I created a 4 x 10,000 element array. That is, 10,000 sets of kids, with four pieces of information to designate sex and birth day of the week for each kid (sex 1, day 1, sex 2, day 2). Then, I randomly assigned sex and birth day to each of the kids. Next, I created a couple variables that would be filled in in the next stage. First was a variable keeping track of the number of sets where at least one was a boy born on a Tuesday - that is, the number of sets where the father would have given his first statement. The other variable was the number of sets with a boy born on a Tuesday and another son - the sets fulfilling the second statement. With the array and variables in place, I went back and did some if statements to simulate the father's conditions, increasing the totals of those variables as appropriate. When that was done, I simple divided the number of sets with kids with a boy born on a Tuesday and another son by the number of sets with at least one boy born on a Tuesday.

After running this program a few times, I found a small problem. 10,000 sets wasn't enough. The fraction was varying by several percentage points each time I ran it. So, I added one more feature to allow the program to keep a running average every time it ran.

Oh, and just to be sure I was doing things properly, I added a similar set of calculations to calculate the probability for a simpler puzzle:

I have two children, one of whom is a son. What is the probability that I have two boys?

This is much easier to understand, so it was my control to make sure the algorithm was working properly.

Warning: Don't read on if you want to solve the problem on your own, first.

Well, guess what I found out. After running the simulation on 100,000,000 sets of kids, I got a probability of 0.4813391 for the Tuesday boy problem, and 0.3333046 for the simpler boy problem. Those are very close to the actual odds of 13/27 (0.481481481...) and 1/3 (0.33333333...). It's pretty counterintuitive, but I guess those eggheads know what they're talking about, after all.

Image Source: Wikimedia Commons

Anyone interested in checking this out for themselves can download my program below:

Thursday, September 27, 2012

Mars Curiosity Rover - Is It Worth the Price Tag?

An artist depicts the moment that NASA's Curiosity rover touches down onto the Martian surface.Here's a short article I got started on back when the Curiosity Rover first landed, but then kind of forgot about and let linger. But, it's still relevant, so I've decided to finish it off and post it.

Whenever there's any type of science project in the news that doesn't seem to have immediate practical applications, some people inevitably ask why the research is being done. And when the price tag seems high, then even more people pose the question and lament the 'waste' of money.

I've written on this subject a couple times before. In this entry, Knowledge for Knowledge's Sake, I made two points defending science. First, as the title of that post suggested, that knowledge in and of itself is enough of a reason for some of us. "In the same way that some people may find beauty in a painting, others can find beauty in a deeper understanding of the mysteries of our universe." The other point was more pragmatic, that we don't always know where research will lead, and that there may actually be practical applications that we can't anticipate right now. Do you think that Albert Michelson and Edward Morley had any idea that their experiments looking for aether were one link in the chain that would eventually led to the GPS in my iPhone? My other entry on this subject, Why Study the Higgs Boson?, was mostly linking to other people making the same points, but more eloquently than I could. For example, I quoted Steven Weinberg, in reference to 19th century experiments on electricity, "If these physicists had limited themselves to work of obvious practical importance, they would have been studying the behavior of steam boilers."

So, those same points hold for the Curiosity Rover. But what about the price? The mission cost on the order of $2.5 billion (that's the American billion, or $2.5 thousand million for those of you using the long scale). That's a lot of money. Is knowledge for knowledge's sake really worth that much?

Let's look at some comparisons. The national budget proposed for 2011 was $3.69 trillion. The defense portion of that was $738 billion. Social Security was about the same. Medicare was $498 billion. So the Curiosity Rover was only .07% of the national budget, .3% of the defense budget (same for Social Security), or .5% of the Medicare budget. We're talking about a miniscule part of the budget.

Here's another comparison. Avatar (the movie) grossed $2.78 billion. That single movie grossed more than the cost of the rover. The next highest grossing movie, Titanic, was just about there with $2.19 billion. And several movies over the past two years have grossed over $1 billion. So the cost of the latest Mars rover would be covered by just one or two blockbuster films.

So yes, I think the Curiosity Rover was worthwhile. Whether or not the knowledge it yields will ever lead to practical applications, its overall cost is tiny compared to everything else the nation spends money on. And the cost seems especially reasonable when you consider that people were willing to pay more to watch a movie about visiting another planet than what it cost to actually send a robot to explore another planet.

For some reason, I had this link in the draft copy I'd saved of this entry. Maybe I had some profound point I was going to make, but that I've now forgotten. Or maybe I was using it as an example of why I think planetary exploration is important:
Interstellar Potatoes

Image Source: NASA

Thursday, August 9, 2012

The Roots of Morality

I don't often have posts that are little more than embedded YouTube videos, but this one was too good to pass up. A few months ago, Frans de Waal gave a TED presentation: Moral behavior in animals. I'd highly suggest following that link to watch his full presentation, but one of the videos he showed has been pulled out into it's own YouTube video. The video is of an experiment with capuchin monkeys. These monkeys had been trained to return a rock that a researcher gave them in exchange for a treat. It's important to note that capuchins like certain treats more than others. A piece of cucumber is decent, but they really like grapes. I suppose it would be like the difference in getting a piece of hard candy from your grandmother vs. crème brûlée in a 5 star restaurant (or substitue according to your tastes). In this particular experiment, there were two monkeys involved, each in a separate cage, but adjacent to each other so that they could see each other. The first monkey returned the rock to the researcher, and received a cucumber in return as a treat. The second monkey returned the rock to the researcher, but received a grape in return, which the first monkey clearly saw. Next, the researcher went back to the first monkey, and again gave it a cucumber in return for the rock. Watch the video below to see the monkey's reaction.

This may not be a full sense of morality as developed in humans, but it's certainly a part of it - recognizing an unfair situation. It amazes me just how human like the monkey's reaction is. It reminds me of how a young child with poor impulse control might react.

Now, I know there are dangers in over anthropomorphizing, but really, when we're so closely related to an animal, doesn't it make more sense to think that their thought processes are at least similar to ours, rather than thinking that humans evolved all these brand new and novel characteristics in an evolutionary blink of an eye?

I'll note that I first saw this on Jerry Coyne's Why Evolution Is True. Follow that link to read some good discussion of the video (along with some rather close minded remarks by one particular commenter).

Tuesday, July 17, 2012

Why Study the Higgs Boson?

With the recent news over the probable discovery of the Higgs Boson, I've seen an old question come up again - What's the point of doing this type of research?

I've covered this before on the blog in the essay, Knowledge for Knowledge's Sake. That essay was in reference to dark matter, but it's largely applicable to the Higgs Boson, so I'm not going to repeat myself here. However, I've seen a few good takes from others on this question.

First is an article in the New York Times by Steven Weinberg, Why the Higgs Boson Matters. Jumping to the end, here was his conclusion:

On a longer time scale, the advance of technology will reflect the coherent picture of nature we are now assembling. At the end of the 19th century physicists in England were exploring the properties of electric currents passing through a near vacuum. Although this was pure science, it led to our knowledge of the electron, without which a large part of today's technology would be impossible. If these physicists had limited themselves to work of obvious practical importance, they would have been studying the behavior of steam boilers.

Next is an article by Jerry Coyne, which used Weinberg's article as a starting point, Steven Weinberg on the Higgs boson, and a few words on the value of pure science. Here's an excerpt of what he had to say:

But I wish we could convince the public that there are simple payoffs in understanding. Humans are curious animals: we want to know where we came from, and where the universe came from, and what we and the universe are made of. That is worth something in itself. Even if evolutionary biology had no practical benefits (and yes, there are some, but the vast amount of money given us by taxpayers to study evolution is to promote pure understanding), it would be worth spending money on, just as we subsidize the arts.

And finally, a recent comic on Saturday Morning Breakfast Cereal made the point quite humorously. Here's the first panel from that comic. Click on it to read the whole thing:

SMBC #2674

Saturday, July 7, 2012

Arguing on a Website - Explaining Evolution

Evolutionary TreeI didn't write much on the blog this week because I spent a few lunch breaks getting caught up in a discussion in the comments section of an article in the local paper. So, I'll do what I often do in these situations, and copy my comments here. It's a bit repetitious of other things I've written before, but due too the nature of comments, a bit briefer.

You should read the Letter to the Editor that kicked off the conversation first. Be warned that much of the discussion in the comments section degraded into name calling, triggered by the second letter at that link.

Here's my first comment.

Although I agree with much of the sentiment of Jim Edwards, I did see a few places where what he wrote is in need of correction, or where I might add a litte more information.

"First of all man did not evolve from apes."

Granted, this is a semantic issue, but it's one of my pet peeves. Humans did not evolve from any of the other extant apes, true. We didn't evolve from chimps or bonobos (they didn't evolve from us, either). We all three species share a common ancestor. Further back still, we share a common ancestor with gorillas, and even further back with orangutans. But if you were to get in a time machine and travel back to any of those common ancestors, whatever species they might be, they would still be referred to as apes. It would be like arguing that crows didn't evolve from birds, but only share a common ancestor with birds.

Regarding the time of the split, the current best estimate is around 6 million years between us and chimps & bonobos. The other apes split off from our lineage earlier than that. You have to go back around 20 million years for the split between old world monkeys and us apes, and back around 30 million years for the split with new world monkeys.

If you're really interested in the family tree, just google "primate phylogeny".

Regarding 'missing links', I'm not sure what people expect them to look like, but there are plenty of transitional fossils that have been found. To give just two examples, tiktaalik roseae is a great example of the transition from fish to tetrapods, and ambulocetus is a great example of the transition from terrestrial mammal to whale. But keep in mind that these examples don't rest solely on their own. You have to look at them in context of other fossils. For example, animals like Eustheopteron and Panderichthys are similar to Tiktaalik, but more fish like, while animals like Acanthostega and Ichtyostega are also similar, but more tetrapod like. On the human side, just google "talk origins hominid skulls", and you'll find a page showing skulls grading gradually from earlier hominid ancestors into us modern humans.

And my second:

tdgriffin wrote:

"I have no doubt that the DNA of apes and humans are similar. I wouldn't be surprised if doves and pigeons have similar DNA. They resemble each other. It doesn't prove they came from the same ancestor."

Why would our DNA be so very similar to that of a chimp's if not for common ancestry? Let me use an example. Most animals can make their own vitamin C. They don't need to eat foods high in the vitamin because their bodies simply synthesize it from the other molecules of the food they eat. Scientists have found the gene responsible for this, the L-gulano-γ-lactone oxidase gene. They've found a broken copy of this gene in humans. So the first question is, why would we have a broken copy of a gene, unless we inherited it from an ancestor with a functioning copy? Now, I know some creationists might say that maybe Adam and Eve did have functioning copies of this gene, and mutation crippled it. But guess what, scientists have also found this gene in chimps, macaques, and other primates, and it's broken in the same location as the human copy. So now you have to accept that this gene either just happened to mutate in the same location in all of these different animals, or that a creator intentionally put the same broken, non-functioning gene in all these animals, when it just makes so much more sense to assume that it mutated in a common ancestor of all these animals, which passed it on to all of its descendants.

(As to why a broken gene could have persisted in successful animals, if you're eating a diet rich in fruits and vegetables, it really won't hurt you if you can't make Vitamin C, so there's no selection pressure for those individuals with a working copy vs those with a broken copy.)

And L-gulano-γ-lactone oxidase isn't the only example. We share other pseudogenes with the great apes, and similarities in 'junk' DNA also match the pattern predicted by common ancestry.

And then my third and final comment:

in response to tdgriffin:
So, I take it you disagree with me? Oh well. But I still wonder why we, in our never ending quest for the perfect species, would hang onto a broken copy of an unnecessary gene over millions of years, since we and the apes decided to go our separate ways. When I break a cd, I chunk that bugger.

Another thing I wonder about, when I hear it mentioned: Just how many generations would it take for a black family living in New York to become white, or a white family living in South Africa to become black?

Natural selection only acts on beneficial or harmful traits. Beneficial traits allow an organism to have more offspring, so that trait becomes more common in a population. Harmful traits cause an organism to have less offspring, so that trait becomes less common in the population. Neutral traits aren't acted on by natural selection, and can persist (although, in the long run, neutral traits tend to deteriorate or drift just because there's no pressure from natural selection to maintain them). Also keep in mind, that there's no mechanism in our cells to do what you propose - cut out bad sections of DNA. Our cells just copy the DNA, making a few mistakes here and there in mutations. And of course, there's no conscious intent. You can't will your cells to cut out your broken L-gulano-γ-lactone oxidase gene in the sperm or eggs that you'll provide to your children.

So, some of our distant ancestors lived in an environment where they ate lots of fruit and vegetables, and got plenty of Vitamin C from their diet. When some mutation occurred that crippled Vitamin C synthesis, it didn't help or hurt that individual. Even if a mechanism existed to do it, cutting out the broken gene wouldn't have been noticeably beneficial. It was a neutral mutation. So, it didn't hurt that individual's chances of having offspring, and the broken gene began to spread.

But now there is an interesting question - if the broken gene wasn't beneficial, how did it become so widespread as to become fixed in the entire population? Here's where it's good to remember that populations are composed of individuals, and that sometimes a little bit of chance comes into play. From time to time, there will be population bottlenecks. This may be due to hard times that kill off most of a population, or from a small group becoming isolated and then developing into a new species. So when you get down to those small population sizes, chance plays a big role in which versions of genes are present and, and consequently which will persist in that population. (You can read more about this on Wikipedia under 'Founder Effect':

As to the question of skin color, I honestly don't know, but I suspect that in modern times, it might not happen at all. Remember that in evolutionary terms, 'fitness' merely means successfully leaving offspring. And for natural selection to act on a trait, it has to result in individuals having either more or less children than other individuals with different traits. In modern day New York City or modern day South Africa, where much of people's lives are spent indoors, and where dietary supplements are readily available for those with Vitamin D deficiencies, I doubt there's any strong selection pressure on skin pigment.


Selling Out