One response is to point people to The Princeton Companion to Applied Mathematics. Its 186 articles contains a large number of examples of how applied mathematics is put to work in fields such as sport, engineering, economics, physics, biology, computer science, and finance.

Another way to convince people of the value of applied mathematics is to get them to watch the 1-minute SIAM video below. It was constructed from interviews conducted at a variety of SIAM conferences and comprises snippets of 25 mathematicians saying what they use mathematics for.

Well done to Karthika Swamy Cohen and Michelle Montgomery at SIAM, Adam Bauser and his team at Bauser Media Group, and Sonja Stark at PilotGirl Productions, for producing this great advertisement for applied mathematics!

]]>

This article is aimed at relatively new users. It is written particularly for my own students, with the aim of helping them to avoid making common errors. The article exists in two forms: this WordPress blog post and a PDF file generated by , both produced from the same Emacs Org file. Since WordPress does not handle very well I recommend reading the PDF version.

In a new paragraph is started by leaving a blank line.

Do not start a new paragraph by using `\\`

(it merely terminates a line). Indeed you should almost never type `\\`

, except within environments such as `array`

, `tabular`

, and so on.

Always type mathematics in math mode (as `$..$`

or `\(..\)`

), to produce “” instead of “y = f(x)”, and “the dimension ” instead of “the dimension n”. For displayed equations use `$$`

, `\[..\]`

, or one of the display environments (see Section 7).

Punctuation should appear outside math mode, for inline equations, otherwise the spacing will be incorrect. Here is an example.

- Correct:
`The variables $x$, $y$, and $z$ satisfy $x^2 + y^2 = z^2$.`

- Incorrect:
`The variables $x,$ $y,$ and $z$ satisfy $x^2 + y^2 = z^2.$`

For displayed equations, punctuation should appear as part of the display. All equations *must* be punctuated, as they are part of a sentence.

Mathematical functions should be typeset in roman font. This is done automatically for the many standard mathematical functions that supports, such as `\sin`

, `\tan`

, `\exp`

, `\max`

, etc.

If the function you need is not built into , create your own. The easiest way to do this is to use the `amsmath`

package and type, for example,

\usepackage{amsmath} ... % In the preamble. \DeclareMathOperator{\diag}{diag} \DeclareMathOperator{\inert}{Inertia}

Alternatively, if you are not using the `amsmath`

package you can type

\def\diag{\mathop{\mathrm{diag}}}

Ellipses (dots) are never explicitly typed as “…”. Instead they are typed as `\dots`

for baseline dots, as in `$x_1,x_2,\dots,x_n$`

(giving ) or as `\cdots`

for vertically centered dots, as in `$x_1 + x_2 + \cdots + x_n$`

(giving ).

Type `$i$th`

instead of `$i'th$`

or `$i^{th}$`

. (For some subtle aspects of the use of ellipses, see How To Typeset an Ellipsis in a Mathematical Expression.)

Avoid using `\frac`

to produce stacked fractions in the text. Write flops instead of flops.

For “much less than”, type `\ll`

, giving , not `<<`

, which gives . Similarly, “much greater than” is typed as `\gg`

, giving . If you are using angle brackets to denote an inner product use `\langle`

and `\rangle`

:

- incorrect: <x,y>, typed as
`$<x,y>$`

. - correct: , typed as
`$\langle x,y \rangle$`

When a displayed equation contains text such as “subject to ”, instead of putting the text in `\mathrm`

put the text in an `\mbox`

, as in `\mbox{subject to $x \ge 0$}`

. Note that `\mbox`

switches out of math mode, and this has the advantage of ensuring the correct spacing between words. If you are using the amsmath package you can use the `\text`

command instead of `\mbox`

.

$$ \min\{\, \|A-X\|_F: \mbox{$X$ is a correlation matrix} \,\}. $$

Produce your bibliographies using BibTeX, creating your own bib file. Note three important points.

- “Export citation” options on journal websites rarely produce perfect bib entries. More often than not the entry has an improperly cased title, an incomplete or incorrectly accented author name, improperly typeset maths in the title, or some other error, so always check and improve the entry.
- If you wish to cite one of my papers download the latest version of
`njhigham.bib`

