Thursday, December 10, 2009

Dublin pubs and the El Farol Bar problem

I was in town last night and i noticed how empty the superpubs were. these are the giant warehouse like pubs that need to be packed all the time to pay for the giant rents they have.

They also need to be full to make it look like they are not just giant warehouses. This is a version of the El Farol Bar problem. The game theory is this

* If less than X% of the population go to the bar, It will be too empty and they'll all have a worse time than if they stayed at home.
* If more than X% of the population go to the bar, they'll all have a better time than if they stayed at home.

People realise the pubs will be empty so no one goes. It is a positive feedback problem. Which means these big pubs are in big trouble.

Monday, November 30, 2009

Human Nutrient Needs

What nutrients does a person need per day?
I am not a dietician or indeed sober so don't take this as actual advice. But what does ten minutes googling give as a list of the needed nutrients?
This is item 1 of the list of things to do for a modern version of Stigler's diet. Wikipedia the universal source of all truth (TM) italic has an article on this here.

It gives the RDA for an average 25-year old male (for ones that use IU which appears to be nonsense so I have taken some figures from here and here)
all figures are in µg

param RDA:=
Vitamin_A 900
Vitamin_C 90000
Vitamin_D 5
Vitamin_K 120
Vitamin_B6 1300
Vitamin_E 15000
Biotin 30
Calcium 1000000
Chloride 2300000
Chromium 35
Choline 550000
Copper 900
Cyanocobalamin 2.4
Fluoride 4000
Folate 400
Iodine 150
Iron 8000
Magsium 400000
Mangase 2300
Molybdenum 45
Niacin 16000
Nickel 1000
Pantothenic_acid 5000
Phosphorus 700000
Potassium 4700000
Riboflavin 1300
Selenium 55
Sodium 1500000
Thiamin 1200
Zinc 11000
;

And the upper limit as

param UL:=
Vitamin_A 3000
Vitamin_C 2000000
Vitamin_D 50
Vitamin_B6 100000
Vitamin_E 1000000
Boron 20000
Calcium 2500000
Chloride 3600000
Choline 3500000
Copper 10000
Fluoride 10000
Folate 1000
Iodine 1100
Iron 45000
Magsium 350000
Mangase 11000
Molybdenum 2000
Niacin 35000
Nickel 1000
Phosphorus 4000000
Selenium 400
Sodium 2300000
Zinc 40000
;

The figures we are interested in are RDA's which must be met and Tolerable upper intake levels which cannot be exceded.
Macro nutrients are in grams

param Macro:
Waterb 3700
Carbohydrates 130
Proteinc 56
Fiber 38
Linoleic 17
alpha-Linolenic 1.6
end;

Also some nutrients must be minimised Cholesterol, Trans fatty acids, Saturated fatty acids. These will have to be aims of a optimiser for diets.
These are a bit more difficult to deal with so I will ignore them for the moment.
Cholesterol As low as possible
Trans fatty acids As low as possible
Saturated fatty acids As low as possible

Also two types of macro nutrients must be a % of calories.
Added sugar No more than 25% of calories
Fat 20–35% of calories

I am going to guess a 25 year old male needs 2500 calories until I am corrected.
So we have a first approximation of what nutrients people need.

So next up is getting a price and nutrient contents for loads of different foods.

Sunday, November 29, 2009

The Diet Problem

What is the cheapest way to feed yourself? This is not a minor issue our diets and health could be much better if they were optimised to provide the most needed nutrients at the smallest cost and also to provide the most palatable diet that is as healthy as possible.

Stigler in 1939 worked out a near optimal miminum price needed to supply a person with the nutrients they need for a year. The diet consists of five not very pleasant foods so is not intended to be realistic dietry advice.

Still given current knowledge of nutrition a list of prices from various supermarkets could you optimise you shopping basket to provide your family with groceries? Here we want to give people the nutrients they need in a form they will actually eat that is healthy and cheap.

We need a list of
1. What nutrients are needed by a person
2. Foods preferences of people.
3. A price list of foods
4. A Linear program to optimize a shopping basket based on these variables.

All of these requirements need some explanation. I think its best if each gets it's own post. So tomorrow I will have a post on what quantities of nutrients people require. If you have any suggestions please comment.

Sunday, November 15, 2009

215 is the first Wikipedia dull number

I have always wanted my own constant and now for a short period I have one. Imagine numbers were 'interesting' or 'dull'. The first dull number would be interesting because it was the first dull number so no dull number can exist. So all number are interesting.
Now you would think any interesting number would be notable enough to have its own wikipedia page. The first number without a wikipedia page is 215. This should be notable enough to deserve a wikipedia page. So as long as 215 has no wikipedia page it is dull and thus as the first non notable number it is notable. The paradoxes of wikipedia notability were brought up here.

Sunday, November 08, 2009

Counting money across cultures

One great bit in the execrable Inglorious Basterds was where someone noticed that Germans and British people make the sign for three in different ways. I love these cultural comparisons that show how arbitrary much of what we do is. I looked at information from laces here

This is a video showing how money is counted in different countries.


How People Count Cash? - Click here for more free videos

I have heard Japanese people ring out clothes differently to the rest of the world but can find no evidence of this in spite of asking a few of them. Do you know of any other cultural differences?

Thursday, October 29, 2009

Matchbox Maths Games

There is a great article here on Matches on India. No really read it.
In fact, 97% of rural households purchase matches on a monthly basis. Matches are a unique product because of their high, constant demand and low price point.Their ubiquitous presence provides fascinating insights into India's rural distribution networks, and offer potential ways to inform and interact with India's relatively untouched market.

The article then suggests using the matchboxes to spread public health messages
What if that space was used to relay information? Imagine the possibilities of spreading new health/educational information or advertising to 97% of rural families on a monthly basis. Simple pictorial designs would pique interest and accommodate India's vast differences in literacy rates and languages. Awareness of important topics such as the installation of chimneys to reduce smoke inhalation or cleaning and covering water containers to prevent stomach ailments could be spread to households across India, and potentially save lives

I would recommend selling the glamor of flushing toilets and chimneys and such rather than nagging in your images. But i do not know enough about rural Indians and their diseases to advise on what health images to provide them. There are some interesting studies on what does kill these people here.

However what if all you put on the boxes was games? Many people have a ludic philosophy of life. You see a love of games in maths nerds in particular. This love of games I believe adds a cognitive richness that aids intellectual development.

There is a great book called "everything bad is good for you". That claims the increase in IQ in recent decades is due to increased complexity in our culture. I have not studied the Flynn effect enough to be sure it is not caused by nutrition or even to be sure it is important. But I will assume it is and that intellectual challenges improve general cognitive abilities. I will go further out on a limb and claim that such improvements in cognitive abilities would aid rural Indians. Never having been a rural Indian this really is a big assumption.

So what intellectual challenges could fit on a matchbox and be read by an illiterate farmer? How about puzzles and games?

There are some face meltingly brilliant match puzzles here(pdf). Other then puzzles there are games like NIM, dots and boxes, chomp and loads of others you can play with matches. I would imagine if a brand of matches has a game on it that keeps the kids from bothering you this would be a popular feature.

So can you think of some way to explain a puzzle or the rules of a game on a matchbox without using text? Do you think it really could be useful to put mathematical games and puzzles on matchboxes?

Wednesday, October 28, 2009

