Project Work

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

Advertisement

9 Responses to “Project Work”

  1. John Peacock Says:

    But the F77 will still run – and faster than python. Will current python code still function in 30 years? I bet it will fall over complaining about incompatble libraries….

    • telescoper Says:

      It might if I still had the code!

    • telescoper Says:

      Well, in the old days a lot of us used the NAG libraries…

      Come to think of it, whatever happened to them?

    • There are solutions to that – e.g. packrat for R. For each project you create, you can snapshot the specific version of the libraries you used to build your code. This can even be shared, as packrat holds copies of them with your project.

      I suppose the bigger issue is around teaching good programming practices as a fundamental skill. Knowing a language is only part of being an effective programmer.

    • “Dependency management” is pretty important! It’s a well known problem in software engineering that doesn’t seem taught at all enough.

  2. John Peacock Says:

    Well, I still use NAG on occasion – but my loyalty has been tested by their inflexible policies. These take the form of withdrawing routines that have been used for decades in a gazillion papers and replacing them with an improved version. The one that really got me upset was the basic random number generator g05caf. There’s now a different way to generate randoms, which not only has a different name but a different calling syntax. And for what? No-one suggested that these randoms were incorrect. But NAG doesn’t give you any choice about switching. You might think they would release the code of routines that they no longer have a use for, but no – you’re scuppered. Well, I showed them: I made a version of a public-domain random generator and named it g05caf. I have a rolling plan to do the same with all the other NAG routines that I still find useful. I feel it’s a pity I’m forced to go in this direction, but it’s their choice.

  3. […] sort of thing reminds me of my undergraduate theory project at Cambridge, where I did a similar thing to solve the equations governing the action of a […]

  4. […] was an undergraduate student at Cambridge. I did a final-year theory project that involved making a computer simulation of a laser. I had to attend a viva voce examination with two members of staff after submitting my project […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: