The One-Line Maze Program in MATLAB

A classic one-line program for the Commodore 64 microcomputer is

10 PRINT CHR$(205.5+RND(1)); GOTO 10

This is essentially what was printed in the section “Random Graphics” of the Commodore 64 User’s Guide (1982). The program prints a random maze that gradually builds up on-screen. The following video demonstrates it

I recently came across a 309-page book by Montfort et al. (MIT Press, 2013) dedicated to discussing this program from every conceivable angle. The book, which can be freely downloaded in PDF form, has as its title the program itself and was written by a team of ten authors with backgrounds in digital media, art, literature, and computer science. I found the book an interesting read, not least for the memories it brought back of my days programming the Commodore PET and Commodore 64 machines in the early 1980s (discussed in this post about the Commodore PET and this post about the Commodore 64). I suspect that never has so much been written about a single line of code!

Various translations of the program into other languages have been done, but I could not find a MATLAB version. Here, then, is my MATLAB offering, which takes advantage of the MATLAB char function’s ability to produce Unicode characters:

while 1, fprintf('%s\n',char(rand(1,80)+9585.5)); pause(.2), end

The pause command is not necessary but helps to slow the printing down, and the argument of pause may need adjusting for your computer.

Are there other interesting MATLAB one-liners? This one is from Mike Croucher:

x=[-2:.001:2]; plot(x,(sqrt(cos(x)).*cos(200*x)+sqrt(abs(x))-0.7).*(4-x.*x).^0.01)

And here is one to compute the Mandelbrot set, condensed from the code mandel in MATLAB Guide:

[x,y]=ndgrid(-1.5:5e-3:1.5); c=x+1i*y; z=c; for k=1:50, z=z.^2+c; end, contourf(x,y,abs(z)<1e6)

If you know any other good one-liners please put them in the comment box below.

Celebrating Charlie Van Loan

Charlie Van Loan, Joseph C. Ford Professor of Engineering in the Department of Computer Science at Cornell University, retires in summer 2016.

van_loan_linocut.jpg
Charles Van Loan. The Entertainer. By Henk van der Vorst (linocut 2010)

Charlie has been a huge inspiration to me and many others, not least through his book Matrix Computations, with Gene Golub, now in its fourth edition. I wrote about the book on the occasion of the publication of the fourth edition (2013) in this previous post.

Following his PhD at the University of Michigan, Charlie visited the Department of Mathematics at the University of Manchester in 1974–1975 as a Science Research Council Research Fellow. He wrote the department’s first Numerical Analysis Report as well as three more of the first ten reports, as explained in this post.

A 55-minute video interview with Charlie by his colleague Kavita Bala, recorded in 2015, is available at the Cornell University eCommons. In it, Charlie talks about his PhD, with Cleve Moler as advisor, life as a young Cornell faculty member, the “GVL” book, computer science education, and many other things.

van_loan_interview.jpg

A two-part minisymposium is being held in Charlie’s honor at the SIAM Annual Meeting in Boston, July 11-14, 2016, organized by David Bindel (Cornell University) and Ilse Ipsen (North Carolina State University). I will be speaking in the second part about Charlie’s work on the matrix exponential. The details are below. If you will be at the meeting come and join us. I hope to provides links to the slides after the event.

SIAM Annual Meeting 2016.
Numerical Linear and Multilinear Algebra: Celebrating Charlie Van Loan.
Wednesday, July 13

Part I: MS73, MS89: 10:30 AM – 12:30 PM. BCEC Room 254B. Abstracts

  • 10:30-10:55 Parallel Tucker-Based Compression for Regular Grid Data, Tamara G. Kolda, Sandia National Laboratories, USA
  • 11:00-11:25 Cancer Diagnostics and Prognostics from Comparative Spectral Decompositions of Patient-Matched Genomic Profiles, Orly Alter, University of Utah, USA
  • 11:30-11:55 Exploiting Structure in the Simulation of Super Carbon Nanotubes, Christian H. Bischof, Technische Universität Darmstadt, Germany
  • 12:00-12:25 A Revisit to the GEMM-Based Level 3 BLAS and Its Impact on High Performance Matrix Computations abstract Bo T. Kågström, Umeå University, Sweden

Part II: MS92, 4:00 PM – 6:00 PM. BCEC Room 254B. Abstracts

  • 4:00-4:25 Charlie Van Loan and the Matrix Exponential, Nicholas J. Higham, University of Manchester, United Kingdom
  • 4:30-4:55 Nineteen Dubious Ways to Compute the Zeros of a Polynomial, Cleve Moler, The MathWorks, Inc., USA
  • 5:00-5:25 The Efficient Computation of Dense Derivative Matrices in MATLAB Using ADMAT and Why Sparse Linear Solvers Can Help, Thomas F. Coleman, University of Waterloo, Canada
  • 5:30-5:55 On Rank-One Perturbations of a Rotation, Robert Schreiber, Hewlett-Packard Laboratories, USA

Acronymous Thoughts

According to the Concise Oxford English Dictionary (COD, 11th ed., 2004), “An acronym is a word formed from the initial letters of other words”. Here are some well-known examples.

  • AIDS: acquired immune deficiency syndrome,
  • laser: light amplification by stimulated emission of radiation,
  • radar: radio detection and ranging,
  • scuba: self-contained underwater breathing apparatus,
  • snafu: situation normal all fouled up,
  • sonar: sound navigation and ranging,
  • UNESCO: United Nations Educational, Scientific, and Cultural Organization,
  • WYSIWYG: what you see is what you get.

