Mathematics and Digital Photography

A few months ago I wrote a post Mathematics in Color, in which I discussed some mathematical aspects of color and showed how a simple change of basis from RGB color space to LAB color space can enable dramatic color changes to be done very easily.

Over the last decade most recent developments in digital imaging software such as Adobe Lightroom and Adobe Photoshop have been based on advanced mathematics, yet many of the most powerful and useful transformations that one can make to an image are based on elementary mathematics and have been possible since the early versions of the products. For example, with every click of the healing brush—which might, for example, be used to remove a stray piece of litter in a landscape or a skin imperfection in a portrait—Photoshop solves a partial differential equation. Yet global operations such as changes to colour and contrast can be done with commands (and in particular, masks) that amount to simple addition and multiplication operations.

I’ve just launched a new blog on photography and digital imaging in which one theme will be exploiting elementary mathematics in digital imaging. The first post shows how the much-used Clarity tool in Lightroom and Photoshop can be applied in a more effective way by taking what amounts to a componentwise linear combination of the images before and after Clarity has been applied.

Head over to the post Refined Use of the Clarity Tool in Photoshop to find out more.

Original (cropped) image.

With Clarity applied in blended fashion. Compare the water, clouds, and trees with the original.

Iterating MATLAB Commands

Some MATLAB commands can be “applied to themselves”. A good example is help help, which provides help on the help function. For what other functions fun is fun fun a legal statement that produces something interesting? Here are some examples (by no means an exhaustive list).

char char
demo demo
diary diary
doc doc
diff diff
double double
edit edit
error error
iskeyword iskeyword
length length
magic magic
max max
size size
sort sort
spy spy
unique unique
upper upper
warning warning
which which

Can you see why these are legal and guess what the effect of these calls will be? Search for “command-function duality” in the MATLAB help for some clues.

Are there any legal triple invocations? Yes, for example

and and and
char char char
isa isa isa
max max max

Indeed char can be iterated as many times as you like, but and and isa can be iterated three times but not twice.

If you think of additional interesting examples, please add them to the comments below.

Quotes on Applied Mathematics

Image courtesy of Stuart Miles at

In the 1000 or so pages of The Princeton Companion to Applied Mathematics the 165 authors offer insight, wisdom, and humour. Here is a selection of quotes from the book.

  • Gil Strang (page 939)

“Our subject is extremely large!”

  • David Tong (page 374)

“Classical mechanics is an ambitious subject. Its purpose is to predict the future and reconstruct the past, to determine the history of every particle in the universe.”

  • Heather Mendick (page 949)

“Jurassic Park, which … contains perhaps the only screen example of a `cool’ mathematician.”

  • Sergio Verdu (page 545)

“Authored in 1948 by Claude Shannon (1916–2001), `A mathematical theory of communication’ is the Magna Carta of the information age and information theory’s big bang.”

  • Ya-xiang Yuan (page 953)

“China … has a long tradition of mathematicians being well respected, and famous mathematicians are often put into high-ranking positions in government.”

  • Ian Stewart (page 912)

“Always wanted to write a book? Then do so. Just be aware of what you are letting yourself in for.”

Five Books on Applied Mathematics


The website Five Books consists of interviews with experts about their five favourite books in their subject. I was recently interviewed about my favourite popular applied mathematics books.

After making my original choice of books (ones that I use in my research) I realized that it was pitched at too high a level for a general audience. Identifying my revised choice was not easy, as I wanted to select books that contain a significant applied mathematics content, yet most books at the popular level are focused on pure mathematics.

I thought it would be good to include a book about equations. There are several such books, including It Must be Beautiful: Great Equations of Modern Science (2003) and The Great Equations: Breakthroughs in Science from Pythagoras to Heisenberg (2009). I chose Ian Stewart’s Seventeen Equations that Changed the World (2012), which has a strong applied mathematics slant.

After we did the interview, I saw an interview with Ian Stewart in Chalkdust magazine (a mathematics magazine produced by students at UCL), in which he said that the Seventeen Equations book is his favourite of all the books he’s written!

If you are wondering how to write a popular mathematics book, Ian gives some of the secrets in his article “How to Write a General Interest Mathematics Book” in The Princeton Companion to Applied Mathematics.

The complete set of Five Books interviews about mathematics is here.