Posts

Showing posts with the label mathematics

Math is a game

Math is a game, an arbitrary set of symbols and rules. The weird part, the part that always surprises me, is that it's relevant to the real world. Here's an example: we'll start with just two symbols, Yin and Yang. (Replace those with black and white, circle and square, X and Y… whichever two symbols you prefer.) What can we do with them? Well, the simplest thing we can do is transform one into the other: Yin → Yang; Yang → Yin We'll call this transformation "mirroring" and denote it with the letter "M". What about combining two symbols? We have a number of possibilities: A) Yin, Yang → Yin; Yang, Yin → Yin; Yin, Yin → Yin; Yang, Yang → Yin This is rather boring… no matter what we start with, we obtain an Yin symbol. Nevertheless, let's continue. B) The opposite of A: Yin, Yang → Yang; Yang, Yin → Yang; Yin, Yin → Yang; Yang, Yang → Yang. Still boring. C) Yin, Yang → Yin; Yang, Yin → Yin; Yin, Y...

Stupid code fragments, part two

Probabilities are hard. As an example, there's a known puzzle: a family has two children; if one of them is a girl, what is the probability that the other one is also a girl? The answer, un-intuitively, is not 1/2 but 1/3. There are various explanations but – as with the Monty Python puzzle years ago – I wanted to write code to check it out, so I wrote the following using LinqPad: void Main() { var rnd = new Random(); // Generate a random set of families with two children; true means girl, false means boy var all = Enumerable.Range(1, 10000).Select(_ => new Pair(rnd.Next(2) == 0, rnd.Next(2) == 0)).ToList(); // Extract only the families with at least one girl var oneGirl = all.Where(it => it.First || it.Second).ToList(); // Out of those families, how many have two girls? The result should be 1/3rd var otherGirl = oneGirl.Where(it => it.First && it.Second).ToList(); Console.Wri...

On 0.999...

While trying to explain to someone that 0.999... aka 0.(9) is equal to 1 - not almost equal, but equal - one of the "arguments" he used was that recurring decimals are not really numbers, you can't do mathematical operations with them. While the idea is mind-boggling - 0.(1) is 1/9 which is a rational number - I thought of a proof that doesn't use recurring decimals: using base 9. 0.(1) 10 = (0.1) 9 (0.0) 9 + (0.1) 9 = (0.1) 9 (0.1) 9 + (0.1) 9 = (0.2) 9 (0.2) 9 + (0.1) 9 = (0.3) 9 (0.3) 9 + (0.1) 9 = (0.4) 9 (0.4) 9 + (0.1) 9 = (0.5) 9 (0.5) 9 + (0.1) 9 = (0.6) 9 (0.6) 9 + (0.1) 9 = (0.7) 9 (0.7) 9 + (0.1) 9 = (0.8) 9 Finally, (0.8) 9 + (0.1) 9 = ? Well... in any numeration base, when you finished the digits you restart at 0 and add 1 to the next order, so: (0.8) 9 + (0.1) 9 = (1.0) 9 Recasting the above in base 10, we have 0.(8) + 0.(1) = 1.0 However, in base 10 we still have a digit left, so it is equally valid to write 0.(8) + 0.(1) = 0.(9) j...

More on probabilities

This is in regards to the often-repeated saying "improbable events happen all the time" (even Dembski says that... which only serves to show that even people on "my" side can be idiots). I just read something that was so apropos of this: Heroic Law of Probabilities: One-in-a-million chances happen 9/10 (Look for it on this page , it makes more sense in context.) That is just too great for words, I will keep quoting that "law" every time the subject comes up. I have to read that story , even though I'm not a fan of Marvel stuff. (Plus, the main character has a Romanian name. Yay :P)

Too many people

