More Probability – HTH vs. HTT

Ξ May 8th, 2009 | → 3 Comments | ∇ Maths, Oxford |

Imagine tossing a fair coin successively, and waiting until the first time a particular pattern appears; say HTT. For example, if the sequence of tosses was HHTHHTHHTTHHTTTHTH, the pattern HTT would first appear after the 10th toss.

Ok, now let’s take two such patterns – HTT and HTH.  Given both these sequences, and a lot of trials [where you conduct this, "it first appears when" experiment, and then average the number of tosses], is it more likely that you’ll:

  • hit HTT in less tosses than HTH;
  • hit HTH in less tosses than HTT;
  • find that the number of tosses is the same?

Most people [many mathematicians amongst them] will pick the third option.  Surely, any such pattern is equally likely to show up in some yet to be discovered average number of tosses!

Actually, it’s not the case – that they’re equally likely. In reality the average number of tosses required to see HTH is 10, whilst for HTT it’s 8! How can that be???

Let’s see why.

Note that HTH overlaps itself, i.e., if you got HTHTH you’ll find that you’ve got two occurrences of the pattern in only five tosses, i.e., HTHTH and HTHTH. Ah, so doesn’t this sound like HTH is more likely then, rather than the other way around?

Well, with HTT there isn’t such an overlap – and it turns out – perhaps unintuitively – that that’s important; in a way that leads to HTH‘s downfall. So, let’s run a couple of experiments to see how this works.

Let’s go looking for HTH

Best scenario:

Toss Result Comment
H 1st token in our pattern excellent start!
T 2nd token quite excited!
H 3rd token We won!


Second best scenario:

Toss Result Comment
H 1st token in our pattern excellent start!
T 2nd token quite excited!
T Bugger!


Now we’ll need to continue tossing the coin until we see an H; as that’s the first token in our sought-after sequenc



Now let’s go looking for HTT

Best scenario:

Toss Result Comment
H 1st token in our pattern excellent start!
T 2nd token quite excited!
T 3rd token We won!


Second best scenario:

Toss Result Comment
H 1st token in our pattern excellent start!
T 2nd token quite excited!
H/H Bugger!


However, and this is the important bit, at this stage we don’t need to toss the coin again in order to get to find our starting token – we just threw it – an H!



If you doubt any of this, here’s a little simulator I wrote [CoinToss.zip contains CoinToss.exe].

 

21 – Blackjack Movie

Ξ May 6th, 2009 | → 1 Comments | ∇ Books, Geeky, Maths, Oxford |

Watched 21 last night – not a bad film, in fact, regarding entertainment vs. cost value [it ran us just £3 from Matalan!] it was rather good.

The film is based upon the MIT Blackjack team, and as I’ve read/and-seen quite a lot about them before, I was quite happy to have the film thicken the plot [maybe that should be 'have one'?] – and there’s a nice twist or two at the end.  As to the film’s inspiration, you can’t do much better than watch the BBC Horizon documentary on this:

Making Millions the Easy Way

I wish ‘Oxford types’ would get up to stuff like this [of course, they might do (would they tell their lecturers?)]; it’d be so much more fun!

Probability

I was quite pleased to see some probability stuff in the film being partially explained, i.e., their running through the Monty Hall problem [although the implied cleverness of the student here is a bit hard to swallow really].

Anyway, here’s the problem:

Suppose you’re on a game show, and you’re given the choice of three doors:  Behind one door is a car; behind the other two, goats.  You pick a door, say number 1, and the host, who knows what’s behind all of the doors, always opens another door – to reveal a goat – let’s say that’s door number 3.  He then says to you, “Do you want to swap?”, i.e., swap your initial choice of door number 1, and change to door number 2?   The crux being – is it to your advantage to swap?

In the film, the problem is presented in this clip.  By the way, the answer is in this too, so if you want to think about it, get ready to hit the pause button at the 44s mark!

