Typewriter Art

In 1981 my mother showed me a magazine (Woman’s Realm) that had instructions for producing on a typewriter a portrait of Prince Charles. The instructions had been designed by Bob Neill, who had worked out how represent a photograph of Prince Charles as a 100-by-79 grid of characters, choosing the density of each character appropriately and exploiting the facility of a typewriter to issue a carriage return without line feed and thereby overwrite one character with another. The instructions looked like

(6) 26G 16@ 1& 36G
(6a) 22sp 2. 1: 95 1& 15 1& 3S 2& 3: 1.

which say that on the 6th line you should type the letter G 26 times followed by 16 @ symbols, etc., then overwrite the line with 22 spaces, 2 full stops, etc.

prince-charles-portrait.jpg

This is an example of ASCII art, though ASCII art does not usually involve overwriting characters.

At the time I had a Commodore Pet microcomputer and it struck me that the painstaking process of typing the image would be better turned into a computer program. Once written and debugged the program could be used to print multiple copies of the image. By switching the data set the program could be used to print other photos. So I wrote a program in Commodore Basic that printed the image to a Commodore 4022 dot matrix printer.

I sent the program to Bob. He liked it and printed the program in an appendix to his 1982 book Bob Neill’s Book of Typewriter Art (With Special Computer Programme). That book contains instructions for typing 20 different images, including other members of the royal family, Elvis Presley and Telly Savalas (the actor who played Kojak in the TV series of the same name, which was popular at the time), and various animals,. Bob Neill’s Second Book of Typewriter Art was published in 1984, which reprinted my original program. It included further celebrities such as Adam Ant, Benny from Crossroads, “J.R.” from Dallas and Barry Manilow

I recently came across some articles describing Bob’s work, including one by his daughter, Barbara, one by Lori Emerson that includes a PDF scan of the first book, and an article The Lost Ancestors of ASCII Art. The latter pointed me to a recently published book Typewriter Art: A Modern Anthology. This resurgence of interest in typewriter art prompted me to look again at my code.

I had revisited my original 1982 Basic code later in the 1980s, converting it to GW-Basic so it would run on IBM PCs with Epson printers. I had also added the data for The Tabby Cat from Bob’s second book. Here is an extract from the code, complete with GOTOs and GOSUBs (GW-Basic had few structured programming features).

10 REM TYPEART.BAS
20 REM Program by Nick Higham 1982 (Commodore Basic),
30 REM and 1988 (GW-Basic/Turbo Basic).  (c) N.J. Higham 1982, 1988.
40 REM Designs by Bob Neill.  (c) A.R. Neill 1982, 1984.
...
530 REM -----------------------------
540 REM ROUTINE TO PRINT OUT DATABASE
550 REM -----------------------------
560 DEV$ = "LPT"+PP$+":"
570 OPEN DEV$ FOR  OUTPUT AS #1
580 PRINT #1, RESET.CODE$
590 WIDTH #1,255 ' this stops basic inserting unwanted carriage returns
600 GOSUB  800
610 L$=""
620 GOSUB 700:IF A$="/" THEN PRINT#1, NORMAL.LFEED$+L$: GOTO 610
630 IF A$="-" THEN PRINT#1, ZERO.LFEED$;L$: GOTO 610
640 A=ASC(A$):IF A>47 AND A<58 THEN A=A-48: GOTO 660
650 L$=L$+A$: GOTO 620
660 GOSUB 700:B=ASC(A$):IF B>47 AND B<58 THEN A=10*A+B-48: GOSUB 700
670 FOR I=1 TO A:L$=L$+A$:NEXT: GOTO 620
680 '
690 REM -- SUBROUTINE TO TAKE NEXT CHARACTER FROM Z$
700 A$=MID$(Z$,P,1):P=P+1: IF A$<>" "  AND A$<>"" THEN 730
710 IF P>Z THEN GOSUB 800
720 GOTO 700
730 IF A$="]" THEN A$=" "
740 IF A$="#" THEN A$=CHR$(34)
750 IF A$="^" THEN A$=":"
760 IF P>Z THEN GOSUB 800
770 RETURN
780 '
790 REM -- SUBROUTINE TO READ NEXT LUMP OF DATA
800 READ Z$:Z=LEN(Z$):P=1
810 IF Z$="PAUSE" THEN  FOR D=1 TO 20000:NEXT: GOTO 800
820 IF Z$="FINISH" THEN PRINT #1, CHR$(12)+RESET.CODE$: CLOSE #1:END
830 RETURN
840 '
850 REM -------------------------------------
860 REM * DATABASE1 - H.R.H. PRINCE CHARLES *
870 REM -------------------------------------
880 '
890 DATA "H.R.H. Prince Charles"
900 DATA  79G/79G/79G/79G
910 DATA  /79G-25]2.2^2&^L2^2&3^2.
920 DATA /26G16@&36G-22]2.^9]&S&3S2&3^.
930 DATA /22G23@34G-20].^10&]3&^6Y2C&^.
...
4710 '
4720 REM -- EXPLANATION OF DATA --
4730 REM / MEANS NEWLINE
4740 REM - MEANS CONTINUATION LINE
4750 REM 29G MEANS PRINT 29 LETTER G'S.
4760 REM @ MEANS PRINT ONE @ CHARACTER.
4770 REM CHARACTERS : " AND 'SPACE'
4780 REM ARE REPRESENTED BY ^ # AND ]
4790 REM IN THE DATA STATEMENTS.
4800 REM ALL OTHER CHARACTERS ARE
4810 REM PRINTED OUT AS THEMSELVES.

