Programming in the Undergraduate Mathematics Curriculum conference
This was a one-day conference at Middlesex University with short talks from Noel-Ann Bradshaw, Peter Rowlett, James Denholm-Price, Vincent Knight, Matthew Jones, Stephen Lynch, and Chris Sangwin. There were so many interesting aspects of people’s talks that I can’t write them all up, but I will try to put down a few of my favourites (especially the things I thought would be useful for next year’s Python course).
The conference took place upstairs in the Hendon public library where Middlesex University have a maths help centre. In the help centre there are PC clusters and several wall-mounted big screens on which one of the organisers had put up a nice programming puzzle (from one of the coding challenge sites, maybe leetcode.com?). You are given \(N\) integers \(a_1,\ldots,a_N\). The problem is to compute the array whose \(j\)th element is the product of all the \(a_i\)s except \(a_j\) in \(O(N)\) time, without using division. There’s an answer at the end.
What I took from the conference
- The London Poly HND catering course (late 80s?) had a second year BASIC programming module! I wonder if any hospitality/catering HND courses give you the chance to do that today. My dad would have been a mature student at Leicester Poly around that time (now DMU) and took a Pascal course, but he was on some kind of general studies degree. (Bradshaw)
- Noel-Ann (who now works at Sainsbury’s Argos) listed some things industry was not especially chasing after (maths grads, Matlab, LaTeX) and things it really cared about (self-learning, Python and SQL for data science, ‘work ready team players’, Excel)
- The main place people in industry learn coding from is Stack Overflow. (Bradshaw)
- I got a general impression from multiple speakers that mathematicians have a lot of wrong ideas about programming. Especially, they forget that 99% of the time they are educating people who will be average developers, not bare-metal algorithm designing rockstars, and they don’t understand what coding in industry is like now: by and large you stitch together other people’s code that you don’t necessarily understand in detail.
- A lot of talk about Java, how much people hate it, how much it is still used.
- Peter Rowlett talked about how he emphasised programming as a mathematical activity, for solving math problems - many people mentioned that when students don’t like the programming parts of their maths degree it’s because they feel they signed up to do a maths degree and programming isn’t maths. He distinguished between programming (in the abstract) and coding (in a specific language) and tried to teach the former, including propositional logic. There were some great motivational points for students: searching for help with syntax doesn’t mean you’re failing to progress (professionals do this all the time).
- Natural language versus computer language. Is the ‘or’ in “Would
you like tea or coffee?” OR or XOR? What about in “Milk or sugar?”? Similar exercise for implication: let P be “the alarm cord is pulled” and Q be “the train stops”, what (if anything) do the following statements tell us about the truth of \(P \implies Q\)?
- the cord is pulled, the train hasn’t stopped
- the cord was not pulled, the train has stopped
- the cord was pulled, the train has stopped which led into teaching conditionals (Rowlett).
- Algorithms for everyday activities (make a cup of tea, put on a t-shirt), in pairs with one partner pedantically picking holes in the other’s algorithm. (Rowlett).
- Coursework: long list of tightly specified functions for implementation (\(x \mapsto (x^2+3)/(x-4)\) with error handling, cartesians to polars, is this integer abundant,…). Students find functions surprisingly hard. (Rowlett)
- Graphics project: join (0,1) to (10,0), (0,2) to (9,0),…
- Individual projects ideas: a programme solving a math problem and a html page explaining the mathematical content, how it works, and a critical evaluation. Topic ideas: numerical methods, NetworkX, cellular automata, league tables and tournament scheduling, neural nets for the MNIST dataset, genetic algorithms e.g. for tic-tac-toe, fractals, brute force number theory, calculation of \(\pi\).
- James Denholm-Price talked about NoobLab (created by Paul Neve) and Kingston’s Carol (a version of Karel).
- Vincent Knight talked about the difference between teacing for growth
and for proficiency. They use Anaconda, Jupyter notebooks, and
github pages. He mentioned the utility of
pip install --user
on centrally-managed machines (it’s no use on UCL’s computers, though). - Computing for mathematics - notes and notebooks, all on the web (using github pages and MathJax for maths).
- Project idea: rock-paper-scissors bot.
- Students aren’t good at resizing windows and putting applications side-by-side.
- Matthew Jones mainly talked about more advanced programming issues: APIs, design patterns, version control. The context was groups of up to 20 students - much smaller than my Python course will be.
- Good sources of algorithm problems: http://leetcode.com, https://www.codewars.com/, https://www.topcoder.com/, https://coderbyte.com/ (Jones)
- Stephen Lynch told us about how much they use Matlab at Manchester Met (there is a low-programming path for people who really hate it, but a huge majority of courses use it). Even in introductory linear algebra students implement what they are doing in Matlab. MMU pays £42k pa for a site license.
- Chris Sangwin (STACK author) talked about CodeRunner, a moodle question type plugin for assessing code fragments.
- Edinburgh saked incoming maths freshers the longest programme they’d ever written. The modal answer is 0.
- In 2016 every year 7 student in the UK was given a micro:bit. Those year 7s will be in our universities in a few years. (Chris handed one round, they’re really cool)
- CS has ~13% female UGs, maths ~40%.
- Edinburgh now has a fully online calculus course.
Solution to the programming puzzle
Compute and store the forward and backward partial products
\[a_1,\ a_1a_2,\ \ldots,\ a_1a_2\cdots a_{N-2}a_{N-1}\] \[a_N,\ a_{N-1}a_{N},\ \ldots,\ a_2 a_{3}\cdots a_{N-1} a_N\]which costs \(2(N-2)\) multiplications and produces the first and last elements of the output. Discard these, then walk forwards through the first list and backwards through the second multiplying corresponding elements together to give the other output elements, costing a further \(N-2\) multiplications making \(3(N-2)\) in total. Space complexity is clearly \(O(N)\) too.
There was a further challenge to do it in \(O(1)\) space.