## Archive for Computational Physics

Posted in Biographical, Education, mathematics, Maynooth, Music with tags , , , , on February 3, 2019 by telescoper

It’s 3rd February 2019, which means that today is two days after Imbolc, a Gaelic festival marking the point halfway between the winter solstice and vernal equinox. This either happens 1st or 2nd February, and this year it was former, i.e. last Friday In Ireland this day is sometimes regarded as the first day of spring, as it is roughly the time when the first spring lambs are born. It corresponds to the Welsh Gŵyl Fair y Canhwyllau and is also known as the `Cross Quarter Day’ or (my favourite) `The Quickening of the Year’.

I wrote a post about this time last year, on the day I gave my first ever lecture in Maynooth University, on Computational Physics, in a theatre called Physics Hall. That was on Thursday February 1st 2018. It’s hard to believe that was a full year ago. Time certainly has gone quickly this year.

Owing to the vagaries of the academic calendar we’re a week later getting back to teaching this year than last year so my first Computational Physics lecture won’t be until this Thursday (7th February) at 9am, but sadly it won’t be in Physics Hall, which I rather liked, but in Hall C – a much less atmospheric venue, but one rather closer to my office, which will be handy if I forget anything (which I am prone to do). There are about 25 students taking this module, a few down on last year, which means they should fit comfortably into our computer lab. I’m not surprised they moved the lecture, really. The capacity of Physics Hall is 90, and even last year I only had about 30 students. Still, it did have a piano (which Hall C does not):