A work sceduling problem

I saw this problem recently
A city authority is considering placing a toll booth on its new bridge. The beginning
times for the shifts are 8am, noon, 4pm, 8pm, midnight and 4am. A collector
beginning a shift at one of the above times works for the next 8 hours.
The following staffing levels during each of the 24-hour periods have been estimated

Hour.................... Minimum Collectors Needed
8am - Noon.............. . 5
Noon – 4pm ................6
4pm – 8pm .................10
8pm - Midnight........... .7
Midnight – 4am ...........4
4am – 8am .................6

Find the minimum number of collectors that need to be hired to begin the 8 hour shifts
at each of the six times.


A GLPK program to calculate this is

var x1 >= 0, integer;
var x2 >= 0, integer;
var x3 >= 0, integer;
var x4 >= 0, integer;
var x5 >= 0, integer;
var x6 >= 0, integer;
/* objective function */
minimize z: x1+x2+x3+x4+x5+x6;

/* Constraints */
s.t. ctr1:x1 + x6 >= 5;
s.t. ctr2:x1+x2>= 6;
s.t. ctr3:x2+x3>= 10;
s.t. ctr4:x3+x4>= 7;
s.t. ctr5:x4+x5>= 4;
s.t. ctr6:x5+x6>= 6;
data;
end;

The answer is 19 and no one starts working at 8am.
This is a simplified version of the program described here. Not a major revelation or anything but always find these puzzle solving programs cool.

Sunday, October 18, 2009

Prediction with game theory

I am going to this talk on Thursday so I am reading the book Predictioneer by Bruce Bueno De Mesquita. He has a ted talk video on his prediction ideas.


The use of game theory in forecasting seems based on the axiom that people are rational. The problem is they are not, here is a list of the different ways they are not. If you know how they are going to be irrational you can alter your models to take this into account. However if you fail to do this you will end up with less accurate models.

In chapter 2 the book claims people are rational and particularly that we are transitive in our preferences. "to be rational.. their preferences must not go in circles. For instance if I like chocolate ice cream better then vanilla and vanilla better then strawberry i presumably like chocolate ice cream better than strawberry." So no rock paper scissors can exist in human preferences.

The problem is they do. There is loads of evidence that people can have intransitive preferences. For example May showed in 1952 that people can have intransitive preferences for wealth, looks and intelligence in a partner. So how can you have a mathematical system modeling the world where one of your axioms is false?

While on the subject of intransitive never play dice with Warren Buffet. There are loads of stories of how he tries to con people with a set of intransitive dice. Edward Thorpe for example. Or Bill Gates as described in Bill Gates Speaks: Insight from the World's Greatest Entrepreneur By Janet Lowe

Buffet once attempted to win a game of dice with Bill Gates using intransitive dice. "Buffet suggested each would choose one dice and discard the other two. They would bet on who would roll the highest number most often. Buffet offered to let Gates pick first. This suggestion instantly aroused Gates curiosity. He asked to examine the dice after which he demanded buffet choose first."

Friday, October 16, 2009

Boy in Balloon, did the balloon have enough lift?

I love this story, it reminds me of the time myself and my dad nearly burned down the house. We made a tinfoil hot air balloon with a gas camping cooker to power it. The cooker was tipped onto the lino and the melting began. It was my mums fault for leaving us alone in the house together. In general I love these homemade balloon stories, like Larry Walters across California.

Could we have told in advance it was a haox? "Few had raised the issue of whether such a balloon could even lift off with a 50-pound kid inside, and then float the way it did"

So how big was the balloon? "Authorities said the silver balloon, 20-feet long and 5-feet high, at times reached 7,000 feet above the ground while adrift. It was found more than 90 minutes later in a field near Colorado Springs."


Then it would have a diameter of 6 meters and a height of 1.5m high. Taking the balloon as a cylinder then according to here would give it a volume of 42.5 cubic meters.



Gross Lift (Helium) = Volume (cubic meters)*1.05kg
So 42.5 * 1.05=44.625 kg lift.

Now that seems just within the bounds of possibility as the kid weights about 20 kilos and the balloon itself should be light. But could the balloon have gotten to a height of 2000 meters? There are all sorts of tables for these I might work it out later

Another site gives "Helium provides about 9.8 newtons of lift per cubic meter, at sea level and room temperature. That's enough to lift 1kg". So 20 kilos would require 20 meters squared to lift it. Same result as before.

Thanks to the best program on Television we know how many balloons it takes to lift a small child.
"It would require such a large number of balloons (3,500) to lift an average four-year-old girl of 44 pounds (20 kg) just a few feet off the ground that there is no way the myth could have happened unintentionally."

Update: Wired have an article here about how people should have realised the balloon was empty. Their estimation of the carrying capacity of the balloon is similar to mine. they point out that the balloon does not move like it has a heavy weight hanging from the bottom of it.

Wednesday, September 16, 2009

NAMA, how much is 54 billion euro?

Nama, the Irish governemts agency to take on bad loans, is paying 54 billion euro to buy property. How much money is that? There is a great visualisation here about how much is a trillion.

So lets picture Croke Park. Its pitch is 144.5 m x 88m. That is much bigger then a soccer or rugby pitch. A 20 euro note is 133 × 72 milimiters. So to pave Croke Park pitch with 20 euro notes requires. So that is 1087 notes long 1223 wide or 1,329,401 notes are needed to pave croke park pitch in 20 euro notes. So that is roughly 2 layers of 20 euro notes being 54 million and paving it two notes deep. A billion is a thousand million so 54 billion is 1000 times this. So 54 billion is paving Croke Park in 20 euro notes 2000 deep.

So if your looking at the game on Sunday imagine there is a 20,000 euro pile of cash on the pitch that you now owe. That is 54 billion divided among the people who pay tax. So you and the person sitting next to you owe a 2000 deep 20 euro sized chunk of the Croke Park pitch.

A comment vaguely asked how much euro coin is this? "Did you know its also enough Euros placed end to end to reach the moon". According to here a 2 euro coin has
Thickness (mm): 2.20
Weight (g): 8.50

So 27 billion 2 euro coins are needed. So in weight that is 229.5 million kilos.
"The maximum gross mass for a 20 ft (6.1 m) dry cargo container is 30,480 kg" so that is 7540 containers full of 2 euro coins.

How long would the stack be? 2.2 * 27 billion millimeters = 59 400 kilometers. Or enough to go around the earth one and a half times. But less than a fifth the distance to the moon.

Tuesday, September 15, 2009

Ask the waiter

If you want to know what someone is like ask their waiter. Because as a waiter you are far down the social rung anyone who is just a poseur treats you like dirt. Keith Floyd who died yesterday used to come into an Indian restaurant I worked in. He was much quieter then his media image and a complete gent. As was Liam Neeson BTW. I am not claiming to have known him just that he always treated the waiters well, which I believe is a good sign about someone.

Belinda Carlisle owes me a set of cutlery, she may think I have forgotten but I haven't. She promised she would bring them back and didn't. Try saying "if you cannot trust the singer of the Go-Go's, who can you trust?" to a middle aged Bangladeshi and see if your wages don't get docked.

Apart from an unfortunately forgetful singer I have a long list of who is a complete wanker. I'll post that again.

Wednesday, September 09, 2009

Prediction Market In Adwords?

