Review: “APL for the Maths Classroom” by Thomson
Vector 6:2, page 20
Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 20
This review has to be personal. In Brookhaven, New York, I had just inscribed a birthday present, “Recipes in Mathematics” (in C) for my son and heir with the words: “APL must be able to do it better!” He works for IBM and has a Macintosh. I returned from Long Island in August to find Norman Thomson’s book waiting for review. It has been done for the High School!
I’m a physics teacher, who first had APL up and running on the BBC Master 128 only a few weeks before going on holiday to the USA. Long enough to get through Linda Alvord and Norman Thomson’s Tutorial and be very impressed with the language’s possibilities. (I have taught BASIC and am still enthusiastic about Forth.) The ease of getting a polynomial best-fit equation had me singing!
Last year I bought a second-hand book on “Short cuts in Arithmetic”, purely for a 3D diagram illustrating the expansion of (a + b)³. I found it had interesting checks of adding and multiplying by casting out 9s (or 11s), converting yards to miles, pounds to tons (a peculiar APL function), division by continued fractions, decimal fractions and “circulating” decimals, using (x + a)², (x-a)² & (x-a)(x + a), (a + b)² + (a-b)² = 2(a² + b²), (a + b)²-(a-b)² = 4ab for quick calculations.
Elegance and Variety¶
My point here is that Norman Thomson has provided functions, conveniently available, to play about with these short cuts. You might say “Why bother? You have APL to do any calculation!” But I’m thinking of Richard Feynman’s love of playing with numbers …. calculating e, recurrent decimals (1÷7 = ), logs of certain numbers, squares, roots, cube roots, tangents, integrating 1÷(1 + x⁴).
Chapter 2: Arithmetic and Numbers¶
This chapter gives square and triangular numbers and numbers which are both square and triangular and which have their last three digits equal to the number … yet stops short and leaves cubes (sums of consecutive cubes (from 1 up) are the squares of triangular numbers), hexagonal and octagonal numbers to the teacher.
Primes, factors, HCF & LCM, recurring decimals, we’ve mentioned. Number bases avoid hex or higher bases. Roman numerals remind me of the complicated BASIC program for conversion. A dip into encoding and decoding. Casting out nines. Precision of computer numbers. Complex numbers.
Chapter 3: Algebra and Sets¶
This includes (a² - b²), (a + b)², a² + b², expansion of (ax + by)(cx + dy), roots of quadratics - BASIC or Pascal just don’t have a look in! Then matrix operations, determinants, evaluating polynomials, adding and multiplying and differentiating and integrating polynomials. Arithmetic and geometric progressions. I suspend judgement on sets until I can try APL with digital electronics examples.
Chapter 4: Series
Chapter 5: Formulae and Tables¶
From Chapter 5 a teacher might choose to introduce compound interest as a problem (repayment every half/whole year …. who earns more?) or use the formula to introduce e and eˣ (which are in the previous chapter on series). Chapter 4 also has an interesting collection of series relating to pi (which reminds me to mention the interesting collection of derivations for random numbers later). Recurrence relations, convergence, Pascal’s triangle, successive differences of series, Fibonacci numbers, root of 2, trig series, continued fractions, interpolations. Area of a triangle, given the sides, but not area = (a² tanB tanC)/2(tanB + tanC) or area = (ac sinB)/2. Interesting applications of sin and cos formulae. The longest/shortest journeys and Pythagorean theorems.
Chapter 8: Probability and Statistics¶
This chapter must be useful to the APL Statistics Group. I need to use averages and standard deviations - to convert test scores to the same average and standard deviation. I don’t see the function but no problem! there’s enough to go on. My classes already print out best fit line graphs with a BASIC program but now they will be able do do a polynomial fit (s=ut+(1(2at²))).
Chapter 9: Combinatorics¶
Combinatorics is permutations and combinations, derangements, selections, compositions and partitions, Latin and magic squares. Appendix 2 supplies idioms & utilities, including matrix multiplication, bit manipulation, string handling.
Magic Squares
Chapter 10: Games and Miscellaneous¶
In Port Jefferson, Long Island, I bought a second-hand copy of Rouse-Ball’s “Mathematical Recreations” and in many of the explanations I could see how APL could be used beneficially - e.g. with magic squares. Norman Thomson gives a function for a magic square of odd order. No explanations. A breakdown will show the steps, hint at a general solution, but it is a start to enlarging the enquiry. We ask “How do you add diagonals?” The answer comes quickly. Does everyone do it that way?
The games (whist hand, mastermind, life, tower of Hanoi, Optical illusions) are a tiny introduction to the marvellous possibilities.
Appendix 1: Graphics and Chapter 6: Geometry and Pattern¶
The graphics appendix describes a number of primitive graphics functions, so that, if a package is not available, one can be put together from these and the machine’s facilities. “An exposition of mathematics is greatly enhanced by a display of results.” Geometry and Pattern uses parametric plotting and the conic sections, epi/hypo-cycloids and astroid are plotted using envelopes. Rotation in 2D and 3D and perspective drawing are followed by co-ordinate geometry equations, polar and cartesian co-ordinates.
Summary¶
Norman Thomson’s book is an “ideas” book of short programs for bringing into the classroom …. “ with a degree of idiosyncrasy in the choice of topics - algorithms that have proved useful in real_work or have caught his imagination as a candidate for demonstrating the value of APL as a mathematical notation.” To be fully comprehensive can be dull. It seems that someone might have said, “How about a set of programs in BASIC for maths pupils?” and Norman replied “Much better in APL. More concise. More elegant. More for your money!”
There is an excellent index of topics and an index of programs and variables (280 of them).