Overcrowding is a common fear these days, just like global warming and other similar crap. I just thought I'd save here a quick calculation to put things in perspective. Living area for a single person: 100 m^2 (this would make it 400 m^2 for a 4-people family) Number of people you can fit in a km^2: 10,000 (because 1 km^2 = 1 million m^2) Land area of the Earth: 148 million km^2 (see Wikipedia ) Say only a fifth of that area is available for people, that would be 30 million km^2. Multiplied by 10,000 this gives us 300 billion people. 300 billion people. With no many-stories buildings, no overcrowding a la Asimov's fiction (how on Earth could he estimate only 40 billion people for Trantor I cannot imagine) and no food problems ('cause we have four fifths of the land area for that - in fact, even if we remove 30% of the total area as desert it still leaves us with 70 million km^2 for animals and crops). One other thing - what the overcrowding gang never mention is this: on...

Human DNA

Is the probability of obtaining a DNA sequence which codes for a human (ie, a living being capable of interbreeding with humans) by any combination of random processes and deterministic functions (like natural selection) less than 10^-150? Let's assume we already have the humans' alleged ancestor race, call it apes. Is it possible for random mutations to change an ape DNA into a human DNA? Let S = {A, C, G, T} the possible values for a codon, and S* a sequence s[1] ... s[n] where s[i] is in S . We define dist* (a, b) with a, b in S* = the number of point mutations needed to change a into b (or viceversa): dist* (a[1] ... a[n], b[1] ... b[m]) = sum (i = 1, n, dist (a[i], b[i])) + m - n , with m >= n >= 1 dist (a, b) = {0 if a = b, 1 otherwise} , with a, b in S In other words, if everything works out perfectly, it takes at least dist* (A, B) point mutations to convert one into the other, where A is a member of the ape DNA set, and B is a member of the human DNA set. How cl...

Clarification

For me, the idea of a string having a probability is absurd - I can't parse it at all. Let me clarify this with an example: what is the probability of a chair? Both a chair and a string are objects. Ok, the string is an informational entity, not a physical object. What is the probability of an equation? Neither of these questions make any sense. Now, if we want it to make sense, we must start to expand the question. What is the probability that a 500-bit string will occur? Still not good enough - out of thin air? In my daily emails? So let's try again: what is the probability of a 500-bit string occuring in the following experiment: "write down 500 bits"? Well, 1 if you do it, 0 if you don't. In NO case is it going to be any other value. How do you fill the blanks so that "what is the probability of a 500-bit string ..." gives you any other result? Please email me if you found a way.

Information

Let's define I(E) = -log2 P(E), where E is an event. This is the amount of information contained in (imparted by) that event, or in other words the amount of uncertainty removed by that event, and is measured in bits. (Why uncertainty? Let {E*} be the set of possible relevant events, of which E is a member. Before E, any of the {E*} elements could have occured; the fact that we obtained E decreased that uncertainty. P(E) is, of course, 1 / the number of elements in {E*}.) Using the value we determined earlier, the "cutoff value" of 10^-150, the information contained in an event E with that probability is -log2 10^-150, which is 500 bits. Therefore, another way of specifying the "point of no return" is this: anything with an informational content larger than 500 bits could not have occured without the intervention of an intelligence . What are possible sources for this information? Well, as far as I know (please let me know if you find another one), only 3 exist...
Statistics I met this gem on the TrueOrigin list: I asked her to pick a digit (0 through 9). Then do it again, and again, 53 times. You will have picked a number with 53 digits. The apriori probability that you would have picked that number is 1 chance in 10^53, but you did the impossible. Is it true that the chance of doing what is described above is indeed very small (10^-53)? Let's see. In my country, we have a lottery called "6 out of 49". You have a 7x7 grid, with numbers from 1 to 49, out of which you are supposed to pick the winning six. Let's say you bought a ticket and picked 6 numbers at random. What is the chance of winning the lottery? Well, the total number of combinations is C(49, 6), which is 49! / (6! x (49 - 6)!), where "n!" (read: n factorial ) means "1 x 2 x 3 x ... x n". Calculating it gives us 13,983,816 possibilities (if I made a mistake, please let me know). So, the probability of picking the right combination is approximat...