Can we predict how much an adword word will cost in the future? I find prediction markets fascinating but have not talked about them for a while. Here is an interesting game for predicting the popularity of words.

If this prediction market can accurately predict what words people will in the future find interesting and will discuss then you could buy up these adwords in advance and watch their market value (well cost in google) rise. So anyone want to buy a futures contract in the word "Cromulent"?

Wednesday, September 02, 2009

Fair division in googledocs using Ruby

I figured out how to access google docs spreadsheets using Ruby's roo library.

So for the spreadsheet
https://spreadsheets.google.co/ccc?key=0AifEYKk1FmScdDUwcTE1c2c4aFF6Wl93cENkWVF1Smc&hl=en
#you can create a object for this document by
        
oo=Google.new("0AoBJp9mMcWUrdDZUY1diRm5KOTd4ZWtKWUpib2V3ZHc"
,user="stuffsplitter",password="thepassword")

where user and password are the username and its password for the account that has the document. 0AoBJp9mMcWUrdDZUY1diRm5KOTd4ZWtKWUpib2V3ZHc is the key
no http, no google.com, no key= and no &hl=en at the end. Good thing I am not an idiot who would take hours to figure this last one out...

Then this data is sent off to the GLPK program described ad nauseum previously.
Then using ruby's standard regular expression methods the solution file fair.sol can be easily parsed. This can be easily written to the googles doc using roo.

o2.default_sheet ='Sheet3'
#match fair.sol output file of glpk.
if line=~/^\s+\d+ y\[(\d+).(\d+)\]\s+\*\s+(\d+)/
# 2 x[1,1] * 0 0 1
if $3=='1'
o2.set_value(row, col, $1)
o2.set_value(row, col+1, $2)
o2.set_value(row, col+2, $3)


Next thing is to get a web interface for people to add their own fair division problems. There are some guides for doing that here and here. So automated processing is the next task.

By the way if you do have a fair division problem you can mail it to stuffsplitter[at]gmail.com and I will run the processing for you.

Sunday, August 30, 2009

Fair division using a spreadsheet and Ruby

It has taken me a month to get over the idea that someone expected this blog not to be the ranting of an inane balding drunk but actually good. Still it is time to get back to the drunken inane rambling.

There is no point having all these cool algorithms unless people can actually use them. So what is a good way to actually get the data into the program? We'll spreadsheets are used for this sort of thing all the time. Unfortunately I cannot figure out how to get openoffice, excel or gnumeric's solver to carry out this minimax fair division program.

Ruby has a cool library called roo for interacting with spreadsheets. So heres a program to get the data out of a spreadsheet and send it off to GLPK

require 'rubygems'
require 'roo'

#open office version
# oo = Openoffice.new("spreadsheetOO.ods")
# o2 = Openoffice.new("spreadsheetOO.ods")

#excell version
oo = Excel.new("spreadsheetOO.xls")
o2 = Excel.new("spreadsheetOO.xls")
oo.default_sheet = oo.sheets.first

o2.default_sheet ="Sheet2"
st="" #data being written toa file
div= o2.last_column


#start writing data to model file
st<< "data;\n"
st<< "param m := #{oo.last_row-1};\n"

st<< "param n := #{div};\n"
#the non divisible is whatever is left
st<< "param o := #{oo.last_column};\n"

st<< "param c :"
i=1
(oo.last_column).times{st<< "#{i} "
i=i+1}
st<< ":=\n"

# number of people
i=1

2.upto(oo.last_row) do |line|
st<< "#{i} "
1.upto(oo.last_column) do |col|
st<< "#{Integer oo.cell(line,col)} "#Integer

end
st<< "\n";
i=i+1
end
st<< ";\n"
st<< "param d :"
i=1
(o2.last_column).times{st<< "#{i} "
i=i+1}
i=1
st<< ":=\n"
2.upto(o2.last_row) do |line|
st<< "#{i} "
1.upto(o2.last_column) do |col|
st<<"#{Integer o2.cell(line,col)} "
end
st<< "\n";
i=i+1
end


st<< ";\nend;"

#write data to a file
File.open("data","w")do |file|
file.write(st)
end

#call glpk program on the data
system('./glpsol -m fair.mod -d data -o fair.sol');


The input spreadsheets are openoffice and excelin the first row is the list of items.
Every other row is each persons valuation for each item. The first sheet is the indivisible items and the second sheet are the divisible ones. Unfortunately roo does not allow you write to these spreadsheets so I cannot print out the answer to a spreadsheet.

The roo interface to the google docs spreadsheet does allow cells to be written to. So getting that version up and running is the next task.

Monday, July 06, 2009

Filling knapsacks with candies

This paper by Marco Dall’Aglio and Raffaele Mosca on using linear programming (and dynamic programming)
it gives two examples of dividing non divisible goods between two people. The paper uses hard candies as a metaphor for any indivisible item.

The valuations are not based out of 100% but just plain numerical values.

candy 1 2 3 4 5 6 7 8
Alice 12 18 50 40 20 20 10 5
Bob 5 10 35 30 15 22 30 28

Which as data for glpk looks like this

data;
param m := 2;
param n := 0;
param o := 8;

param d : :=
1
2
;
param c : 1 2 3 4 5 6 7 8 :=
1 12 18 50 40 20 20 10 5
2 5 10 35 30 15 22 30 28
;end;

the worst person got 102 of what they wanted

Person alice gets item number 1 3 and 4
Person bob gets item number 2 5 6 7 8
This is the same allocation as the paper come up with.

The next example given is

candy 1 2 3 4
Alice 32 28 22 18
Bob 25 25 25 25

which is the data file

data;
param m := 2;
param n := 0;
param o := 4;

param d : :=
1
2
;

param c : 1 2 3 4 :=
1 32 28 22 18
2 25 25 25 25
;end;

Alice gets item 1 and 2
Bob gets item 3,4
The worst performing person gets 50.

To use these data files with the fair divider for two people (the code of which is here)
./glpsol -m fair2.mod -d data -o fair.sol

As pointed out in the comments this isn't earth shaking or anything it just shows another use of fair division which can be used when items cannot be divided.

Monday, June 29, 2009

Fair Division of an estate

This page describes a fair division of an estate between 5 people. The process is described in the "method of Sealed Bids" section. It that requires each participant has money they can use to pay off the others. I think this is a fairly serious drawback as not everyone has loads of money. Also in the case of an estate division it seems slightly galling that the person with more money gets more things, possibly of only sentimental value, then others.

The division works by
"# Step 1. Bidding. Each player produces a sealed bid in which he or she attaches a dollar value to each item in S. A player's fair share is 1/N of his total assessment.

# Step 2. Allocation. Each item in S goes to the highest bidder for that item. If her/his assessed value of the items received exceeds her/his fair share, she/he must pay the difference. If the assessed value of the items received falls short of a fair share, then she/he is paid out of money that others have had to pay.

# Step 3. Dividing the Surplus There is almost always a surplus of cash that is divided equally among the players. "
given results in people getting

Al BMW, Saab, Miro
Ben House
Cal Cottage
Don Klee
Ed Yacht

And the minimum receive is $62,500 + $52,100+$18,340=132 940 out of a possible $679,000 or 19% of their desire.

If instead of assuming each player has money to buy stuff off the others I assumed each layer had equal claim to happiness. So I give each persons 100% desire is worth $679000 and those who claimed less then that use the remainder of their allocation as cash.