The full code is available, along with documentation.

Like typewriters, dot matrix printers could carry out a carriage return without line feed. Today’s inkjet and laser printers cannot do that. I pose a challenge:

convert the program to a modern language (MATLAB or Python are natural choices) and modify it to render the images in some appropriate format.

800000-01.jpg

References

  • A. R. Neill. Bob Neill’s Book of Typewriter Art (With Special Computer Programme). The Weavers Press, 4 Weavers Cottages, Goudhurst, Kent, 1982, 176 pp. ISBN 0 946017 01 8.
  • A. R. Neill. Bob Neill’s Second Book of Typewriter Art. The Weavers Press, 4 Weavers Cottages, Goudhurst, Kent, 1984. ISBN 0 946017 02 6.
Posted in software | Tagged , | 1 Comment

James Joseph Sylvester (1814–1897) Bicentenary

This year (or more precisely September 3, 2014) is the bicentenary of the birth of James Joseph Sylvester, FRS, a prolific 19th century mathematician who led an eventful life, holding positions at five academic institutions, two of them in the USA.

sylvester.jpg

My article Sylvester’s Influence on Applied Mathematics published in the August 2014 issue of Mathematics Today explains how Sylvester’s work continues to have a strong influence on mathematics. A version of the article with an extended bibliography containing additional historical references is available as a MIMS EPrint.

In the article I discuss how

  • Many mathematical terms coined by Sylvester are still in use today, such as the words “matrix” and “Jacobian”.
  • The Sylvester equation AX + XB = C and the quadratic matrix equation AX^2 + BX + C = 0 that he studied have many modern applications and are the subject of ongoing research.
  • Sylvester’s law of inertia, as taught in undergraduate linear algebra courses, continues to be a useful tool.
  • Sylvester gave the first definition of a function of a matrix, the study of which has in recent years has become a very active area of research.
  • Sylvester’s resultant matrix, which provides information about the common roots of two polynomials, has important applications in computational geometry and symbolic algebra.

Sylvester’s collected works, totalling almost 3000 pages, are freely available online and are well worth perusing: Volume 1, Volume 2, Volume 3, Volume 4.

In a subsequent post I will write about Sylvester’s life.

Posted in people | Tagged | Leave a comment

David Broomhead (1950–2014)

David Broomhead passed away on July 24th, 2014 after a long illness. David was a Professor of Applied Mathematics in the School of Mathematics at the University of Manchester. I got to know him in 2004 when the Victoria University of Manchester merged with UMIST and the two mathematics departments, his at UMIST and mine at VUM, became one.

