Programming Languages: An Applied Mathematics View

prog-langs.jpg

A lot of applied mathematics relies on computation, whether symbolic or numeric, so many applied mathematicians need to program as part of their work. It was therefore natural to include an article on programming languages in The Princeton Companion to Applied Mathematics.

The article, which I wrote, has two main purposes. The first is to give a history of those programming languages relevant to applied mathematics. The first such language, and indeed the first high-level programming language, was Fortran (1957). The language was standardized in 1966 and it is still going strong, with the most recent standard published in 2008. Developments in programming languages show no sign of abating, with the introduction in recent years of new languages such as Scala (2003), Clojure (2007, a dialect of Lisp), and Julia (2012), as well as new standards for older languages such as C (2011) and C++ (2011).

The second purpose of the article is to discuss mathematical aspects of programming, including

  • notation (infix, prefix, reverse-Polish)
  • implementation of complex arithmetic
  • floating-point semantics
  • high-precision computations
  • types
  • complexity analysis of codes
  • structured programming
  • literate programming
  • domain-specific languages

One issue that I discuss is the mutually beneficial influences that mathematics and programming languages have had on each other. For example, the notation for the ceiling and floor functions that map a real number to the next larger or smaller integer, respectively, illustrated by \lceil 4.3 \rceil = 5 and \lfloor 4.3 \rfloor = 4, was first introduced in the programming language APL. The colon notation for array subscripting, A(i:j,r:s), used in Algol 68 and MATLAB, is now routinely used in linear algebra, in both equations and in pseudocode.

On the other hand, mathematics has influenced, or anticipated, syntax in programming languages. In the 1800s Cayley proposed two different notations to distinguish between the products AB^{-1} and B^{-1}A in the context of groups, but both were ungainly and difficult to typeset. In 1928, Hensel suggested the notation A/B and B\backslash A. Although his suggestion appears to have attracted little or no attention, it was was reinvented by Cleve Moler for MATLAB and is now a notation familiar to anyone who works in numerical linear algebra.

At the start of the article I include a figure containing the first program written for a stored-program computer, namely the highest factor routine that ran on the Manchester “Baby” on June 21, 1948. The program was by Tom Kilburn and is taken from Geoff Tootill‘s notebook. Tootill is still alive (aged 93), and he kindly gave permission for me to reproduce the image.

The article, which has the same title as this post, can be downloaded in pre-publication form as an EPrint.

This entry was posted in Princeton Companion. Bookmark the permalink.

One Response to Programming Languages: An Applied Mathematics View

  1. mikera7 says:

    Interesting that you mention APL – in fact Clojure has an array programming extension inspired by APL called core.matrix : there’s a presentation about it here: http://www.slideshare.net/mikeranderson/clojure-for-data-science-57724240

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s