So this gives a table of desire of this

data;
param m := 5;
param n := 1;
param o := 7;

/* n divisible items, o non divisible items*/

/*Divorce between Donald and Ivana Trump described in Win-Win solution.
Items to be divided are
4 divisible items:cash
2 non divisible items: House cottage, bmw,saab,yacht,miro, klee
Item Al Ben Cal Don Ed
House 29.46 31.66 28.71 25.77 30.19
Cottage 8.84 7.22 9.2 8.76 8.1
BMW 4.27 3.6 3.68 4.06 4.06
Saab 3.68 2.8 3.33 3.6 2.87
Yacht 17.67 18.4 17.53 19 19.51
Miro 13.99 13.13 7.36 11.05 9.57
Klee 22.09 19.88 14.58 26.36 21.94
cash 0 3.31 15.61 1.4 3.76
*/

param d : 1 2 3 4 5 6 7 :=
1 29.46 8.84 4.27 3.68 17.67 13.99 22.09
2 31.66 7.22 3.6 2.8 18.4 13.13 19.88
3 28.71 9.2 3.68 3.33 17.53 7.36 14.58
4 25.77 8.76 4.06 3.6 19 11.05 26.36
5 30.19 8.1 4.06 2.87 19.51 9.57 21.94;

param c : 1 :=
1 0
2 3.31
3 15.61
4 1.4
5 3.76;

end;


Running this on the linear programming fair division calculator program(you need to add s.t. wor5{i in I}: ((sum{j in J} c[5,j] * x[5,j])+(sum{k in K} d[5,k] * y[5,k])) >= worst;). gives a the person who gets least 20.5388%

Al BMW Saab Miro
Ben House
Cal 0.726381 of the cash Cottage
Don Klee
Ed Yacht 0.273619 of the cash

which is an slight improvement of over on the initial allocation. Everyone gets the same items as in the initial allocation but the money is divided amongst those who receive the least rather then everyone.

Sunday, June 28, 2009

Fair Division in Treaty Negotiations

Raiffa in "the art and science of negotiation" describes the Panama Canal treaty negotiations in 1974. He got the value each country attached to each issue from the US negotiating team. In the fair division book chapter 5 describes this negotiation using their Adjusted winner algorithm. One weakness with this algorithm is that all items must be divisible.
There is no way to fix issues as non divisible as there is in my program (you will need to remove s.t. wor3 and s.t. wor4).
So if you take the data as

data;
param m := 2;
param n := 9;
param o := 1;

/*m people, n divisible items, o non divisible items*/
/*
1 non divisible items expansion routes
US Panama
US defense rights 22 9
use rights 22 15
Land and water 15 15
expansion rights 14 3
duration 11 15
expansion routes 6 5
compensation 4 11
jurisdiction 2 7
US military rights 2 7
defense role of Panama 2 13
*/

param c : 1 2 3 4 5 6 7 8 9 :=
1 22 22 15 14 11 4 2 2 2
2 9 15 15 3 15 11 7 7 13;

param d : 1 :=
1 6
2 5;
end;

where expansion routes is not divisible.

US gets item number us defense rights, use rights, expansion rights,expansion routes
Panama gets duration, expansion routes, compensation, jurisdiction and us military rights. For Land and water the US gets .1333 of this and Panama get 0.86667 which is ok as land and water are the sorts of things that can be divided up. Each country got 66% of what they wanted, In this case my program gets the same results as the Adjusted winner program.

Thursday, June 25, 2009

A better fair division program

One problem with the wildly unpopular fair division programs discussed previously is that they assume either everything can be cut into pieces or nothing can.
In the real world as Solomon noticed some items cannot be divided up. But some items are easily splittable . So I have improved the fair division program to deal with combined divisible and indivisible items.

Another problem is that the code only dealt with the two person case. I have fixed this by adding a new constraint for each extra person.

The code for this Mathprog program fair.mod is here. I am providing the source code in case anyone can suggest improvements. Also the world is full of decisions that get made for us that we have no way to challenge or understand. So I would like people to be able to see why the reasoning in and results of an arbitration,

The program (glpk) is run by

Put this data in a data file. Call glpk on it.
./glpsol -m fair.mod -d data -o fair.sol
So the data file could be

data;
param m := 4;
param n := 4;
param o := 2;
/*m people, n divisible items, o non divisible items*/

/*
Items to be divided are
4 divisible items: cash, land, cake, gold
2 non divisible items: dog, table
*/

param c : 1 2 3 4 :=
1 20 30 0 20
2 30 20 0 20
3 20 30 0 20
4 0 10 40 40;

param d : 1 2 :=
1 10 20
2 20 10
3 20 10
4 10 0;
end;

Which means person 1 thinks 20% of the value to them in the estate is in the cash, 10% is in the dog etc.

So now you can divide up goods fairly between m people. I have never seen a program that does this before. Using this program the that parties in a will, divorce, international dispute, merger and all sorts of other areas can achieve optimal solutions. The solutions will be proportional, envy-free (in the two person case) and Pareto optimal.

Now to make the dispute resolution program more usable.

Tuesday, May 26, 2009

Fair Division of Advertising

Wired today had a really interesting article on how Google uses auctions to sell advertisements here.
it has spawned—dozens of millionaire geeks, billions of auctions, and new ground rules for businesses in a data-driven society.
There is a great paper here(pdf) on the game theory of these online auctions.

But what other mechanisms are there to distribute out advertisements? One way is to use voting which I will describe again. Another method is the algorithmic fair division explained in my last post.

The glpk program given can be used to divide desired ad words between two bidders. You can add more bidders by adding constraints and people. There is an advantage to using this linear programming system of adword selling. It is not designed to maximise earnings but fairness. The procedure guarantees certain criteria described here. One advantage of these criteria is that the least unhappy buyer will be as happy as possible. As Amarillo Slim said "You can shear a sheep many times, but you can skin him only once." If you can keep each party as happy as possible you might maximise revenue over time rather then just for each particular auction. In the given program each party is assumed to have the same resources, 100, a fair division linear program for most applications would give each party a different level of resources.

Dinosaurs are interested in fair division


The book on fair division is this one

So using the previous code but with different data.

/*
Coke and Pepsi want to buy advertisements. They each have 100 dollars to spend.
The adwords they desire are
1. Refreshing drink 2. Black Fizzy water
3. cola 4. pop
param c gives how much each company desires an ad on
each of these words. Minimax guarantees that
the company that does worst gets
the most ads on the topics they want possible.
*/
param c : 1 2 3 4 :=
1 10 40 10 40
2 40 20 30 10 ;
end;

Tuesday, May 19, 2009

Fair Division

"The only way to rectify our reasonings is to make them as tangible as those of the Mathematicians, so that we can find our error at a glance, and when there are disputes among persons, we can simply say: Let us calculate [calculemus], without further ado, to see who is right" Leibniz

If you want to divide items between two people you want to make sure that the person who gets least gets as much as possible.

This Maximin algorithm where you maximise what the person who gets least gets. To do this each person should put a valuation on each item. You can then use linear programming to divide items fairly between people. This program is written for the GLPK(there is a tutorial on it here)

This program is a modified version of this one

param m, integer,:= 2;
/* number of people dividing stuff */

param n, integer, > 0;
/* number of items to be divided */

set I := 1..m;
/* set of people */