080630-1614-10-3476-cropped.jpg

David was a truly interdisciplinary mathematician and led the CICADA (Centre for Interdisciplinary Computational and Dynamical Analysis) project (2007-2011), a £3M centre funded by the University of Manchester and EPSRC, which explored new mathematical and computational methods for analyzing hybrid systems and asynchronous systems and developed adaptive control methods for these systems. The centre involved academics from the Schools of Mathematics, Computer Science, and Electrical and Electronic Engineering, along with four PhD students and six postdocs, all brought together by David’s inspirational leadership.

One of the legacies of CICADA is the burgeoning activity in Tropical Mathematics, which straddles the pure and applied mathematics groups in Manchester, and whose weekly seminars David managed to attend regularly until shortly before his death. Indeed one of David’s last papers is his Algebraic approach to time borrowing (2013), with Steve Furber and Marianne Johnson, which uses max-plus algebra to study an algorithmic approach to time borrowing in digital hardware.

Among the other things that David pioneered in the School, two stand out for me. First, he ran one of the EPSRC creativity workshop pilots in 2010 under the Creativity@Home banner, for the CICADA project team. The report from that workshop contains a limerick, which I remember David composing and reading out on the first morning:

One who works on Project CICADA
Has to be a conceptual trader
Who needs the theory of Morse
To tap into the Force -
A mathematically driven Darth Vader!

The workshop was influential in guiding the subsequent activities of CICADA and its success encouraged me to organize two further creativity workshops, for the numerical analysis group and for the EPSRC NA-HPC Network.

101103-1804-12-0158-cropped.jpg

At the CICADA Creativity Workshop, November 2010.

The second idea that David introduced to the School was the role of a technology translator. He had organized (with David Abrahams) a European Study Group with Industry in Manchester in 2005 and saw first-hand the important role played by technology translators in providing two-way communication between mathematicians and industry. David secured funding from the University’s EPSRC Knowledge Transfer Account and combined this with CICADA funds to create a technology translator post in the School of Mathematics. That role was very successful and the holder (Dr Geoff Evatt) is now a permanent lecturer in the School.

I’ve touched on just a few of David’s many contributions. I am sure other tributes to David will appear, and I will try to keep a record at the end of this post.

Photo credits: Nick Higham (1), Dennis Sherwood (2).

Updates

Posted in people | Tagged , , | Leave a comment

Creativity Workshop for EPSRC NA-HPC Network

The EPSRC Network Numerical Algorithms and High Performance Computing, coordinated by David Silvester and me, came to the end of its three-year term in May 2014. One of our final activities was a two-day Creativity Workshop, held at Chicheley Hall just before Easter.

140416-1850-58-0780-Edit.jpg

The workshop was advertised to network members and we were able to accept all applicants. The 23 attendees comprised PhD students, postdoctoral researchers, faculty, and HPC support experts from Cambridge University, the University of Edinburgh, Imperial College, The University of Manchester, MIT, NAG Ltd., Queens University Belfast, STFC-RAL, UCL, and the University of Tennessee at Knoxville, along with an EPSRC representative.

The workshop was facilitated by creativity expert Dennis Sherwood. I explained the idea of these workshops in an earlier post about a creativity workshop we held for the Manchester Numerical Analysis Group last year. The procedure is for the attendees to work in groups tackling important questions using a structured approach that encourages innovative ideas to be generated and carefully assessed and developed. The key ingredients are

  • a group of enthusiastic people,
  • careful planning to produce a set of nontrivial questions that address the workshop goals and are of interest to the attendees,
  • a willingness to adapt the schedule based on how the workshop progresses.
140416-1143-11-0766.jpg

Dennis Sherwood talking about innovation and idea generation.

The workshop was targeted at researchers working at the interface between numerical analysis and high performance computing. The aims were to share ideas and experiences, make progress on research problems, and identify topics for research proposals and new collaborations.

The topics addressed by the groups were sensitivity in sparse matrix computations; programming languages; deployability, maintainability and reliability of software; fault-resilient numerical algorithms; and “16th April 2019″.