Computational Physics doesn’t start until Thursday. Before that I have to start my other module: Engineering Mathematics II. This (what you would probably call a `service course’) covers a mixture of things, mainly Linear Algebra but with some other bits thrown in for fun, such as Laplace transforms. Interestingly I find the Mathematical Physics students do not encounter Laplace Transforms in the first year, but perhaps engineers use them more often than physicists do? I think I’ve written only one paper that made use of a Laplace transform. Anyway, I have to start with this topic as the students need some knowledge of it for some other module they’re taking this semester. I reckon six lectures will be enough to give them what they need. That’s two weeks of lectures, there being three lectures a week for this module.

By coincidence rather than good planning, the timetable for this module is quite nice. I have lectures on Monday, Tuesday and Wednesday and then the students have a choice of tutorial (on either Thursday or Friday). That means I can get through a decent amount of material each week before each tutorial. I don’t do the tutorials, by the way: that’s left to one of our PhD students, who gets paid for doing that and correcting the weekly coursework. There are about 50 students on this module, divided into two courses: Electronic Engineering and Robotics and Intelligent Devices. We don’t have Civil or Mechanical or Chemical Engineering, etc at Maynooth.

Campus has been very quiet for the last week or so. The exam period finished in late January but lectures don’t start until tomorrow morning (Monday 4th February) so there have been few students around. No doubt it will be a different story tomorrow. I’ve done my first week’s notes and compiled my first problem set so I’m more-or-less ready to go. First lecture at 2pm tomorrow in Hall H, which is one of the rooms I taught in last term so at least I know where it is!

## 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.

## Spring comes to Maynooth

Posted in Biographical, Cardiff, Maynooth with tags , , on April 5, 2018 by telescoper

After a good night’s sleep last night I was up early this morning to give my usual Thursday 9am lecture on Computational Physics. It was a bright sunny morning, though there was overnight frost and a distinct chill in the air, as I made my way to Physics Hall. Once there, for the first time this year, I had to close the blinds because the Sun was shining too bright for the projector screen. It has hitherto always been too gloomy outside for this to happen. The picture above (of St Joseph’s Square, on the South Campus) was taken as I left St Patrick’s House after a very nice lunch of roast lamb in Pugin Hall. By this time of day it was pleasantly warm.

Here’s a nice picture of the Library circulated by the Maynooth social media folk earlier today.

Anyway, this mornings’s lecture was an introduction numerical solutions of ordinary differential equations, beginning with Euler’s method applied to initial value problems. Further studies of this topic – which is very important for bidding computational physics – will take up the rest of the lectures as we explore the delights of, e.g. Runge-Kutta codes and boundary value problems. This morning’s lecture was followed this afternoon by a two-hour lab session in which the students had to write their own ODE solver.

Among the advantages (for me) of teaching this module is that I’m actually becoming reasonably competent at Python. At any rate I’ve difficult improved my ability to spot bugs in codes written by other people. In fact, it is traditional for the exam in this module to include a question that involves finding 10 mistakes in a piece of Python code. That’s a fun challenge, the only real problem for me being to write a bit of code with only 10 mistakes in it in the first place…

Talking of exams, the timetables for my two current employers are now out. Computational Physics in Maynooth is on Friday 11th May while Physics of the Early Universe in Cardiff is almost a fortnight later, on Thursday 24th May. The Easter recess is shorter here in Maynooth than in Cardiff, where lectures do not resume until April 16th (assuming the UCU strike does not continue), which is why the exams in Maynooth are earlier. I’m grateful there isn’t a clash. I should have ample time to mark the Maynooth ones before the Cardiff ones are due. After the first week or so of May I won’t have to teach in both institutions, so my somewhat hectic schedule should become a little more relaxed from then onwards.

I mentioned the UCU strike above in passing. The UCU leadership has decided that there will be an online ballot on whether to accept the `offer’ recently made by the management organisation UUK. The ballot will be open until April 13th. If the vote goes against acceptance then Cardiff staff will be back on strike from 16th April, and there will be further industrial action over the examination period. I can’t predict what the result of the ballot will be. Although the UCU leadership is recommending acceptance I don’t know anyone personally who intends to vote for it, but there’s a probably a big selection effect there! There is a distinct possibility that examinations will be badly disrupted not only in Cardiff but all over the UK. It’s a very sad state of affairs but all those on strike (and the majority of students) consider the UUK side to be to blame…

## Learning Technology

Posted in Biographical, Cardiff, Education, Maynooth with tags , , , , , , , , on February 20, 2018 by telescoper

I’m just taking a tea break in the Data Innovation Research Institute. Today has been a very day as I have to finish off a lot of things by tomorrow, for reasons that I’ll make clear in my next post…

It struck me when I was putting on the brew how much more technology we use for teaching now than when I was a student. I think many of my colleagues make far more effective use of the available technology than I do, but I do my best to overcome my Luddite tendencies. Reflecting on today’s teaching makes me feel just a little less like a dinosaur.

This morning I gave a two-hour lecture on my Cardiff module Physics of the Early Universe which, as usual, I recorded using our Panopto system. Although there was a problem with some of the University’s central file storage this morning, which made me a bit nervous about whether the lecture recording would work, it did. Predictably I couldn’t access the network drives from the PC in the lecture theatre, but I had anticipated that and took everything I needed on a memory stick.

After a short break for lunch I checked the lecture recording and made it available for registered students via the Virtual Learning Environment (VLE), known to its friends as Learning Central. I use this as a sort of repository of stuff connected with the module: notes, list of textbooks, problem sets, model answers, instructions and, of course, recorded lectures. The students also submit their coursework assignment (an essay) through this system, through the plagiarism detection software Turnitin.

This afternoon the students on my Computational Physics course in Maynooth University had a lab test, the first of four such tests, this one consisting of a short coding exercise. There are two lab sessions per week for this class, one on Thursdays (when I am normally in Maynooth to help supervise) and another on Tuesdays (when I am normally in Cardiff). I have a number of exercises, which are similar in scope but different in detail (to prevent copying) and the Tuesday lab has a completely different set of exercises from the Thursday one. In each exercise the students have to write a simple Python script to plot graphs of a function and its derivative (computed numerically) using matplotlib. The students upload their script and pictures of the plot to the VLE used in Maynooth, which is called Moodle.

In the manner of a TV chef announcing `here’s one I did earlier’, this a sample output produced by my `model’ code:

I wonder if you can guess of what function this is the derivative? By the way in this context `model’ does not mean `a standard of excellence’ but `an imitation of something’ (me being an imitation of a computational physicist). Anyway, students will get marks for producing plots that look right, but also for presenting a nice (commented!) bit of code

This afternoon I’m on Cardiff time but I was able to keep an eye on the submissions coming in to Moodle in case something went wrong. It seemed to work out OK, but the main problem now is that I’ve got 20-odd bits of code to mark! That will have to wait until I’m properly on Maynooth time!

Now, back to the grind…

## The Quickening of the Year

Posted in Education, Maynooth, Music, The Universe and Stuff with tags , , , , on February 1, 2018 by telescoper

It’s 1st February 2018, which means that today is Imbolc, a Gaelic festival marking the point halfway between the winter solstice and vernal equinox. This either happens 1st or 2nd February, and this year it is the former. In this part of the world – I’m in Ireland as I write- this day is sometimes regarded as the first day of spring, as it is roughly the time when the first spring lambs are born. It corresponds to the Welsh Gŵyl Fair y Canhwyllau and is also known as the `Cross Quarter Day’ or (my favourite) `The Quickening of the Year’.

So, talking of quickening, the pace of things is increasing for me now too. This morning at 9am I gave my first ever lecture in Maynooth University in a lecture theatre called Physics Hall, which is in the old (South) part of campus as opposed to the newer North Campus where the Science Building that contains my office is situated.

After that it was back to the Department for some frantic behind-the-scenes activity setting up accounts for the students for the afternoon lab session, which is in a computer room near to my office. Students attend one two-hour lab session in addition to the lecture, on either Thursday or Tuesday. The first lecture being this morning (Thursday) the first lab session was this afternoon, with the same material being covered next Tuesday.

I was far more nervous about this afternoon’s lab session than I was about this morning’s lecture as there seemed to be many things that could go wrong in getting the students up and running on our Linux cluster and getting them started on Python. Quite a few things did go wrong, in fact, but they were fewer in number and less drastic in outcome that I had feared.

So there we are, my first full day teaching in Maynooth. I think it went reasonably well and it was certainly nice to meet my first group of Maynooth students who, being physics students, are definitely la crème de la crème. I’ve got another 6 weeks like this (teaching on Tuesday in Cardiff and on Thursday in Maynooth) before the Easter break so it’s going to be a hectic period. Just for tonight, however, I’ve got time to relax with a glass or several of wine.

Incidentally, I was impressed that Physics Hall (where I did this morning’s lecture) is equipped with an electric piano:

I wonder if anyone can suggest appropriate musical numbers to perform for a class of computational physicists? Suggestions are hereby invited via the Comments Box!