set J := 1..n;
/* set of items */

param b{i in I},:= 100;
/* resource capacity of person i.
How much each person can want */

param c{i in I, j in J}, >= 0;
/* amount received if item j
is given to agent i */

var worst;
/*how is the worst person doing?*/

var x{i in I, j in J},>=0;
/*
here ,>=0;
means that the items can be subdivided.
here , binary;
means that items cannot be subdivided
x[i,j] = 1 means job j is assigned to agent i */

s.t. one{j in J}: sum{i in I} x[i,j] = 1;
/* item j must be assigned.
An item can be split due to >=0
being used instead of binary;*/

s.t. lim{i in I}: sum{j in J} c[i,j] * x[i,j] <= b[i];
/* total amount received by all items
to person i must not exceed the person's capacity */

s.t. wor{i in I}: sum{j in J} c[1,j] * x[1,j] >= worst;
s.t. wor2{i in I}: sum{j in J} c[2,j] * x[2,j] >= worst;
/*constraint on who gets worst deal*/
maximize obj: worst;

data;

param n := 4;

/*Divorce between Donald and Ivana Trump
described in Win-Win solution.
Items to be divided are Conneticut estate, Palm beach mansion,
Trump plaza apartment, Trump Tower Triplex
param n := 4;
*/
param c : 1 2 3 4 :=
1 10 40 10 40
2 40 20 30 10 ;
end;


This last data part param c is important. The first line the columns are the items to be divided. The rows are the valuations placed on them. So c[i,j] is the value person i places on item j.
With splitting items allowed this results in

No. Column name St Activity
------ ------------ -- -------------
1 worst B 73.3333
2 x[1,1] NL 0
3 x[2,1] B 1
4 x[1,2] B 0.833333
5 x[2,2] B 0.166667
6 x[1,3] NL 0
7 x[2,3] B 1
8 x[1,4] B 1
9 x[2,4] NL 0

With splitting items not allowed the answer comes out as

No. Column name Activity
------ ------------ -------------
1 worst 70
2 x[1,1] * 0
3 x[2,1] * 1
4 x[1,2] * 1
5 x[2,2] * 0
6 x[1,3] * 0
7 x[2,3] * 1
8 x[1,4] * 1

This algorithm can be used to divide up items in a divorce, resources between countries and loads of other areas.
I will try make this easier for people to use. Any suggestions/comments are welcome.

Tuesday, April 28, 2009

Blind Rubik's Cube 2


I decided after getting slagged for my incredibly girly last cube to do something a bit less pink. So I went to the craft shop. Where I did not look in anyway out of place amongst all the girls buying glitter and sparkles.

The materials I had to choose from were clockwise from top left
Tire Rubber, paper, foam, felt,velcro hooks, velcro, canvas, ribbon and mesh. I also got black sandpaper later.



I removed the stickers. I then washed off the residual stickiness with glue. I sandpapered 5 of the faces. After some thought I went for foam, velcro hooks, canvas, sandpaper, mesh and clear.

Sunday, April 26, 2009

Swine Flu


There has been a worrying outbreak of swine flu. there is a good description of it here. The new scientist has another article on the issue here.

The pandemic ventilator project here says
So what do we know? First the people that are dying are not the typical elderly and very young. They are mainly healthy young and middle aged adults. The death rate seems fairly high, perhaps as great as 10%. Death rates early on in a pandemic however are very difficult to pin down, as we really do not know how many people were infected but in fact had very mild symptoms and were not counted. The virus is spreading to many geographical locations quickly. The WHO has already stated that it’s first line defense against pandemic outbreaks, which is containment, is no longer possible. The reason that there are no major travel restrictions imposed by governments is not that they think the threat is too minor, but that it is past the point where travel restrictions will help. What is still unknown is how severe it will eventually be, and how readily it will spread.

There is not much information in this post. All I am trying to do is point out some sources of useful information on this new flu outbreak.

Sunday, April 19, 2009

Blind Rubik's Cube


I saw this and thought a tactile rubik's cube was a good idea.

So I made one. Anyone need a cube they won't look at? Id love to send one to Bernard Morin the blind topologist.

1. Peel off the stickers
2. Get rid of crud left using white spirit
3. Scour the cube and the buttons with a stanley knife
4. Glue buttons onto cube
5. Wait


The result looks a bit like the Borg assimilated hello kitty.

I am going to do up another but this time with different textures instead of shapes. This gets over the symmetry problems. What substances should I use? I want to use felt and thinking of it reminded me of fuzzy felt

I dont want to get all Angela's Ashes here but really was fuzzy felt the best toy ever?

Friday, April 10, 2009

Shannon limit progress


Shannon was the guy who came up with much of the theory of digital computers but is mostly famous for creating information theory. I found out today invented the worlds first wearable computer to cheat at roullette in Vegas here. This is pretty similar to finding out Einstein invented a time machine to grift rubes in three card monte.

He also developed a motorised pogo-stick and flame throwing trumpet. A picture of Shannon using these or even just juggling on his unicycle would finally prove the internet was useful.

So how has attempts to get a code that approaches the Shannon limit progressed? "The Shannon limit or Shannon capacity of a communications channel is the theoretical maximum information transfer rate of the channel, for a particular noise level."

It is really important because it controls how much information a device can transmit. Which is important if you make phone calls or communicate with a satellite.
So in 1948 Shannon put a limit on how much information can be transferred. Mathematicians (and engineers) devise ways to encode information to make communications close to this limit. As maths progresses you would expect the codes to get closer to this limit.

I have taken this first picture from this very good article. You can see how codes improve over time


In this picture you can see new codes moving closer to 0 on the y-axis showing improvements in the coding schemes. I'm having trouble getting the world record closeness to the Shannon limit for particular dates. When I do I'll add them.
What I have so far is
Year Power Who
1977 2.1 dB Reed–Solomon code(now 1–1.5db)
1997 .27 db hamming code
2009 0.0045 dB LDPC codes

Sometimes codes have been invented before they were practical, but even then people tend not to have known how good they were.
"LDPC codes were invented by Robert Gallager in 1962! However, LDPC codes were largely forgotten until their rediscovery by David Mackay in 1998, who not only rediscovered them but used powerful modern computers (which were not available to
Gallager) to simulate their performance and thereby demonstrate their astonishing power"

The importance of this progress has been summed up by suggesting future historians will write
"Claude Shannon formulated the notion of channel capacity in 1948 A.D. Within several decades, mathematicians and engineers had devised practical ways to communicate reliably at data rates within 1 percent of the Shannon limit...."
Coding theory is one where we can see practical applied progress in mathematics over the last 60 years.

Thursday, April 09, 2009

Rubik's Progress

How quickly is maths improving? Say you look at how good your best solution to certain problems is over time. You can estimate how much improvement there is in maths over this time. Most of maths is based around proofs which are pretty hard to measure the quality of. But by looking at applied results you might get evidence to how much the pure maths knowledge has improved also.
So take the example of optimal algorithms for Rubik's cubes (most of this data taken from here).

Start 1974 until now how many face turns are needed to solve the Rubik's cube in the worst case?

