## When Log Tables aren’t Log Tables

Posted in Education, mathematics, Maynooth with tags , , , , , on May 17, 2018 by telescoper

Every now and then – actually more frequently than that – I reveal myself in Ireland as an ignorant foreigner. The other day some students were going through a past examination paper (from 2014) and I was surprised to see that the front cover (above) mentioned  `log tables’.

Now I’m old enough to remember using tables of logarithms (and other mathematical tables  of such things as square roots and trigonometric functions, in the form of lists of numbers) extensively at school. These were provided in this book of four-figure tables (which can now buy for 1p on Amazon, plus p&p).

As a historical note I’ll point out that I was in the first year at my school that progressed to calculators rather than slide rules (in the third year) so I was never taught how to use the former. My set of four-figure tables which was so heavily used that it was falling to bits anyway, never got much use after that and I threw it out when I went to university despite the fact that I’m a notorious hoarder.

Anyway, assuming that the mention of `log tables’ was a relic of many years past, I said to the group of students going through the old examination paper that it seemed somewhat anachronistic. I was promptly corrected, and told that `log tables’ are in regular use in schools and colleges throughout Ireland, but that the term is a shorthand for a booklet containing a general collection of mathematical formulae, scientific data and other bits of stuff that might come in useful to students; for an example appropriate to the Irish Leaving Certificate, see here. One thing that they don’t contain is a table of logarithms…

Students in Physics & Astronomy at Cardiff University are also given a formula booklet for use during examinations. I don’t remember having access to such a thing as an undergraduate, but I don’t object to it. It seems to me that an examination shouldn’t be a memory test, and giving students the basic formulae as a starting point if anything allows the examiner to concentrate on testing what matters much more, i.e. the ability to formulate and solve a problem. The greatest challenge of science education at University level is, in my opinion, convincing students that their brain is much more than a memory device…

## Project Work

Posted in Biographical, Education, mathematics with tags , , , , , on April 23, 2018 by telescoper

I’m progressively clearing out stuff from my office prior to the big move to Ireland. This lunchtime I opened one old box file and found my undergraduate project. This was quite an unusual thing at the time as I did Theoretical Physics in Part II (my final year) of Natural Sciences at Cambridge, which normally meant no project but an extra examination paper called Paper 5. As a member of a small minority of Theoretical Physics students who wanted to do theory projects, I was allowed to submit this in place of half of Paper 5…

The problem was to write a computer program that could solve the equations describing the action of a laser, starting with the case of a single-mode laser as shown in the diagram below that I constructed using a sophisticated computer graphics package:

The above system is described by a set of six simultaneous first-order ordinary differential equations, which are of relatively simple form to look at but not so easy to solve numerically because the equations are stiff (i.e. they involve exponential decays or growths with very different time constants). I got around this by using a technique called Gear’s method. There wasn’t an internet in those days so I had to find out about the numerical approach by trawling through books in the library.

The code I wrote – in Fortran 77 – was run on a mainframe, and the terminal had no graphics capability so I had to check the results as a list of numbers before sending the results to a printer and wait for the output to be delivered some time later. Anyway, I got the code to work and ended up with a good mark that helped me get a place to do a PhD.

The sobering thought, though, is that I reckon a decent undergraduate physics student nowadays could probably do all the work I did for my project in a few hours using Python….

## Fun with the Airy Equation

Posted in Education, mathematics with tags , , , , , , on April 12, 2018 by telescoper

Today being a Maynooth Thursday, it has, as usual, has been dominated by computational physics teaching. We’re currently doing methods for solving ordinary differential equations. At the last minute before this afternoon’s lab session I decided to include an exercise that involved solving the following harmless-looking equation: $y'' = xy.$

This is usually known as Airy’s equation and it comes up quite frequently in problems connected with optics. It was first investigated by a former Astronomer Royal George Airy, after whom the function is named; incidentally, he was born in Alnwick (Northumberland, i.e. not the Midlands).

Despite its apparent simplicity, the Airy equation describes some very interesting phenomena. Indeed it is the simplest ODE (that I know of) that has the property that there’s a point at which the behaviour of the solution turns from oscillatory to exponential. Here’s a result of a numerical integration of the equation: obtained using a simple Python script:

(I stopped the integration at $x=5$ as the magnitude of the solution grows very quickly beyond that value for the particular initial conditions chosen).

One of the reasons for including this example (apart from the fact that Airy was a Geordie) is that the students were so surprised by the behaviour of the solution and most of them assumed that there was some problem with the numerical stability of their results. Some integration methods do struggle with such simple equations as the simple harmonic oscillator, but just sometimes weird numerical results are not mere numerical artifacts!

Anyway, my point is not about this particular equation or even about computational physics, but a general pedagogical one: finding interesting results for yourself is much more likely to motivate you to think about what they mean than if they’re just described to you by someone else. I think that goes for numerical experiments in a computer lab just as much as it does for any other kind of practical experiment in a science laboratory.

## Tom Lehrer at 90!

Posted in mathematics, Music with tags , on April 9, 2018 by telescoper

I was reminded this weekend that today (9th April 2018) is the 90th birthday of American musician, singer-songwriter, satirist, and mathematician Tom Lehrer. Although he has retired from theatres of both musical and lecture variety, his songs (and especially the one I’ve selected) remains topical to this day. I’m about to retreat into a bunker to finish marking a batch of coursework so please enjoy the following short tribute and wish Tom Lehrer a very happy 90th birthday!

## Other People’s Code

Posted in Education, mathematics with tags , , , on March 16, 2018 by telescoper

I don’t know if this is just me being useless, but one of the things I’ve always found difficult is debugging or rewriting computer programs written by other people. This is not a complaint about people who fail to document their code sufficiently to see what’s going on, it’s that even when the code is documented it seems much more difficult to spot errors in code written by other people than it is when you’ve written the program yourself.

I’ve been thinking a lot since I’ve been teaching Computational Physics here in Maynooth University. One of the standard elements of the assessment for this module is a task wherein the students are given a Python script intended to perform a given task (e.g. a numerical integral) but which contains a number of errors and asked to identify and correct the errors. This is actually a pretty tough challenge, though it is likely to be one that a graduate might have to meet if they get a job in any environment that involves programming.

Another context in which this arises is our twice-weekly computing laboratory sessions. Twice in the last couple of weeks I’ve been asked for a bit of help by students with code that wasn’t working, only to stare at the offending script for ages and fiddling with a number of things that made no difference, without seeing what turned out to be an obvious mistake. Last week it was an incorrect indent in Python (always a hazard if you’ve been brought up on Fortran). This week it was even simpler, a sign error in a line that was just supposed to calculate the mid-point of an interval. I should have been able to spot these very quickly, but I couldn’t.

What makes this so difficult? When given a mathematical calculation to mark I can usually spot errors reasonably easily (unless the working is illegible), but with code it’s different (at least for me). If I’d been given it on a piece of paper as part of a formula, I reckon I would have spotted that minus sign almost immediately.

One possibility is just that I’m getting old. While that may well be true, it doesn’t explain why I found debugging other people’s code difficult even when I was working on software at British Gas when I was 18. In that context I quite often gave up trying to edit and correct software, and instead just deleted it all and wrote my own version from scratch. That’s fine if the task is quite small, but not practicable for large suites written by teams of programmers.

I think one problem is that other people rarely approach a programming task exactly the same way as one would oneself. I have written programs myself to do the tasks given to students in the computing lab, and I’m always conscious of the method I’ve used. That may make it harder to follow what others have tried to do. Perhaps I’d be better off not prejudicing my mind doing the exercises myself?

Anyway, I’d be interested to know if anyone else has the same with other people’s code and if they have any tips that might improve my ability to deal with it. The comments box is at your disposal…

## A Problem involving Simpson’s Rule

Posted in Cute Problems, mathematics with tags , on March 9, 2018 by telescoper

Since I’m teaching a course on Computational Physics here in Maynooth and have just been doing methods of numerical integration (i.e. quadrature) I thought I’d add this little item to the Cute Problems folder. You might answer it by writing a short bit of code, but it’s easy enough to do with a calculator and a piece of paper if you prefer.

Use the above expression, displayed using my high-tech mathematical visualization software, to obtain an approximate value for π/4 (= 0.78539816339…) by estimating the integral on the left hand side using Simpson’s Rule at ordinates x =0, 0.25, 0.5, 0.75 and 1.

HINT 1: Note that the calculation just involves two applications of the usual three-point Simpson’s Rule with weights (1/3, 4/3, 1/3). Alternatively you could do it in one go using weights (1/3, 4/3, 2/3, 4/3, 1/3).

HINT 2: If you’ve written a bit of code to do this, you could try increasing the number of ordinates and see how the result changes…

P.S. Incidentally I learn that, in Germany, Simpson’s Rule is sometimes called called Kepler’s rule, or Keplersche Fassregel after Johannes Kepler, who used something very similar about a century before Simpson…

## The de Valera connection

Posted in History, mathematics, Maynooth with tags , , on February 14, 2018 by telescoper

This morning I took the early flight to Dublin, which was on time, and thence via the Airport Hopper to Maynooth. There were only two passengers on the bus, both going to the terminus, so it made good time, travelling all the way along the motorway.

Walking into the Maynooth campus I remembered an interesting little historical fact that I stumbled across last week, concerning Éamon de Valera, founder of Fianna Fáil (one of the two largest political parties in Ireland) and architect of the Irish constitution. De Valera (nickname `Dev’) is an enigmatic figure, who was a Commandant in the Irish Republican Army during the 1916 Easter Rising, but despite being captured he somehow evaded execution by the British. He subsequently became Taoiseach (Prime Minister) and then President (Head of State) of the Irish Republic.

Eamon de Valera, photographed sometime during the 1920s.

The point of connection with Maynooth, however, is less about Dev’s political career than his educational background: he was a mathematics graduate, and for a short time (1912-13) he was Head of the Department of Mathematics and Mathematical Physics at St Patrick’s College, Maynooth, which was then a recognised college of the National University of Ireland. The Department became incorporated in Maynooth University, when it was created in 1997. It is said that one of the spare gowns available to be borrowed by staff for graduation ceremonies belonged to de Valera. Mathematical Physics is no longer a part of the Mathematics Department at Maynooth, having become a Department in its own right and it recently changed its name to the Department of Theoretical Physics.

De Valera missed out on a Professorship in Mathematical Physics at University College Cork in 1913. He joined the the Irish Volunteers, when it was established the same year. And the rest is history. I wonder how differently things would have turned out had he got the job in Cork?

That’s one connection, but when I arrived in the office this morning I found another. An email had arrived announcing a conference later this year in honour of Erwin Schrödinger.  It was de Valera – a notable advocate for science – who in 1940 set up the Dublin Institute for Advanced Studies (DIAS); Schrödinger became the first Director of the School of Theoretical Physics, one of the three Schools in DIAS.