The notes for the last topic began “It’s 16th April 2019, and we’re celebrating the success of our network. What is it, precisely, that is so successful? And what was it about the decisions we took five years ago, in 2014, that, with hindsight, were so important?”. The discussion led to a number of ideas for taking the activities of the network forward over the coming years. These include

  • organizing summer schools,
  • producing a register of members’ interests and areas of expertise,
  • exploiting opportunities for co-design across communities such as algorithm designers, NA specialists and domain scientists, and
  • creating opportunities targeted at early career members of the network.

As an ice-breaker and a way of the participants getting to know each other everyone was asked to prepare a flip chart containing a summary of their key attributes, why they were attending, and something they have done that they feel particularly good about. These were presented throughout the two days.

140417-1648-04-0049.jpg

Presenting my “Who I Am”, with Post-its behind me containing ideas written down by participants during the workshop.

Dennis Sherwood has produced a 166-page report that distills and organizes the ideas generated during the workshop. Attendees will find this very useful as a reminder of the event and of the various actions that resulted from it.

The Venue

140417-0737-16-4240-Edit.jpg

Chicheley Hall, is a historic country house located near Milton Keynes. It was purchased a few years go by the Royal Society, who turned it into a hotel and conference center, and it houses the Kavli Royal Society International Centre. It’s a terrific place to hold a small workshop. The main house and its meeting rooms have a wonderful ambience, the 80-acre grounds (complete with lake and dinosaur sculpture) are a delight to walk around, and each of the 48 bedrooms is named after a famous scientist.

140416-1236-23-4066.jpg

140416-1819-09-4147.jpg

Photo credits: Nick Higham (1,2,4,5,6), Dennis Sherwood (3).

Addendum (July 29, 2014)

Posted in conferences | Tagged | Leave a comment

Videos of Lectures from Gene Golub SIAM Summer School 2013

Videos of lectures given by four of the five lecturers at the 2013 Gene Golub SIAM summer school at Fudan University in Shanghai are now available on the summer school website.

These include the five 2-hour lectures from my course on Functions of Matrices. Here is a summary of the contents of my lectures, with direct links to the videos hosted on YouTube.

IMG_2444.JPG

  • Lecture 1: History, definitions and some applications of matrix functions. Quiz.
  • Lecture 2: Properties, more applications, Fréchet derivative, and condition number.
  • Lecture 3: Exponential integrator application. Problem classification. Methods for f(A): Schur-Parlett method, iterative methods for sign function and matrix square root.
  • Lecture 4: Convergence and stability of iterative methods for sign function and square root. The f(A)b problem. Software for matrix functions.
  • Lecture 5: The method of Al-Mohy and Higham (2011) for the \exp(A)b problem. Discussion of how to do research, reproducible research, workflow.

A written summary of the course is available as Matrix Functions: A Short Course (MIMS EPrint 2013.73).

The video team, visible in the photo below that I took of my audience, have done a great job. The music over the opening sequence is reminiscent of the theme from the film Titanic!

130722-0829-58-2448.jpg

As a reminder, other relevant links are

Posted in conferences | Tagged | Leave a comment

My Mac Setup

I came to Macs quite late, switching to Mac laptops in 2009 because of the quality of the hardware. Over the last year I have taken my 13-inch MacBook Pro Retina to China, the USA and Europe. With the World Travel Adapter Kit to allow hassle-free power connections, this is the ultimate machine for travelling.

I still use Windows desktop machines, but switching between Mac and Windows machines is easy nowadays thanks to three things: almost all the software that I use runs on both systems, Dropbox allows easy sharing of files between machines, and Windows and Mac OS X have converged so as to have very similar features and capabilities.

131006-1050-58-6084.jpg

Most of my core applications are open source: Emacs, Firefox, Thunderbird, Git for version control, Cyberduck (for ftp and ssh), and TeX Live. Mac-specific software includes iTerm2 (a replacement for Terminal), Path Finder (an enhanced Finder), Skim (PDF viewer) and Witch (app-switcher, Cmd-tab replacement). And for numerical and symbolic computation I use MATLAB.

