Thursday, May 24, 2012

It seemed dreadful to see the great beast Lying there, powerless to move and yet powerless to die, and not even to be able to finish him. I sent back for my small rifle and poured shot after shot into his heart and down his throat. They seemed to make no impression.

I read Orwell's essay ages ago and figured it pretty much had the elephant execution story covered. Looking back I was amazingly naive about quite how many bizarre possibilities for dispatching pachyderms existed.

2. Electrocution. In order to show that his DC current was a great idea Edison decided to show AC was really dangerous. So he got Topsy the elephant and electrocuted her. Which is a massively dick move anyway you cut it. He also invented and sold the electric chair to execute criminals as a similar negative publicity campaign against AC current. The video he produced is here

3. Shooting. Tyke (elephant)
Police fired 86 shots at Tyke, who eventually collapsed from the wounds onto a blue car and died. This video is of Tyke's attack and later shooting. I am not going to embed it as it is frankly horrifying.

4. Harpooning. Chunee "Kneeling down to the command of his trusted keeper, Chunee was hit by 152 musket balls, but refused to die. Chunee was finished off by a keeper with a harpoon or sword". Having to harpoon an elephant has to be the definition of a hard day at work.

7. Drowning (ish). Dan Rice was a sort of PT Barnum character. He ran loads of stunts to advertise his various travelling circus events. One of these for one poor elephant was "In August 1860, Rice had Lallah Rookh swim across the Ohio River in Cincinnati, Ohio to drum up publicity for his new "Monster Show." It took her 45 minutes to swim across the river. A month later, Lallah died of a fever brought about by her swim".

And the weirdest one, and I realise that is saying something, is not an execution of elephants but by elephants. Most of the elephants killed listed above had killed a person. But elephants were once a really common. Apparently death by Nelly was wildly popular from prehistoric times up until the late 1800s. Execution by elephant is an incredible wikipedia page, hard to extract from but worth reading through.

Because elephants are so easy to train and because an elephant standing on your head was such a gruesome way to die most south Asian countries seemed to practice it.

I do not know what the wide an varied history of death of and by elephant tells us. They are all pretty tragic tales. Recently an elephant escaped in Cork . Then later crushed one of the circus workers. It seems the same sort of issues that killed Chunee, Mary, Tyke and many people who have been killed by performing elephants still exist and that more than these historic stories is a tragedy.

Wednesday, May 23, 2012

Punk Rock Operations Research has recently been talking about the birthday problem. This problem asks how many people have to be in a room for you to have a 50% chance of two of them sharing a birthday. The usual answer is 23 people.

Also a file with equal numbers of birth each day here
This code is to calculate the average number of people you need to add to a set for two to share a birthday. Which is slightly different from the original birthday problem. Knuth studied this variant and came up with a figure of 24.616 people assuming 365 days in a year.

#!/usr/bin/env ruby -w
puts 'Birthday simulation'
#binary search function I stole
def binarySearch(sortedArray, first, last, key)
until first > last do
mid = (first + last)/2
if (key > sortedArray[mid])
first = mid + 1;
binarySearch(sortedArray, first, last, key)
elsif (key < sortedArray[mid])
last = mid - 1;
binarySearch(sortedArray, first, last, key)
else
return mid;
end
end
return first;
end
#binarySearch Test
#sorted_array = [1, 5, 6, 10, 5, 25, 40, 78, 100, 130]
#p binarySearch(sorted_array, 0, sorted_array.length-1, 1)
total=0;
matches= Array.new; #array holding how many people so far have this
found= Array.new; #have we seen this day before
tried=0; #how many people had to be tried
i=0;
#First load an array with numbers that correspond to days. Day 0 is 1482 people, day 1 1482 upto 1482+1213 etc
#for the real dataset
File.open('bday.txt', 'r') do |f1|
# and with the everyone born randomly
#File.open('normal', 'r') do |f1|
while line = f1.gets
parts=line.split;#get the second number part of the line
total=total+parts[1].to_i;
matches[i]=total;
i+=1;
end
end
puts total; #sum up all the values
j=0;
matchFound=0;
totalDays=0;
while j<10000#00
where= binarySearch(matches, 0, matches.length-1, rand(total));
tried=tried+1;
if found[where] ==1
totalDays=totalDays+tried;
tried=0;
found.delete(1);#empty the array for another simulation run
matchFound=matchFound+1;
else
found[where]=1
end
j+=1;
end
ans=(totalDays.to_f/matchFound.to_f)
puts "average birthday number ", ans;

This code with the same number born every day gives a birthday number of
24.0194321675634. And with the real bday.txt dataset from Roy Murphy gets the result of 23.9779163169884.

This code needs a complete rewrite. This code is fugly and wrong. I tried writing this piece a few years ago and failed so I'm just glad to get it out the door. Also I have to make allowances for the dataset size and the number of simulations run.

Other problems with the birthday problem revolve around getting a random sampling of people. About 1 in 80 births are of twins. So an average of one in every 40 people is a twin and twins tend to hang out together.

This dataset comes from life insurance forms. Which could be biased in that Jan 1st seems to be too popular. It could be what a form defaults to. Maybe life insurance selects for people born at a certain time. It could be that rich people buy life insurance more and rich people are more often born in a particular month.
Professions seem to clump around certain birth dates. Malcolm Gladwell points out in Outliers that professional athletes tend to have birthdates that make them old when they play under 8,9,10 and 11's sports. Kary Mullis in "dancing naked in the mind field" professes his support for astrology saying “A recent scientific study of the distribution of medical students in birth months discovered that a lot of medical students were born in late June”. If this is right then some other professional groups clump in age.

Mullis is an interesting person, and his book is very entertaining. By the time he describes his meeting with an extra terrestrial glowing raccoon you know he is nuttier than squirrel shit. Partly it is this oddness that helped him win the Nobel prize brilliant "What if I had not taken LSD ever; would I have still invented PCR?" He replied, "I don't know. I doubt it. I seriously doubt it.". PCR is used to amplify DNA fragments and is a major tool in convicting rapists, murderers and other criminals.