At the beginning of July Stuart Price (@sxpmaths) blogged this post looking at A Level textbooks through the ages. I really enjoyed reading this, and was particularly drawn to a picture of a book that described computer programs written in Basic for use in the maths classroom. I was so keen to look at this that I straight away ordered a copy from Amazon and here it is:
The BBC Micro holds a special place in my heart as it is the first computer that I can remember using at Grove Primary School. I remember sitting at one in the BBC room and doing various things, including my first bit of programming in BASIC (I later had a fairly long hiatus before coming back to coding).
Having become used to modern computers you forget the limitations of older computers such as the BBC Micro. For example, at the beginning of the book some of these limitations are mentioned, such as the fact that the BBC Micro’s filing system can only cope with 31 filenames. I particularly like this quote from the introduction to the book
“The lack of ‘idiot-proofing’ means that they [the programs] may sometimes ‘crash’, but in these circumstances a consideration of why it went wrong may itself be very illuminating, This will usually be due to inaccuracies in computer floating-point arithmetic, the non-existence of solutions, or the singularities of functions, all of which children should be aware of.
I don’t know of many ‘children’ who have an understanding of floating-point arithmetic or the failure of certain numerical methods in the presence of singularities – it is even possible to get through some undergraduate numerics courses without really tackling these issues!
I am going to write a few posts over the summer looking at some of the programs in this book, with the odd modification (I’ve quite enjoyed doing a bit of Basic for the first time in over 20 years).
I first tried Program 1 from the book, which is a simple program to compute the first \(n\) triangke numbers, where \(n\) is an input from the user. This is shown on the screen shot below:
I then thought I would look at something a bit more complicated, and try plotting the graph of \( y = x^2 \). One thing that you don’t have to do with things like scaling the output explicitly to fit the graph onto the display when using Matlab or NumPy. Of course the BBC Micro and BBC Basic is not as sophisticated as this, and we are explicitly giving coordinates on the screen of where to colour a pixel – because of this osome scaling needs to be done. This explains the divide by a 400 on line 60 of the below code from the book.