# Mathematics in BBC BASIC on RISC OS

Comments Off on 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.