10 FOR n=0 TO 255 20 PLOT n,88+80*SIN (n/128*PI) 30 NEXT n
It plots the mathematical function sin over a full turn. This little program was an inspiration to me. It was followed quickly by a program to plot cos, which looks very similar. The next one plotted points of the form (cos t, sin t) with t between -pi and pi, which looks like a circle.
It's no exaggeration to say that this program turned me on to mathematics.
At school at about the same time, we'd been going over sin and cos and tan, which were names for the ratios of the sides of right-angled triangles. I'd never seen anything so boring and pointless. There were all sorts of stupid rules for remembering which was which, and when some were supposed to be positive and negative. It was the dullest thing in the world.
And then suddenly it wasn't. SIN and COS were things I could use to draw circles on my computer screen. If I plotted (2*sin, cos), I could make ovals. It was all marvellous. It was obvious what SIN and COS were. They were the distances across and up from the centre of the circle as you were going round it.
Once you knew that, all the blether at school didn't just make sense, it was obvious. I couldn't understand why it had seemed hard. I still didn't see what it was for. But I was very interested in drawing things on my computer. And circles were a big part of that.
A bit later on, for a game, I used my computer to draw a cannonball as it flew. I figured that it would start off going right and up at a certain speed. After a tiny bit, it would have moved, but the speed it was moving up would have gone down a bit. I wrote a program to draw what happened as time went on. It turned out that it made a sort of arc shape like the underside of a bridge.
And a bit later, I worked out how it would change if instead of the cannonball always falling downwards, it always fell towards a certain point on the screen.
A bit later I was watching the moon go round the earth as the earth went round the sun.
When, about five years later, we got to projectiles and ballistics in A level maths, I already knew all the answers.
And when it came to orbital mechanics during my degree, I had a pretty good intuitive grasp.
And it turned out that sin and cos were pretty useful too.
The reason that I mention this is that 27 years ago, a twelve year old child with a new toy and a shiny orange paperback that told him how to use it could draw the graph of sin, and then play with the program to get more interesting programs.
Whereas now, in 2009, a forty year old professional computer programmer sitting in front of a box at least 1000 times more powerful with a screen one hundred times the size that can display millions of colours is having to google for how to do it. (I am trying to write a simulation of an imaginary diffusion equation.)
And answers are not easy to come by. One of the things that google offered up by way of answer was the ZX Spectrum manual. And childhood memories came flooding back.
And I wonder how the hell a modern twelve year old is supposed to write his orrery.
P.S. I posted this on hacker news and it got some interesting responses:
P.P.S. So I posted it on reddit too, where one answer was (in python)
>>> import turtle
And this led me to:
and (I hate to link to a ppt, but it's great)
Which answers my rhetorical question about as well as it could be answered!