The explanation I find that works quite well here [and I've had my Oxford stats students scratching their heads over this problem initially (as do most people I believe)] is:

Given this scenario: when you pick a door, you’re more likely to pick a goat-door than sole car-door, i.e., you’ve a probability of .66 [or 66% chance if you prefer] of picking one of the two goat-doors vs. the only car-door.  Hopefully, that’s obvious.

So, if chance [substitute luck of the draw/fate/the odds/divine-intervention ...] did the right thing here, and you picked a goat-door, you know with a decent probability that the car is behind one of the two remaining doors – but which one?  Now, when the host reveals another goat behind one of the two remaining doors, the car’s obviously [again, if the odds etc worked for your initial pick] behind the other door!

Basically, it comes down to this: if you picked a goat-door initially [which you will 66% of the time], by swapping later, you’ll always win the car.  Conversely, and given once again that you initially picked a goat-door, if you don’t swap, you’ll lose 66% of the time.  Or, one other way … by swapping, you’ll only lose if you picked the sole car-door as your first pick [which you're likely not to have done].

Update:  Just found a nice little simulator of this [Internet Explorer only] at http://www.grand-illusions.com/simulator/montysim.htm

 

BAD – VERY BAD Maths

Ξ January 19th, 2009 | → 0 Comments | ∇ Maths |

Nice idea, but

Just watch and HIT the play button too [unless you like static images, this last hint is just for you]!

It’s a nice animation, but, in particular, watch the orange spot. And, ask youself:

A) is it possible?

B) if ‘yes’, in what universe do you live [provide examples]?

If in doubt, maybe Gamow’s Biography of Physics is a a decent place to start [for me, a perfect Chistmas present]?

 

Dasher

Ξ January 3rd, 2009 | → 0 Comments | ∇ Coding, Geeky, Maths, Mumble, Oxford, Programming, Research, Technical |

Bloody hell!

Just been watching the Royal Institution’s Christmas Lectures and saw a demonstration of a tool called Dasher.

Very cool, but a bit of a kick in the nuts, and a wake-up call for me really. The reason? Well, I had a system doing more or less the exact same thing in 2000 [it was better than what was demonstrated too]! I even showed it off to various Computational Linguistics folk at Oxford [who said "nice, but" ... [who'd use it|so what|it runs on Windows!|you've got too much spare time on your hands|etc]].

Crap!

 

Very Sad

Ξ September 16th, 2008 | → 0 Comments | ∇ Books, Maths |

I learned yesterday about David Foster Wallace‘s [apparent] suicide.

There’s also the strange coincidence though – last night, I needed a new book, so I turned to my ‘to be read’ pile and at the top was ‘everything and more: a compact history of infinity‘.  It wasn’t until I was about to put it down, and spotted that the author had also written ‘Infinite Jest‘ that it hit me.

 

Britain From Above

Ξ August 6th, 2008 | → 2 Comments | ∇ Coding, Geeky, Maths, Oxford, Programming, Research |

A new series, Britain from Above starts on the BBC one this Sunday at 9.00pm.

In the main, GPS data is used to reveal traffic-information; on the sea [through the Dover straits], in the air, and even by London cab-drivers.  The GPS data are overlaid, and visualised against a backdrop of the country.  Additionally, there’s an interesting bit showing how the telephone system lights up during a working day.

A taster clip on the programme is here.

Going back to taxies, it reminded me of a piece of game-theory software I once wrote for a professor of economics here at Oxford.   He had too many variables for which he/we needed to find some sensible constraints/limits for, or, better still, turn into constants!  The game was about n cab-driver’s choice of strategies, as they drove around Belfast … such that they weren’t A) robbed [of their cash] B) robbed [of their cash *and* their taxi] C) shot,  killed, i.e., robbed of their cash *and* their taxi *and* their life]  You get the idea.  The game-theory bit worked alongside a social sciences experiment examining moreorless the same thing [except that their experimenters had to be in Ireland].

Anyway, watching the clip, I couldn’t help but be reminded of that system, as it played itself on our cluster many 1000s of times a second, in either role; the cab-driver or the robber [and later the police], and in how it might suddenly switch into some very complex behaviour; perhaps as a result of a robbery, generated randomly by the system.  Oh, fun times indeed!

 

Things I Should Have Patented?

Ξ June 20th, 2008 | → 0 Comments | ∇ Books, Coding, Geeky, Maths, Microsoft, Software, Technical |

It’s on another page on peetm.com, but as I’ve been asked where it was lately, I’ll just link to it here.

 

Infinity & Brian Clegg

Ξ February 14th, 2008 | → 0 Comments | ∇ Books, Geeky, Maths, Oxford |

Went to see Brian Clegg give a talk on Infinity – based on his book, hosted by Cafe Scientifique, and sponsored by Blackwell’s bookshop.

After hearing Brian, I don’t feel so bad about often misspelling his name as ‘Brain’ – Brain Clegg sounds about right!

I also felt rather envious: how rewarding it must be; being able to research a subject one feels so taken by, have it published, and then enjoy speaking on it once in a while!

Brian - aboutto get heavy!