A password manager is essential nowadays. I use 1Password, which runs on all my Apple hardware and Windows, and I sync it via Dropbox.

On the iPhone a couple of free apps are proving very useful. MapsWithMe gives offline maps downloadable by country, and since it only needs a GPS signal it’s great for finding where you are while on a train, or in a foreign country. As long as I have the iPhone in my pocket, Moves is good at counting my number of steps per day, which is sadly all too low, and records my time spent travelling. It also has the handy feature of showing on a map where you have been, which is useful if you are lost and want to retrace your steps.

On my MacBook Pro I have File Vault turned on, so that the hard disk is encrypted. I’m impressed with how little overhead this creates with the Core i7 Ivy bridge chip and an SSD. I also like the way File Vault works with Find My Mac to trap thieves via the Guest account (as detailed in this article)!

I continue to use Windows desktop machines. Two particular reasons are that I have not found Mac programs that match the functionality of Xyplorer (file manager) and Fineprint (printer driver), which I use many times every day.

This post is a modified version of an article titled “My Setup” that appeared in MacUser magazine, November 2013, page 126.

Posted in software | Tagged , | Leave a comment

400 Years of Logarithms

The logarithm was first presented in John Napier’s 1614 book Mirifici Logarithmorum Canonis Descriptio (Description of the Wonderful Canon of Logarithms). Last week I was celebrating 400 years of logarithms at the Napier 400 workshop held at the ICMS in Edinburgh and organized by NAIS. The previous such celebrations had been in 1914 and, as one speaker remarked, it is nice to participate in an event held only once every 100 years.

This one-day workshop included talks by Mike Giles on computing logarithms and other special functions on GPUs, and Jacek Gondzio on the history of the logarithmic barrier function in linear and nonlinear optimization.

My interest is in the matrix logarithm. The earliest explicit occurrence that I am aware of is in an 1892 paper by Metzler On the Roots of Matrices, so we are only just into the second century of matrix logarithms.

140402-1631-24-111.jpg

Photo and Tweet by @DesHigham: “@nhigham introduced by Dugald Duncan at @ICMS_Edinburgh”.

In my talk The Matrix Logarithm: from Theory to Computation I explained how the inverse scaling and squaring (ISS) algorithm that we use today to compute the matrix logarithm is a direct analogue of the method Henry Briggs used to produce his 1624 tables Arithmetica Logarithmica, which give logarithms to the base 10 of the numbers 1–20,000 and 90,000–100,000 to 14 decimal places. Briggs’s impressive hand computations were done by using the formulas \log a = 2^k \log a^{1/2^k} and \log(1+x) \approx x to write \log_{10} a \approx 2^k \cdot \log_{10}e \cdot (a^{1/2^k} - 1). The ISS algorithm for the matrix case uses the same idea, with the square roots being matrix square roots, but approximates \log(1+x) at a matrix argument using Padé approximants, evaluated using a partial fraction expansion. The Fréchet derivative of the logarithm can be obtained by Fréchet differentiating the formulas used in the ISS algorithm. For details see Improved Inverse Scaling and Squaring Algorithms for the Matrix Logarithm (2012) and Computing the Fréchet Derivative of the Matrix Logarithm and Estimating the Condition Number (2013).

As well as the logarithm itself, various log-like functions are of interest nowadays. One is the unwinding function, discussed in my previous post. Another is the Lambert W function, defined as the solution W(z) of W(z) e^{W(z)} = Z. Its many applications include the solution of delay differential equations. Rob Corless and his colleagues produced a wonderful poster about the Lambert W function, which I have on my office wall. Cleve Moler has a recent blog post on the function.

A few years ago I wrote a paper with Rob, Hui Ding and David Jeffrey about the matrix Lambert W function: The solution of S exp(S) = A is not always the Lambert W function of A. We show that as a primary matrix function the Lambert W function does not yield all solutions to S \exp(S) = A, just as the primary logarithm does not yield all solutions to e^X = A. I am involved in some further work on the matrix Lambert W function and hope to have more to report in due course.

Posted in research | Tagged , , | Leave a comment