Tag: programming

The Royal Society and the data monkey

This year finds the Royal Society celebrating its 350th anniversary. The Royal Society is Britain’s national academy of science, one of the first of such societies to be founded in Europe. My brief investigations suggest that only the Italian Accademia dei Linceis and the German Academy of Sciences are older, and then only by a relatively small margin. The goals of the Royal Society were to report on the experiments of its members and communicate with like-minded fellows across Europe.

The Gentleman Administrator is planning some historical blogging on the Royal Society this year, starting with this post on the founding of the society and the role that Charles II played in it. On the face of it this post is about the history of the Royal Society, but in truth it says more about me as a data monkey than it does about the Royal Society. I shall explain.

The Royal Society supply a list of previous members as a pair of PDF format files, these contain each fellow of the Royal Society with their election date, their membership type and, for some, the dates of their birth and death. The PDF is formatted in a standard way suggesting to me that it could be read by a computer and the data therein analysed. I suspect there is an easier way to do this: ask the Royal Society whether they can supply the data in a form more amenable to analysis such as a spreadsheet or a database. But where’s the fun in that?

As an experimental physicist, getting data in various formats into computer programs for further analysis is what I do. This arises when I want to apply an analysis to data beyond that which the manufacturer of the appropriate instrument supplies in their own software, when I get data from custom-built equipment, when I trawl up data from other sources. I received a polite “cease and desist” message at work after I successfully worked out how to extract the text of internal reports from the reports database, they shouldn’t have said it couldn’t be done! I will save you the gory details of exactly how I’ve gone about extracting the data from the Royal Society lists, suffice to say I enjoyed it.

First up, we can identify the Presidents of the Royal Society, and their terms of office from the PDF files – this information is in the name entry for each of them. We can look this data up too). I’ve plotted these below in a manner reminiscent of the displays of the earth’s magnetic field reversal, each coloured stripe represents a presidency, and the colours alternate for clarity. The width of the stripe shows you how long each was president:

In the earlier years of the Royal Society’s history the Presidential term varied quite considerably: Sir Isaac Newton served for 24 years (1703-1727), and Sir Joseph Banks for 42 years (1778-1820). Since 1870 the period of the office seems to have been fixed at 5 years.

Next, we can work out the size of the fellowship in any particular year, basically we go through each fellow in the membership list and see when they were elected to the society and when they died: between these two years they were members. These data are plotted below:

We can see that membership in the early years of the 19th century started to rise significantly but then after 1850 it started to fall again.

This fits in with historical records, in the earlier years of the 19th century some younger fellows pointed out that the Royal Society was starting to turn into a fancy dining club and that most of the fellows had published very little, in particular Charles Babbage published Reflections on the decline of Science in England, and on some of its causes. Wheels ground slowly but finally, in 1846, a committee was set up to consider the charter of Society and how to curb its ever growing membership. I’ve not found the date on which the committee reported but subsequent to this date, admission to the society was much more strictly controlled. Election to the Royal Society is still a mark of a scientist a little above the ordinary.

The data on birth and death dates starts getting sparse after about 1950, presumably since many of the fellows are still alive and were reluctant to reveal their ages. Doing analysis like this starts to reveal the odd glitch in the data. For example,Christfried Kirch appears to have died two years before being elected. At the moment I’m not handling uncertainty in dates very well, and I learnt that the letters “fl” before a date range indicate that and individual “flourished” in that period, which is nice.

If anyone is interested in further data in this area, then please let me know in the comments below. I intend adding further data to the set (i.e. hunting down birth and death dates) and if there is an analysis you think might be useful then I’m willing to give it a try. I’ve uploaded the basic data to Google Docs.

Footnote
The illustration at the top of this piece is from the frontspiece of William Sprat’s The History of the Royal Society of London, for the Improving of Natural Knowledge, published in 1722.

Talkin’ about my generation

My generation have all been wallowing in nostalgia at the Electronic Revolution strand on BBC4, in particular Electric Dreams – the 80’s and Micro Men – the story of Sinclair and Acorn computers. We grew up in a golden age for programming, the generation before us had no hardware and the generation after us had no need to write their own software. We programmed because we had to.

I had a Commodore VIC20, cheaper than the BBC Micro, more classy and substantial looking than the Sinclair ZX81, available slightly before the ZX Spectrum. All of these lovely old machines available for your viewing pleasure at Centre for Computing History, along with many others. Look around the internet and you can also find all manner of emulators and manuals for these early machines. We wrote our own programs, or we typed in games from magazines – this was often a rather lengthy process and a bit prone to error.

I found the “VIC20 Programmers Reference Guide” here re-typed by Asbjorn Djupdal. Here’s snippet: a program which allows you to enter the scores in each quarter for an American football game and then prints them out on screen in a table:

100 DIM S(1,5), T$(1)
110 INPUT “TEAM NAMES”;T$(0),T$(1)
120 FOR Q = 1 TO 5
130 FOR T = 0 TO 1
140 PRINT T$(T),”SCORE IN QUARTER” Q
150 INPUT S(T,Q)
160 S(T,Q) = S(T,0) + S(T,Q)
170 NEXT T,Q
180 PRINT CHR$(147) “SCOREBOARD”
190 PRINT “QUARTER”;
200 FOR Q = 1 TO 5
210 PRINT TAB(Q*2 + 9)Q;
220 NEXT
230 PRINT TAB(15)”TOTAL”
240 FOR T = 0 TO 1
250 PRINT T$(T)
260 FOR Q = 1 TO 5
270 PRINT TAB(Q*2 + 9) S(T,Q);
280 NEXT
290 PRINT TAB(15) S(T,0)
300 NEXT

Oh, this brings back memories!

To me programming and science (or at least physics) are intimately linked, almost the first programming I ever did was to visualise beat frequencies. To this day, if I want to really understand a scientific paper I’ll implement the equations in a program, as often as not a few typos in the equations are revealed in this way and I’ll have learnt exactly what the paper was on about. Teaching a student is a fantastic why to learn something, teaching a computer is almost as good.

Most the programming I do is of a workmanlike nature, it drives machines for measurements; it processes data; it analyses results; it computes equations, but there is scope in programming for a deep elegance, a pared down beauty which is difficult to describe – it’s like finding the answer to a cryptic crossword clue – perhaps for an artist it’s like finding just the right line to give a character personality. It’s an algorithm that does what it has to do with the least effort required. I still program a lot for my work (relatively small stuff that only I will use), and it’s not unknown for me to waste an hour doing something elegantly rather use the quick, dirty and obvious approach.

Programming is in my genes, in two ways really – my parents were both programmers from the sixties. We once found a leaflet advertising the Elliot 503 in our loft, 400sq ft of ’60s computer with substantially less processor power than the most lowly of today’s devices – this is the computer on which my mum learnt to program. Dad started on an early Ferranti of some description in the late 50’s.

Earlier programming for me pretty much amounted to shouting verbs at things, possibly because I used FORTRAN which at the time was ALL IN CAPITALS. Programming today feels very different, it’s more like visiting a library to get a book of spells to cast or the singing of a choir. I still enjoy doing it, in fact I’m writing a twitter client in C# just so see how to do it.

You might get the impression from all of this that programming is for the mathematically minded, but it isn’t – it’s really for the logically minded, for some mathematical applications maths is required but otherwise it isn’t.

I taught the basics of programming to first year physics students a few years ago, and the thing that really shocked me was that, out of a class of fifty, only one had any real programming experience. There is hope though, I suspect programming still holds a fascination – my single data point: father and son sitting down to program the BBC Micro on Electric Dreams.