# Mathematics in BBC BASIC on RISC OS

###### Introduction

“Essential Maths” was a book covering the programming of mathematics concepts like Trigonometry. The book was published thirty five years ago for owners of the BBC and Electron computers – remember those? The writer, Czes Kosniowski, wouldn’t be surprised to know that the principles are as relevant today as they were when he wrote it. Did you know for instance that in a ‘prime sequence’ the only even number is two?

###### Contents

As well as Trigonometry the book covers:

- Powers, square roots, imaginary numbers, quadratic equations, exponential/ logarithmic functions
- Sequences
- Number Bases
- Greatest Common Divisor
- Primes
- Odd and Evens
- Matrices
- Encoding/Decoding

###### Interesting facts

In the days of the BBC Micro, processors were so slow that repetitive calculations took
a significant amount of time to perform, and therefore code was added to programs to inform the user what was going on. Nowadays, processors are so quick it is irrelevant to include. The section on Primes contain code that could take typically three minutes for a BBC Micro computer to complete the calculations, but with modern hardware like the Raspberry Pi, most calculations, to all intense and purposes, are instantaneous. The **Multi-precision powers** program (Chapter 10) is one of the few that slowed my Raspberry Pi down and only when the number of powers reached was astronomical.

The book contains a fascinating program using several sine/cosine rules to calculate the shortest distance between two points on the Earth.

###### The programs

All the programs run quite happily using ARM machines like the Raspberry Pi and ARMX6 because they are all written in BBC BASIC, the RISC OS version of which is highly compatible with the versions on the BBC Micro and Acorn Electron. Some slight changes to the COLOUR statements may be necessary to see information text/results clearly against a black screen, due to the differences in graphics capabilities and, importantly, the colour palettes between the hardware from the old and modern eras.

###### Mathematical rules

Reference is made to Newton’s method, Geometric sequence/progression, the Fibonacci sequence, Zellar’s formula (also known as Zellar’s congruence), Euclidean algorithm, the Sieve of Eratosthenes, and others. Don’t be put off by the oft-quoted mathematical rules. Much mathematics is dependent on them.

###### Conclusion

Be aware that there are some mistakes in the text but despite this there is no doubt the book is an excellent resource. Even if you are not a mathematician or a programmer you are certain to find reading the book and running the programs will add significantly to your knowledge.

Note: The limited research I’ve done indicates the author may be the same lecturer who taught ‘algebraic topology’ at the University of Newcastle-upon-Tyne, and who has also published a number of mathematics-themed programming books for other platforms, as well as one on solving the Rubik’s Cube, and some on the subject of Carlton Ware pottery.

###### Book Supplier

Due to the age of the book it is highly unlikely to be available through current publishing companies. However Chris Dewhurst of Drag ’n Drop fame has published it in the form of a CD-ROM. Essential Maths is amongst the volumes published on the 55 BBC Micro Books disc, which is superb value at £12.00, plus £1.00 for postage and packing. Order it from the Drag ‘n Drop website.