There is even a recursive acronym, GNU, standing for “GNU’s not Unix”.

ID-10096639.jpg
Image courtesy of smarnad at FreeDigitalPhotos.net.

On close inspection, the OED definition is imprecise in two respects. First, can we take more than one letter from each word? The definition doesn’t say, but the examples radar and sonar make it clear that we can. Second, do we have to take the initial letters from the words in their original order. This is clearly the accepted meaning. Merriam Webster’s Collegiate Dictionary (10th ed., 1993) provides a more precise definition that covers both points, by saying “formed from the initial letter or letters of each of the successive parts or major parts of a compound term”.

In common with many fields, applied mathematics has a lot of acronyms. It also has a good number of the most elegant of acronyms: those that take exactly one letter from each word, such as

  • BLAS: basic linear algebra subprograms,
  • DCT: discrete cosine transform,
  • FSAL: first same as last,
  • MIMO: multi-input multi-output,
  • NaN: not a number,
  • PDE: partial differential equation,
  • SIRK: singly-implicit Runge-Kutta,
  • SVD: singular value decomposition.

New acronyms are regularly formed in research papers. Non-native speakers are advised to be careful in doing so, as their constructions may have unsuspected meanings. The authors of this article in Chemical Communcations managed to get two exceptionally inappropriate acronyms into print, and one wonders how these escaped the referees and editor.

Another question left open by the definitions mentioned above is whether an acronym has to be pronounceable. The big Oxford English Dictionary (3rd ed., 2015) lists two meanings, which allow an acronym to be pronounceable or unpronounceable. The New York Times Manual of Style and Usage (5th ed., 2015) says “unless pronounced as a word, an abbreviation is not an acronym”, while the Style Guide of The Economist (11th ed., 2015) also requires pronounceability, as do various other references.

Apart from SIAM (Society for Industrial and Applied Mathematics), not many mathematics societies have pronounceable acronyms. In the “pronounced by letter” camp we have, for example,

  • AMS: American Mathematical Society
  • AWM: Association for Women in Mathematics
  • EMS: European Mathematical Society
  • IMA: Institute of Mathematics and its Applications
  • IMU: International Mathematical Union
  • LMS: London Mathematical Society
  • MAA: Mathematical Association of America
  • MPS: Mathematical Programming Society

SIAM’s founders chose well when they named the society in 1952! Indeed the letters S, I, A, M have proved popular, forming in a different order the acronyms of the more recent bodies SMAI (La Société de Mathématiques Appliquées et Industrielles) and AIMS (the African Institute for Mathematical Sciences).

A situation where (near) acronyms are particularly prevalent is in research proposals, where a catchy acronym in the title is often felt to be an advantage. I suspect that in many cases the title is chosen to fit the acronym. Indeed there is now a word to describe this practice. In 2015 the OED added the word backronym (first occurrence in 1983), which refers to “a contrived explanation of an existing word’s origin, positing it as an acronym”. One backronym is “SOS”; see Wikipedia and this article by John Cook for more examples.

The Acronym Finder website does a good job of finding the meaning of an acronym, often returning multiple results. For SIAM it produces 17 definitions, of which the “top hit” is the expected one—and at least one is rather unexpected!

Publication Peculiarities: More Examples

Here are some additions to previous posts in my Publication Peculiarities series.

As another meta-title, to add to those in Publication Peculiarities: Papers, I offer

D. S. Collens, Remark on remarks on Algorithm 48: Logarithm of a complex number, Comm. ACM, 7(8), 485, 1964

I have several new acknowledgements to add to those in Publication Peculiarities: Acknowledgements.

First is this thanks to the U.S. Immigration Service.

“B.J.H. would also like to thank the U.S. Immigration Service under the Bush administration, whose visa background security check forced her to spend two months (following an international conference) in a third country, free of routine obligations—it was during this time that the hypothesis presented herein was initially conjectured.”

from

Biyu He and Marcus Raichle, The fMRI Signal, Slow Cortical Potential and Consciousness, Trends in Cognitive Sciences, 13, 302-309, 2009

Paul Martin pointed out the acknowledgement

“We would like to thank Professor Patrick Browne for showing us, over a beer in McGonagall’s pub in Dundee, that a 50p coin is a set of constant width and hence the areas of the shadow projections of an obstacle do not uniquely determine the shape of an obstacle.”

in

D. Colton and B. D. Sleeman, Uniqueness Theorems for the Inverse Problem of Acoustic Scattering, IMA J. Appl. Math., 31, 253-259, 1983

Federico Poloni notes the

Unacknowledgements

This work is ostensibly supported by the the Italian Ministry of University and Research under the FIRB program, project RBIN047MH9-000. The Ministry however has not paid its dues and it is not known whether it will ever do.

in the paper

F. Chierichetti, S. Lattanzi and A. Panconesi, Rumour Spreading and Graph Conductance, 1657-1663, in Proceedings of the Twenty-first Annual {ACM–SIAM} Symposium on Discrete Algorithms, SIAM, 2010

Niall Madden pointed out

“Finally I would like to thank my daughter Lily for keeping me awake.”

in this arXiv paper.

Finally, a footnote on the first page of the paper

Andrew Hendry, Catherine Peichel, Blake Matthews, Janette Boughman and Patrik Nosil, Stickleback Research: The Now and the Next, Evolutionary Ecology Research, 15, 111-141, 2013

reads “Each author wishes the others had contributed more”.