(along with`strings.bib`

supplied with it) and include it in your`\bibliography`

command. - Decide on a consistent format for your bib entry keys and stick to it. In the format used in the Numerical Linear Algebra group at Manchester a 2010 paper by Smith and Jones has key
`smjo10`

, a 1974 book by Aho, Hopcroft, and Ullman has key`ahu74`

, while a 1990 book by Smith has key`smit90`

.

There is no excuse for your writing to contain spelling errors, given the wide availability of spell checkers. You’ll need a spell checker that understands syntax.

There are also tools for checking syntax. One that comes with TeX Live is `lacheck`

, which describes itself as “a consistency checker for LaTeX documents”. Such a tool can point out possible syntax errors, or semantic errors such as unmatched parentheses, and warn of common mistakes.

has a left quotation mark, denoted here `\lq`

, and a right quotation mark, denoted here `\rq`

, typed as the single left and right quotes on the keyboard, respectively. A left or right double quotation mark is produced by typing two single quotes of the appropriate type. The double quotation mark always itself produces the same as two right quotation marks. Example: is typed as `\lq\lq hello \rq\rq`

.

Captions go *above* tables but *below* figures. So put the `caption`

command at the start of a `table`

environment but at the end of a `figure`

environment. The `\label`

statement should go after the `\caption`

statement (or it can be put inside it), otherwise references to that label will refer to the subsection in which the label appears rather than the figure or table.

makes it easy to put many rules, some of them double, in and around a table, using `\cline`

, `\hline`

, and the `|`

column formatting symbol. However, it is good style to minimize the number of rules. A common task for journal copy editors is to remove rules from tables in submitted manuscripts.

source code should be laid out so that it is readable, in order to aid editing and debugging, to help you to understand the code when you return to it after a break, and to aid collaborative writing. Readability means that logical structure should be apparent, in the same way as when indentation is used in writing a computer program. In particular, it is is a good idea to start new sentences on new lines, which makes it easier to cut and paste them during editing, and also makes a diff of two versions of the file more readable.

Good:

$$ U(\zbar) = U(-z) = \begin{cases} -U(z), & z\in D, \\ -U(z)-1, & \mbox{otherwise}. \end{cases} $$

Bad:

$$U(\zbar) = U(-z) = \begin{cases}-U(z), & z\in D, \\ -U(z)-1, & \mbox{otherwise}. \end{cases}$$

For displayed equations occupying more than one line it is best to use the environments provided by the amsmath package. Of these, `align`

(and `align*`

if equation numbers are not wanted) is the one I use almost all the time. Example:

\begin{align*} \cos(A) &= I - \frac{A^2}{2!} + \frac{A^4}{4!} + \cdots,\\ \sin(A) &= A - \frac{A^3}{3!} + \frac{A^5}{5!} - \cdots, \end{align*}

Others, such as `gather`

and `aligned`

, are occasionally needed.

Avoid using the standard environment `eqnarray`

, because it doesn’t produce as good results as the amsmath environments, nor is it as versatile. For more details see the article Avoid Eqnarray.

This final category concerns synonyms and is a matter of personal preference. I prefer `\ge`

and `\le`

to the equivalent `\geq`

