Archive for Computational Physcs

The Week Ahead

Posted in Education, Maynooth with tags , , , , , on August 17, 2025 by telescoper

Another weekend is almost over so, after spending most of this afternoon in the garden, I’ve retreated indoors to look at my calendar for the forthcoming week. I find a plethora of Examination Board meetings, one (tomorrow) for our Masters students who did their presentations on Friday and two for undergraduates who took repeat examinations in August (one for Mathematical Physics and one for Engineering, as I happen to have been teaching Engineering Mathematics this year). The two undergraduate boards are both on Thursday. All three of these should be relatively brief, but you never know…

There is another meeting tomorrow, Monday, about organizing our computational physics teaching for the new academic year. The merger of theoretical and experimental physics has given us the chance to coordinate the different computational modules offered by the two previous departments, but we need to make sure the teaching rooms are big enough and the computers have the correct software, etc. Fortunately I’m not actually teaching Computational Physics again until Semester 2 but we have to get it sorted in time for other modules happening in Semester 1.

In between Monday and Thursday I have two whole days with no meetings and no grading to do. I might be able to get on with some research, or at least with writing up some research I’ve already done.

Friday is a big day for the Irish higher education system, in that it’s the day students get their Leaving Certificate results. This year the grade inflation introduced during the pandemic is supposed to begin to unwind, but none of us outside the examination system knows how this will be achieved or what the results will be. If I had to bet I’d say that the CAO points needed for most courses at Maynooth will go down substantially, partly because of the deflation mentioned previously but also because The Management has decided that the University has to recruit more and more students and will drop entry standards as low as it needs to in order to meet its targets.

I don’t know how many students we will end up with for Academic Year 2025/6 but I do know that I will have retired before most of them complete their course. I used to find it a bit scary thinking about retirement, but not any more.

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…