# Martin Orr's Blog

## Dijkstra on the pigeonhole principle

Posted by Martin Orr on Thursday, 04 October 2012 at 17:41

The computing scientist Edsger Dijkstra did not like the standard formulation of the pigeonhole principle:

If compartments contain objects, then at least one compartment contains at least two objects.

He preferred:

For a non-empty, finite bag of numbers, the maximum value is at least the average value.

Of course there are times when Dijkstra's principle is preferable to the traditional statement above (and to its generalisation which I will state below) but I think that there are also times when the traditional statement is preferable, and I am going to counter some of Dijkstra's arguments below. These come from EWD980 and EWD1094.

I am thinking about this today because I am going to teach the pigeonhole principle to some sixth formers at the Maths Olympiad Club at Orsay on Saturday, and I have already taught it twice at the National Mathematics Summer School in Birmingham.

Tags maths, nmss, teaching Read more...

## Matlab rant: Elementwise operations on arrays

Posted by Martin Orr on Saturday, 17 March 2012 at 17:27

I have to teach some simple use of Matlab to my engineering students. I don't much like the Matlab language, but then I am unhappy with pretty much every programming language I have ever used except C (which is great for some purposes but they do not include numerical work). Today I am going to rant about the first bit of code in our Matlab course (and probably the first non-trivial bit of code in many Matlab courses and tutorials).

My complaint concerns elementwise operations on arrays (i.e. applying the same operation to every element of an array). These are very important in Matlab, and sometimes you can write code that looks like it is acting on scalars and it just works elementwise on arrays. If scalar code would always just work elementwise on arrays then I might be happy with this (but I worry that if you had such a language, how would you distinguish operations that act on an array as a unit, not just elementwise?).

But sometimes you need to alter things slightly to work elementwise on arrays. I worry that for beginning programmers, the fact that elementwise array operations look so similar to scalar operations makes it difficult to understand when these alterations are required - it would be better to consistently require a syntax meaning "perform this operation elementwise."

## Birmingham summer school

Posted by Martin Orr on Sunday, 13 July 2008 at 21:12

I have just spent a week at the National Mathematics Summer School in Birmingham. Forty-two fourth/fifth form students are invited, the idea being to expose them to a broader range of mathematics than they get in school. Six sixth-formers are also invited; as well as being given some maths of their own, they are expected to look after a group of the younger children. I was at the summer school myself in 2001, and as a senior in 2002, but haven't been since.

This week had a strong geometrical flavour - four of the seniors' five sessions had a geometrical or topological theme, and there was much building of models of solids, either from plastic kits or origami. I gave the seniors a talk on hyperbolic geometry - a change from the Euclidean geometry I usually do at olympiad training camps. I think it went pretty well, and managed not to be too hard for them. I felt like I had not much to do overall at the camp, despite there being surprisingly few permanent staff. Still I enjoyed it, and it reaches a lot more children than the formal Olympiad training scheme.

Since the summer school finished on Friday, I have been staying with my aunt in Hove. I visited the magnificent Brighton Pavilion, the hilly town of Lewes and Seaford, on the sea. Tomorrow I am going on to France.

Tags holiday, imo, nmss, teaching, travel

## Exams 2008

Posted by Martin Orr on Saturday, 07 June 2008 at 13:11

I had exams for the past week. For the past few weeks, I was doing not much but revising, although I went to Oundle two weeks ago for an IMO training camp and the final team selection. I did another geometry problem session, which was not as good as my one at Trinity because I had less time to prepare due to exam revision and because I had already used lots of my favourite questions on the first sheet.

I had four exams this week. All are essentially the same, and you are free to choose from 38 questions on all the different courses in the year. Of course noone has taken anywhere near all the courses - I took 12 and revised 9. In the end I did an average of five questions on each exam; I might have liked to do a bit more, but that is more than adequate for a first.

With exams over, I have a couple of weeks until the results with nothing in particular to do.

## IMO training camp

Posted by Martin Orr on Thursday, 10 April 2008 at 20:03

I have been back in Cambridge for a week now, having come back for the Maths Olympiad training camp which ran last Thursday to Monday. My role was to discuss things with the school-age students when they needed someone with more mathematical experience, and especially to hang around in problem sessions and provide hints. Of course that assumes that I can do the problems myself - sometimes greater mathematical maturity makes that easier, sometimes it has got harder because I am out of practice with Olympiad style problems.

I also took a session on Euclidean geometry, the first time I have attempted to teach a group of people maths. This was quite easy teaching, because mostly I just had to give out a sheet of problems and let people try them. (I have collected up a couple of thousand problems from the IMO training I have gone through over the years, so I had plenty to choose from.) I did start off by spending about 10 minutes revising the basic facts about Euclidean transformations, which would have been familiar to most people, and then showing them one particular nice transformation which noone seemed to know (despite it being quite useful - I even used it in the 2005 IMO). My attempt to prove the properties of this transformation interactively was not too successful, as people proposed a different proof from what I knew, and I was not fast enough to keep up.

I now have two weeks in Cambridge until term starts. This weekend I am going to the London Lindy Exchange.

Tags imo, lindy, teaching