`\leq\`

(why type the extra characters?).

I also prefer to use `$..$`

for math mode instead of `\(..\)`

and `$$..$$`

for display math mode instead of `\[..\]`

. My preferences are the original syntax, while the alternatives were introduced by . The slashed forms are obviously easier to parse, but this is one case where I prefer to stick with tradition. If dollar signs are good enough for Don Knuth, they are good enough for me!

I don’t think many people use ‘s verbose

\begin{math}..\end{math}

or

\begin{displaymath}..\end{displaymath}

Also note that `\begin{equation*}..\end{equation*}`

(for unnumbered equations) exists in the amsmath package but not in in itself.

]]>

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 and , 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 and in the context of groups, but both were ungainly and difficult to typeset. In 1928, Hensel suggested the notation and . 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.

]]>

A table with one leg shorter than the others wobbles, as may one sitting on an uneven floor, and how to cure wobbly tables has been the subject of a number of papers over the years. The tongue-in cheek article

Hanspeter Kraft, The Wobbly Garden Table, Journal of Biological Physics and Chemistry 1, 95-96, 2001

describes how an engineer, a physicist, and a mathematician would go about solving the problem. The engineer would invent an adjustable leg. The physicist would submit a research proposal to tackle the more general problem of “the stability of multiply-legged objects on rough surfaces”. The mathematician would construct an argument based on the intermediate value theorem to show that stability can be restored with a suitable rotation of no more than 90 degrees. This argument has been discussed by several authors, but turning it into a mathematically precise statement with appropriate assumptions on the table and the ground on which it rests is not easy.

The two most recent contributions to this topic that I am aware of are

A. Martin, On the Stability of Four-Legged Tables, Physics Letters A, 360, 495-500, 2007

Bill Baritompa, Rainer Löwen, Burkard Polster, and Marty Ross, Mathematical Table Turning Revisited, arXiv:math/0511490v1, 17 pp., 2008

In the latter paper it is shown that if the ground on which a rectangular table rests slopes by less than 35.36 degrees and the legs of the table are at least half as long as its diagonals then the rotation trick works.

For more insight into this problem you may like to watch the video below in which Matthias Kreck explains the problem with the aid of some excellent animations.

]]>

Color is a fascinating subject. Important early contributions to our understanding of it came from physicists and mathematicians such as Newton, Young, Grassmann, Maxwell, and Helmholtz. Today, the science of color measurement and description is well established and we rely on it in our daily lives, from when we view images on a computer screen to when we order paint, wallpaper, or a car, of a specified color.

For practical purposes color space, as perceived by humans, is three-dimensional, because our retinas have three different types of cones, which have peak sensitivities at wavelengths corresponding roughly to red, green, and blue. It’s therefore possible to use linear algebra in three dimensions to analyze various aspects of color.

A good example of the use of linear algebra is to understand *metamerism*, which is the phenomenon whereby two objects can appear to have the same color but are actually giving off light having different spectral decompositions. This is something we are usually unaware of, but it is welcome in that color output systems (such as televisions and computer monitors) rely on it.

Mathematically, the response of the cones on the retina to light can be modeled as a matrix-vector product , where is a 3-by- matrix and is an -vector that contains samples of the spectral distribution of the light hitting the retina. The parameter is a discretization parameter that is typically about 80 in practice. Metamerism corresponds to the fact that is possible for different vectors and . This equation is equivalent to saying that for a nonzero vector , or, in other words, that a matrix with fewer rows than columns has a nontrivial null space.

Metamerism is not always welcome. If you have ever printed your photographs on an inkjet printer you may have observed that a print that looked fine when viewed indoors under tungsten lighting can have a color cast when viewed in daylight.

In digital imaging the term *channel* refers to the grayscale image representing the values of the pixels in one of the coordinates, most often R, G, or B (for red, green, and blue) in an RGB image. It is sometimes said that an image has *ten channels*. The number ten is arrived at by combining coordinates from the representation of an image in three different color spaces. RGB supplies three channels, a space called LAB (pronounced “ell-A-B”) provides another three channels, and the last four channels are from CMYK (cyan, magenta, yellow, black), the color space in which all printing is done.

LAB is a rather esoteric color space that separates luminosity (or lightness, the L coordinate) from color (the A and B coordinates). In recent years photographers have realized that LAB can be very useful for image manipulations, allowing certain things to be done much more easily than in RGB. This usage is an example of a technique used all the time by mathematicians: if we can’t solve a problem in a given form then we transform it into another representation of the problem that we can solve.

As an example of the power of LAB space, consider this image of aeroplanes at Schiphol airport.

Suppose that KLM are considering changing their livery from blue to pink. How can the image be edited to illustrate how the new livery would look? “Painting in” the new color over the old using the brush tool in image editing software would be a painstaking task (note the many windows to paint around and the darker blue in the shadow area under the tail). The next image was produced in just a few seconds.

How was it done? The image was converted from RGB to LAB space (which is a nonlinear transformation) and then the coordinates of the A channel were replaced by their negatives. Why did this work? The A channel represents color on a green–magenta axis (and the B channel on a blue–yellow axis). Apart from the blue fuselage, most pixels have a small A component, so reversing the sign of this component doesn’t make much difference to them. But for the blue, which has a negative A component, this flipping of the A channel adds just enough magenta to make the planes pink.

You may recall from earlier this year the infamous photo of a dress that generated a huge amount of interest on the web because some viewers perceived the dress as being blue and black while others saw it as white and gold. A recent paper What Can We Learn from a Dress with Ambiguous Colors? analyzes both the photo and the original dress using LAB coordinates. One reason for using LAB in this context is its device independence, which contrasts with RGB, for which the coordinates have no universally agreed meaning.

My article Color Spaces and Digital Imaging in The Princeton Companion to Applied Mathematics gives an introduction to the mathematics of color and the representation and manipulation of digital images. In particular, it emphasizes the role of linear algebra in modeling color and gives more detail on LAB space.

I have one update to the article. Since the book went to press a second edition of the book that I cite by Dan Margulis, *Photoshop LAB Color: The Canyon Conundrum And Other Adventures In The Most Powerful Colorspace*, has appeared (amazon.com and amazon.co.uk). I do not yet have the book but it appears to have a number of improvements on the excellent first edition.

Finally, in the article I mention the problem of finding good color maps and the problems with the commonly used rainbow color map. For a nicely illustrated talk on this topic see Perceptual Color Maps in matplotlib for Oceanography given at SciPy 2015 by Kristen Thyng.

]]>

The amount of terror that lives in a speaker’s stomach when giving a lecture is proportional to the square of the amount he doesn’t know about his audience.

Knuth’s point is about preparation, and it brings to mind the words of Benjamin Franklin, “By failing to prepare, you are preparing to fail”.

It’s essential to find out as much as possible about your audience, not just so that you feel more confident, but also so that what you deliver is appropriate for that audience.

As academics we are used to giving seminars and conference talks for which we know that the audience will be made up of peers, and we usually just need to ascertain where to aim the talk on the axes general researcher–specialist and graduate student–experienced researcher.

For any other talk it is important to go to some effort to find out who will be in the audience, perhaps asking for a list of attendees if the event requires registration. For an after-dinner talk you may want to know whether certain key people who you are thinking of mentioning will be in the audience. For a talk to a general audience you will want to assess the base level of technical knowledge that can be assumed.

Keep these thoughts in mind when that sought-after invitation to give a “TED talk” arrives in your mailbox.

]]>

Anderson’s original paper is from 1965 and is well cited, as Google Scholar shows: I learned about Anderson acceleration in the minisymposium Anderson Acceleration and Applications organized by Tim Kelley at the SIAM Conference on Computational Science and Engineering in Salt Lake City in March 2015. Tim gave an excellent overview of the topic in the opening talk. The slides for that talk are available on Tim’s website.

PhD student Nataša Strabić and I have shown that Anderson acceleration works very well for speeding up the alternating projections method for computing the nearest correlation matrix. It typically gives a reduction in the number of iterations by a factor at least 2 for the standard nearest correlation matrix problem and by at least a factor 3 when additional constraints are imposed on the matrix (specified elements fixed and a lower bound on the smallest eigenvalue). In some cases the reduction is by a factor of as much as 25. Since the overhead of Anderson acceleration is small, significant speedups are obtained.

In my 2013 post The Nearest Correlation Matrix I included a MATLAB code `nearcorr.m`

. In place of this I now recommend our new accelerated code `nearcorr_aa.m`

, which is available from the repository anderson-accel-ncm on GitHub. Our paper describing this work is available on MIMS EPrints.

For me this project is an excellent illustration of the importance of going to conferences in order to learn of new ideas and new developments.

]]>

Over the coming months I will produce a variety of posts on this blog about the book. The book also has a Twitter feed, @ThePCAM, which will contain relevant news and links.

What does *The Companion* do? Briefly, it

- introduces applied mathematics and its history, and explains what applied mathematicians do,
- describes key concepts and equations, functions, and laws,
- describes the main areas of current research,
- presents a selection of mathematical modelling problems,
- gives short examples of applied mathematics problems,
- describes applications at the interface with other areas, and
- covers general aspects of writing, teaching and promoting mathematics.

Here are some statistics:

Pages | xvii + 994 + 16 color plates |

Articles | 186 |

Authors | 165 from 23 countries |

Figures | 196 monochrome + 23 colour |

Cross references | 751 |

Index | 2842 entries over 33 pages |

The target audience for *The Companion* is mathematicians at undergraduate level or above, students, researchers, and professionals in other subjects who use mathematics, and mathematically interested lay readers. Some articles will also be accessible to students studying mathematics at pre-university level.

The book was edited by me and associate editors

- Mark Dennis (University of Bristol)
- Paul Glendinning (University of Manchester)
- Paul Martin (Colorado School of Mines)
- Fadil Santosa (University of Minnesota, Minneapolis)
- Jared Tanner (University of Oxford)

Copy editing, typesetting, and project management were done by Sam Clark (T&T Productions, London), and the indexer was Julie Shawvan. The Princeton University Press editors were Anne Savarese and Vickie Kearn. For an interview with Vickie, see The Science of Loving Math.

*The Companion* already has pages on amazon.com and amazon.co.uk from which it can be pre-ordered, and it is in the Fall 2015 PUP catalogue (page 62).

Here is a word cloud for the book, generated using Wordle (also available in a high resolution PDF version):

]]>

Since 2009 the meeting has been hosted at the University of Strathclyde. The Conference Organizing Committee of Philip Knight, John Mackenzie, and Alison Ramage have introduced various innovations, such as minisymposia and, this year, Scottish country dancing (optional!). This year also saw the introduction of the *Fletcher-Powell Lecture*, honouring Mike Powell (who sadly passed away earlier this year) and Roger Fletcher, given by Michael Saunders (Stanford). In his introduction to the lecture, Nick Gould emphasized the crucial role that Fletcher and Powell played in developing the field of nonlinear optimization, starting in the 1960s. A Storify is available summarizing tweets about the conference.

An excellent history of the conference was written by Alistair Watson in 2006 and is available on his website. Alistair’s article was invaluable in preparing my after-dinner speech. The conference dinner was held in the impressive Òran Mór, a converted church in the west end of Glasgow. The dining area is seen in the photo below, from the vantage point of a balcony.

]]>

My past use of Emacs had mainly been to send emails or edit web pages, often over a terminal connection, and I had not realized how fast Emacs was—nor that one could issue commands by typing Alt- instead of the two consecutive keys Esc .

Since 2011 I have used Emacs exclusively and have built up my dot emacs to its current size of nearly 3000 lines. For non-Emacs users, a dot emacs (.emacs) file is an Emacs Lisp file that is read and executed when Emacs loads, and it is where one sets customizations and loads packages.

I have now made my dot emacs file available on Github.

A few notes:

- Some of the code uses conditional tests to see whether Emacs is running on a Windows machine or a Mac machine and take different action in each case.
- The code is lightly documented with links to sources for the things I am using.
- I have recently started using John Wiegley’s use-package for loading packages. Not everything is converted and I may convert other package to load this way. Use-package has several advantages:
- It makes the dot emacs more readable.
- It makes it easy to disable a package, by adding a line “:disabled t”.
- It speeds up the loading of Emacs by delaying loading of packages until they are first used. When I first started using use-package my Emacs load time dropped from 8 seconds to 5 seconds.

- I do not use the Emacs package manager, but rather download packages manually and place them in ~/dropbox/elisp. The one exception is the Helm package, which I was unable to install manually.
- I spend most of my time in Emacs in org-mode, latex-mode, or bibtex-mode, so quite a lot of my dot emacs concerns those modes.
- I recently started using Oleh Krehel’s hydra package, which was released at the start of the year. It provides a nice way to set up key bindings based on a prefix key and provides a reminder at the bottom of the screen about possible subsequent keypresses.

You should not expect to be able to take my dot emacs and use it as is, because many of the packages that are loaded will not be present on your system in the expected location. However, the main benefit of sharing Emacs configurations is that one can copy and adapt pieces of code.

My dot emacs is long, and I have trouble remembering all the features I have set up, even though I have an even longer emacs.org file that contains notes and a summary of my customized keypresses.

I still use TSE Pro: to edit my dot emacs file when an error introduced therein causes Emacs to fail to start properly! (Of course, I could also use `emacs -q`

, which inhibits loading of the `.emacs`

, but I like to keep my hand in with TSE Pro).

]]>