In the picture above Brian is about to get a bit heavy for some of the audience [judging by the majority of the questions asked in the Q&A]. He’s previously gone from potential-infinities [] and just got to Cantor‘s countable (concrete) infinites [], and is moving into the rather beautiful proof that there are still larger ones (sans having Brian around for tea, here’s a nice walk-through for anyone interested).

 

The Inverse Square Law

Ξ January 24th, 2008 | → 0 Comments | ∇ Maths |

The Inverse Square Law says that (for example), if the distance between, say, the Earth, and a spacecraft were halved, then the force of gravity – attracting one to the other – would increase by a power of two : as the distance continues to halve, the attraction becomes ever more massive in other words – exponentially.

This law pops up in quite a few interesting places – like in the gravitational effect, the intensity of light (and of sound), and in electrostatic fields etc [albeit that in the latter likes repel].

However, I’ve discovered another example – which may even be an example of an inverse cube law … namely, the effect you experience when you’re away from home – yet traveling there – and you need to go to the toilet!

There you are …

# 20 miles from home, and you know you want to go, but you’re fine; although you wonder why you didn’t, um, ‘go’ before you left.

# 10 miles to run – pretty much the same kind of feeling – still wondering whether it would have been wiser to have ‘done the business’ before you departed.

# 5 miles to run – getting just a little bit more aware of your bowels now!

# Hitting the town limits – you start feeling a bit more uncomfortable, but, at the same time, you feel like you could hold on for quite a lot longer – if required to!!

# Turning into the street – you start whistling, and wriggling your legs to and fro: beads of sweat suddenly appear on your forehead for no apparent reason, and, all of a sudden, you wonder why your partner is driving so damn slow!!!

# Trying to unlock the front door as efficiently/smoothly as possible (which never works – you know this – but, nonetheless, you still try it!) – getting pretty desperate (thinks – ‘am I going to crap myself?’)!!!!!

# Slapping on the lights as you run through the darkness to the toilet – you’re really doubting that you’ll be able to hold out until you drop your pants – still, as you run, and in preparation, you fight with your belt buckle!!!!!!!

# In the toilet (at last!), your guts are making groaning sounds (sod closing the door, sod turning on the light, sod being embarrassed about what your partner will think about the noise and smell that’s going to be oh so obvious in a second’s time.

# The forces acting between your arse, and the ‘lavatorial event horizon’, feel like they’ve reached infinity, and you nearly crap yourself as you try, in one fluid move, to drop your pants, lift the seat, and ‘release’ your clenched, aching buttocks (interestingly, so much is the attraction of one for the other that, if you’re skilled, this all happens before your arse actually ‘touches down’)!!!!!!!

2 seconds elapse …

# You thank God, swear never to be bad again, and you ponder: whether the sensation you’ve just experienced was better than an orgasm?

 

Poker

Ξ October 10th, 2007 | → 0 Comments | ∇ Friends, Maths |

So tonight [yesterday?] I won both ‘rounds’ of Poker in the PokerProject league – hosted by The Fiery Angel in Cheltenham.

I’ve won a round before – twice I think – but never won both rounds before – and it feels rather good [esp. as I was way down on chips going into the final with Steve (the only name I know him by)]

I paced myself – and it paid off. I don’t think I’m a good poker player, but I do think I have a certain intrinsic way of weighing the probability of a given hand – and, when that says ‘fold’ of not always going with it!

Steve should have won the second round tonight [we came first and second in the first hand – me first!], and he had such a huge chip advantage over me during most of the second round too. However, as he himself told me over a fag, he plays – or is prone to be – conservative … read: “I think this hand could win, so I’ll play it”.

Ok, and that’s all well and good when there are more than two people playing – but when one is ‘heads up’, well, it’s a weakness. Don’t get me wrong – I never thought I’d win the second round at all – and, I actually, truly wanted Steve to win – but I wasn’t going to just ‘roll over’ – although I did offer him a ‘let’s go all-in blind’ at one point … something I think he should have gone for.

So many of the poker players want to win – whereas I want to A) enjoy myself, and B) as long as ‘A’ happens or no, I don’t give a flying fuck about whether or not I win – I honestly don’t. So anyway. Steve was pleased with coming 2nd/2nd, and of course, I was happy coming 1st/1st – now I’ve done that – where does one go? I think it’s ‘bluffs-ville for me!’ from now on … or playing for real money [which I’d be carp at!]  As good as a fish in other words!

 

  • Groupings

  • Old Stuff

  • Blog Roll


    Top BBC Tech News Items