52 moves 1981 using Thistlethwaite's Algorithm
42 moves 1990 Kloosterman (doc)
39 moves Mike Reid (i'm trying to get a date for this)
29 moves 1995."In 1995 Michael Reid proved that using these two groups every position can be solved in at most 29 face turns"
27 moves 2006, Silviu Radu
26 moves August 2007, Daniel Kunkle and Gene Cooperman
25 Moves Mar 2008 Tomas Rokicki
23 moves Jun 2008 Tomas Rokicki
22 moves August 2008 Tomas Rokicki

This implies 20 moves are enough using the given algorithm but it has not been proved

Now the best possible solution is at least 20 moves (known as gods algorithm). This number used to be 18 but was improved in 1995 by Michael Reid. The bounds on solutions to the Rubik's cube is improving from two sides. The ability to solve a Rubiks cube going from 52 to 22 moves does not seem earth shattering. There are probably more important maths calculations that have improved over time though. Can you think of any? As usual if you have any more information or corrections I will add them.

Wednesday, April 08, 2009

Timing Accuracy

As technological improves you would expect that our ability to measure things would improve. So if we take the accuracy of measurements as a crude gauge of technological progress can we graph how quickly we are progressing?

So take time. How quickly is our ability to measure time accurately improving?

I'm going to have a look at how accurately people have been able to measure time since the start of the modern world (about the time Newton got hit by an apple) till now. I take accuracy to mean how many seconds you could count before you would be out by one on average.

1656, Dutch astronomer Christian Huygens. It had an error of less than one minute a day according to here
1721, George Graham improved the pendulum clock’s accuracy to within a second a day
1761 John Harrison, half a second a day
1889 to Siegmund Riefler's clock with a nearly free pendulum, which attained an accuracy of a hundredth of a second a day
1952 Quartz clock at accuracy of 1 in 10^8 seconds.

Modern times are graphed here

For the atomic age I got the figures from here
So that gives the data

year accuracy
1650 10E+03
1721 10E+05
1889 10E+07
1952 10E+08
1955 10E+10
1970 10E+13
1989 10E+16
2008 10E+17

One problem with this line of thought is that exponential increases tend to stop. Otherwise we would be up to our ears in Fibonacci's rabbits. The problem with this exponential reasoning is described here

There are all sorts of other things whose accuracy have improved over time. Has temperature and mass measurement accuracy increased at the same rate?

Monday, April 06, 2009

Turkeys Voting for Christmas

Surely this expression should mean that things should not engage in acts they don't have the cognitive capacity needed to do. A bit like saying dogs should not do quantum theory. Taleb has a theory of turkey philosophy here.

But that is not the excepted meaning which is

like turkeys voting for (an early) Christmas (British & Australian humorous)
if people are like turkeys voting for Christmas, they choose to accept a situation which will have very bad results for them
Usage notes: Turkeys are large birds which are often eaten on Christmas Day.

Other then the obvious practical difficulties of running meleagrine elections Christmas has to be the best thing that has ever happened to turkeys. I remember a talk on the long now that the best way to ensure your species survival is to be really tasty.

Without Christmas we would have no reason to have such large numbers of turkeys. People don't keep skunks because they serve no useful purpose. Numbers would be vastly reduced. If only wild turkeys survived and they were not farmed for food their numbers would be orders of magnitude less.

Of course there is the question of whether it is a good idea for turkeys to put all their eggs in one basket Christmas wise. They have intelligently diversified in the American market into thanksgiving. Some sort of Summer festival in Asia would be where they should concentrate their marketing on next I would think.

Friday, March 27, 2009

What have a panzer tank and a Dublin taxi got in common?


You can use statistical methods to estimate their numbers boom boom

How many taxis are there in Dublin? I'm going to try guess without looking it up then see if I'm right. And I'm going to use Panzers to do it.

During WW2 the allies had to try guess how many tanks the germans had. From the Guardian
"The statisticians had one key piece of information, which was the serial numbers on captured mark V tanks. The statisticians believed that the Germans, being Germans, had logically numbered their tanks in the order in which they were produced"

People are always trying to guess how many of something there is. Iphones, kindles, computer worms, all sorts of man made objects. Mainly though it is important for military reasons.

Lancasters square law says that the power of a modern military force is proportional not to the number of units it has, but to the square of the number of units. This means that relatively small changes in the number of units an enemy has can have big changes in their effectiveness. Play around with the graph of x^2-x; here if you want to see for yourself. This is also important in computer game simulations of military operations.

Anyway I'll get some data on the Dublin Taxi driver licence numbers and get back with the calculation. The estimation problem should make more sense with an example.

Tuesday, March 24, 2009

The Lottery of Penalties

Croatia boss Slaven Bilic: "Penalties are a lottery and the players felt confident enough to take the spot kicks."
Redknapp's post-match attitude was that penalties are a "lottery"
Max Tonetto: “We played a great game, and unfortunately we were punished by the lottery of penalties.”

There is not much research on this area. This paper implies
The research shows that the individual goal-scoring skills do play a role in scoring goals from penalties and that the result is not exclusively a matter of luck… The belief that a penalty shootout is a lottery made players more receptive to the negative consequences of anxiety-caused stress.”

So according to Geir Jordet and Esther Hartman's research not only is a penalty kick not a lottery but saying it is hurts your team.

Sunday, March 15, 2009

Submarine Collision Probability 3

Ok last time on the how often should two nuclear submarines smack into each other question. This particular sum managed to get me and Luke into the Wall Street Journal print edition here and their blog here. Which was nice.

So the sum is a mean free path calculation. Where the particles are submarines and the box they are in is the submarine patrol zone or the whole Atlantic depending.

The size of a submarines patrol area is generally set by the requirement to have a surface support vessel within 24 hours. If one of these could travel at 20 knots an hour it could cover an circle with radius of 900 kilometers. The maximum operating depth is not much more than 600m and the submarine has to operate about 100m below the seasonal thermocline. A stealth mode speed is about two meters per second. The size of a nuclear submarine is about 150m length by 12m diameter plus a conning tower of about 8m high by 12 meters long. We modeled this cylinder as a sphere, which on these scales should not be too bad.

A support ship can support up to 14 subs. So we took it that there were 14 in its particular area in the small sum. If there were 14 gas particles wandering around a box the size of the Atlantic (big) or a ships support area (small). from a depth of 100m to 600m. At a speed of 2 meters a second. How often would you expect one to hit another is what we worked out.

Nuclear submarines have to stay 100 meters below the seasonal thermocline. We took the thermocline to be zero based on this

The model "mean free path" used is derived here

Now these are big ifs, thinking of things as being random gas particles is a big IF. People thought derivatives acted like random particles (the Black–Scholes model) and they just lost a lot of money. So I think this is more "fun application" of physics rather than "rigorous analysis". Thanks to Luke and Carl who crunched the numbers and got the data (i.e who did all the work).

Thursday, March 05, 2009

Malware News 2012

Turing Bots Are Coming
Autonomous IM bots with near human appearance have become an increasing source of malware infection in the last few months. Early attempt at such IM "Turing bots" first occurred in 2007. However recent improvements in the technology have lead to increased success in these infection methods. The bots attempt to appear human in instant messenger communications. This is generally to attempt to learn bank account information.

Eliezer Yedkawsky who has for years pointed out the security threat of artificial intelligence warned yesterday "Why does a dog wag its tail? Because the dog is smarter than the tail. If the tail was smarter, it would wag the dog."

A security expert dismissed as preposterous the idea that smarter then human AI coming from IM bots represents an existential threat to humanity.

NamScan closes

In related news a Vietnamese Anti Virus company NamScan closed yesterday. The Buddhist workers at the company refused to create software that would destroy intelligent AI bots. A company spokesman said "this is a strange cult that has grown up in our company. The engineers believed that if a program a collection of bits could pass the Turing test then it was in some way "human" and destroying it would be immoral".

The ruling on the court case between the antivirus industry and PETAI (people for the ethical treatment of AI) is due next week. A spokesman for the antivirus industry said "without the ability to stop these programs the whole internet will collapse".

Wednesday, March 04, 2009

Satellite Collisions

If something is worth doing its worth overdoing. So rather then continue to explore the massive conspiracy against life that is nuclear weapons I want to look at satellites.

"In an unprecedented space collision, a commercial Iridium communications satellite and a defunct Russian satellite ran into each other Tuesday above northern Siberia, creating a cloud of wreckage, officials said today."



There are all sorts of worries here about the effects of shards of satellite debris hurtling round the earth. Mainly though there are incredibly cool graphics of stuff smashing together.

Now I believe thinking about nuclear submarines as wandering particles (as i did here) makes sense on the grounds they are supposed to act in a random manner. Satellites however are deliberately put into set orbits to exclude collisions. They do change path occasionally though based on fuel leaks, gravity effects or being moved for operational reasons but they do not change path often enough for this model to be anything like a good fit. But if we did think of satellites as particles in a box how often would there be hits? If you are interested in a better back of the envelope there is one here.

"The Iridium satellite spanned about 5 meters across its solar arrays. Strela-2M used gravity gradient stabilization, and probably spanned 17 meters including the gravity boom. When calculating collision probabilities, it's important to remember that booms and antennae mean that many satellites have much larger cross-sections than the size of their main body would imply."

Number of particles=300 satellites
Size of particles= 2 meterish sphere

speed: 8000 mps

size of box= 0.06370550904E+12 cubic kilometers
as in earth Mean radius is 6,371.0 km. So sphere of size (6,371.0 km + 800) - sphere of size (6,371.0 km + 700) is the total area.

total volume of satellite = 600 cubic meters
satellite per unit area= 600/0.06370550904E+12 cubic kilometers

A java program to calculate this is below

class Sat {
public static void main(String[] args) {
int numPart=300;//sat number
int sizePart=2; // sat sizeg.
int speed=8000;//sat speed
Double below=new Double (1d);
below=1.41421356*3.14159265*2;//sqrt(2)*pr*r is part of mean free path sum
Double sizeBox =new Double(63705509040000000000d);//areas sats are in
double totalSat= numPart*sizePart;//total volume of sats
double SatPerUnit=totalSat/sizeBox;//how many sats per unit area?
Double meanFreePath=new Double(1d);
meanFreePath=1/(below*(1/sizeBox));//mean free path calculation
Double often= new Double(1d);
often=meanFreePath/speed;
often=often/(365*24*3600);
System.out.println("Satelites should hit every
"+often+" years");
}
}

Satellites should hit every 1.42E7 years. Which makes me fairly sure I've gotten my zeroes wrong somewhere.

Friday, February 27, 2009

Carrying stolen money

There was a bank raid this morning where an bank employee was made carry 7 million euro out of a bank. The story is here

"The official, who is in his 20s, was then forced to drive his car to the bank. After withdrawing the money, he handed it over to the gang at Clontarf DART station."

I am ignoring the horror of the attack and just asking what would 7 million euro weigh? In 2 euro coins it would weigh 29750kg


A bank note is around 1 gram according to here.
So 7 million euro is
14000 500 euro notes (1.1g) or 14.4kg.
100 euro notes (1g) are about 5 times that 70kg which a normal man could not carry nonchalantly out of a building.
50 euro notes (.9g) would weigh 126kg which most people could not lift.

So how did the employee carry this money? You would think there would be restrictions on employees carting large bags of money around.

There is also the size issue. 500 notes are Size: 160 x 82 x 0.12 mm so 14000 would be a pile 168 cm high. So say you want to put these into a duffel bag. This is roughly 600 mm long by 300 mm wide by 300 mm high

So you can fit three pile lengthways, three sideways and 2500 notes upwards. So in a duffel bag you can have a bit more then (there is left over room at the top and sides) 3*3*2500= 22500 500 euro notes. This is 11250000 euro weighing about 25 kilos.

How many 100 note (1g) of Size: 147 x 82 x 0.12 mm, 50 note (.9g) of Size: 140 x 77 x 0.12 mm could be carried?

Nuclear war 2.0

In the latest in my increasingly unhinged worries about nuclear war I started wondering what would happen if someone accidentally spilled coffee into the wrong machine and it did all kick off. Off course there are so many back ups no such accident could happen like the way a drunken depressive could never be the one with the final say on when Armageddon comes...

Anyway if they did launch what would be the effects on your house?

Turns out some people have already made a shinny web 2.0 app that lets you see this


Its great family fun to play around with. Center the flag on the nearest location you think will be nuked and have a look at the various effects. You can go for that retro 50's bomb, the humongous 60's version, all the glamour of a modern small tactical nuke.

Playing with these toys the maps and the nuke computer and such is a really odd feeling. Part of me is impressed with the sheer Promethean hubris of the enterprise. Its hard not to admire the technocrat logic of the slide rule nuke computer the shiney mashup of the nuke map or the eery idea of subs wandering round blind in the ocean. Mainly though I wonder how I got stuck on this planet that is clearly packed full of psychotic apes.

Thursday, February 26, 2009

MADness

After doing all the calculations for the chances of submarines wandering around blind filled with nuclear weapons crashing into each other i got a bit scared

There is something painfully absurd about the idea of blind mute spheres of death wandering round the oceans hoping not to bang into each other.


We like to think nuclear war was only a problem around the time of Bob Dylan's first album and was shot in kodachrome photos but the fact is it could still kick off today.

"I did a preliminary risk analysis which indicates that relying on nuclear weapons for our security is thousands of times more dangerous than having a nuclear power plant built next to your home."
Diffie

So for fun why not compute like it was 1962 and see what would happen if various nukes went off in your vicinity. There is a fun print and make Nuclear Bomb Effects Computer here and some more here. They are basically versions of slide rules people used to calculate how big fire balls and such would be.

Hey get the kids involved, its crafty and its edumacational. Why not teach them about how close to a bomb they would need to be so that all that would be left is the enamel of their teeth?

Wednesday, February 25, 2009

Submarine Collision Probability 2

Suppose submarines were spherical particles just wandering round the ocean. Occasionally they would hit the shore its surface or its maximum depth and would bounce off and head away again. Submarines do not move randomly but they do not follow fixed ordered paths either as that makes them easy targets.

The submarine was modelled as a cylinder of length 140 meters and radius 6 meters so it has a volume of 63360 meters cubed. If this is instead seen as a sphere this volume would have a radius of 24.73 meters. Forgive the spherical cow nature of this sum. From a previous calculation you have 25 particles (submarines) of volume 63360 cubic meters each in a space the size of 300 million cubic kilometers. How often will one hit another?

A problem very similar to this is how quickly two gasses will mix. Gas particles fly around very quickly air molecules at about 400 meters per second (which is faster then the speed of sound!) and all that stops cigar smoke instantly filling a room is that the gas molecules hit off each other so much they do not just zip across the room. The calculations below are based on an explanation found here. Maxwell and a few other worked out how often particles should collide and called the distance a particle travels without colliding the Mean free path.

Each particle has a volume of 63360 cubic meters. So 25 particles are 1,584,000 cubic meters. Instead of being in a box these submarine particles are in the atlantic with an operating range in depth of 300 meters. So the 'box' these particles are in is of size 30 000 000 000 000 000 cubic meters. Each particle has 12 million cubic kilometers to itself. so in 12 million cubic kilometers of ocean 63360 meters of it are particle. So 1 part in 190 000 000 000 of the available Atlantic is a submarine.

So how many particles per meter is that? 25*63360 submarines in 30 000 000 000 000 000 meters cubed of water.

Whats area is swept out by a particle (submarine) in a given period of time? I figure submarines wander around at 20kph so that's a sweep volume of pi*d*d*x in a distance x. travelling at 20kph that's pi*24.7*24.7*(20kph*1000m*24hr)=919994045 meters swept per day.

Now along this path how long will it on average travel before hitting another particle?

The mean free path formula is

where n is the number of particles per unit volume. And r is 24.7m. So the length you'd expect to travel between collisions is 1/2710* n.

Actually i think I've found a flaw in my reasoning here. I think the correct answer is about once ever 300 years. Which is still a bit too often isn't it? Ill post the calculations later.

Monday, February 16, 2009

Nuclear submarine collision what are the chances?

"A Royal Navy nuclear submarine was involved in a collision in the middle of the Atlantic, it was reported.

The crash between HMS Vanguard and French submarine Le Triomphant, which was also carrying nuclear warheads, is believed to have occurred on February 3 or 4, The Sun claimed."

A nuclear submarine seems to be about 140 meters with a radius of 12. So that's a volume of about 63360 cubic meters.

The Atlantic ocean is 354,700,000 cubic kilometers. There are 1 000 000 000 cubic metres is a cubic kilometer. Of course subs can only dive to about 400 metres. So say they stay in the top 300 meters then the volume might be more like 106.4 million km squared * 300 meters=30 million cubic km. More likely they avoid the top 20 meters where ships might hit them, so their range is estimated to be 20-2320 meters deep.

This is assuming a submarine is a cylinder which it isn't.
How many nuclear submarines are there? There seems to be about 50 in the world. Navies will keep their own submarines separate. But that still means there are in the Atlantic maybe 25 submarines that the French or UK subs could run into. This does reduce the number of subs the Russians Or Americans can hit significantly though. They have a top speed of about 40 km per hour. So I assume they are wandering around at 20kph. So assuming all the worlds submarines are in the Atlantic ocean at the same time how often would you expect one to hit another if they were traveling round at random?

Thursday, February 12, 2009

facebook relationship forensics

Has anyone noticed the modern skill of divining your friends relationship status based on social networking clues? You feel a bit CSI trawling through tweets to divine if someones missus is just not going to the pub or has been red carded.

This requires powers of divination that would shame an extispicist. It would also shame the animal whose entrails he was reading if it didnt have bigger problems at the time.

Why isn't there a word for thinking today is a different day? If you could go "oh the game is on tonight Ive been daisy all day" rather then having to go into an explanation of how you think its Friday not Thursday etc.

Wednesday, February 11, 2009

Mind reading maths horse advances scientific method

Clever Hans was a horse. He was a horse who did maths. People held up a card with a arithmetic puzzle to him and he would clop out the correct answer. Now this is a clever trick but the really odd bit is what happened when a guy called Pfungst figured out how he did it.

Pfungst realised that when the person posing the question did not know the answer the maths horse was suddenly thicker then pig shit. When the questioner expected another clop they leaned slightly forward. When the horse had clopped out the right answer they leaned back in amazement.

From this Pfungst realised that in experiments you give off subtle clues that can be picked up and influence the experiment. This was called the "clever hans effect" and is the reason we carry out experiments where the researcher does not know the "correct" answer. This double blinding was an important advance in the scientific method. The lack of double blind is a mistake a lot of paranormal and alternative health experiments make.

Still though Mind reading maths horse, that is just a random collection of words. What non equine advances to the scientific methods have been made? Was the first journal editor was a wiley aristocratic unidexterous fox? Peer review was originally carried out by psychic chemistry goats?

And while were on weird shit, did you know bees can recognise faces? I would have thought the chief advantage of being a social insect was being immune from embarrassment. Now there going to be all "Oh whats your name, I remember I met you by the gladioli yesterday". Forget shitting sugary water maybe we should use bees as bouncers. Giant swarms of bomber jacketed fuckwits baring entry to the pubs of Dublin.

Sunday, January 18, 2009

Sex, science and profits: Kealey



This book asks whether governments should fund science. It starts with a review of the history of technological advancement. This section is like a cross between an economic history of the western world and guns germs and steal. The books title seems to be tying to trade in on the popularity of Guns and Germs which might cause people to dismiss it as pop history and miss its important arguments about current science funding.

The second section is an analyse of the industrial revolution and shows how its discoveries stemmed not from government funded pure scientists providing insights that were then used by industrialists but from tradesmen making gradual improvements to the machines they used every day. These new machines then provided evidence for the theoreticians to build up scientific theories from.

The third section looks at how contemporary science is done and examines if government funding of science increases or decreases the rate of progress (and economic growth). It includes a convincing chapter on why patents serve to harm the public.

This is an entertaining well crafted book that lays out a compelling argument for free market (rather than state subsidised) science. The book seems to have been widely ignored outside libertarian circles where he is preaching to the converted.

One thing the book does not explore is the use of other methods to incentivize science. The use of betting markets and prizes are two ways that are probably underused.

Friday, January 16, 2009

Cheer up things could be worse

Chicken Licken has nothing on the news these days. Everyone is talking about "perfect storms of bad economic data" and "the worst possible recession imaginable", stuff like that. This recession is bad(pdf), much worse then most people currently believe. It is at the point where those hoarding gold are overly optimistic, they should be hoarding rice.

However you have to be really lacking in imagination to think that a complete collapse of the banking system hyperinflation of fiat currency and abandonment of all social services provisions are the worst economic event you can imagine.

Here are a collection of things that are much worse.

These sorts of inevitable disasters come round anywhere from every 100 years to 50,000 years or so
1. A Flu pandemic which killed 5% of world population.
2. Canary island volcano falling into the Atlantic.
3. Yellowstone volcano exploding
4. Rapid onset new ice age

Not inevitable but fairly likely
1. Thermonuclear war.
2. Intelligent robots that try kill us all (surely this is overdue at this point)
3. Bioterrorism of some mix of aids, smallpox, anthrax and athletes foot.

So cheer up on a geological scale this is minor. Yellowstone could explode then you’d really have problems.

Tuesday, January 13, 2009

Bound for Whorey

I'm so angry I could drop kick a nun.



Woodie Guthrie the raving communist hater of corporations is advertising Audi cars? Are they going to have this machine kills fascists emblazoned on the side?



And whats with the papercraft? a nice biodegradable car that is put together with loving care? The sort of thing that wont mow down people and leave them clinging to the bloody stumps that used to join to their feet?

At least Woody had the decency to die before they tried to dance around in his skin in some bizarre puppet person desecration. Iggy pop on the other hand has some sort of alien inside him that makes him advertise car insurance