Mathematics in action: affine transformations and PostScript

Here’s the next in the mathematics in action series.

An important group of geometric transformations are the affine transformations, such as translations, reflections, and rotations. They are defined by a combination of a matrix multiplication and a translation:

Such transformations are an important part of the PostScript page description language. For example, the PostScript code below, after the initial header, specifies a black letter F, and another in blue, translated by (50, 50):

%%BoundingBox: 0 0 196 118
%%Pages: 0
%%DocumentFonts: Times-Roman
%%DocumentNeededFonts: Times-Roman
%%Orientation: Portrait
gsave newpath 100 dict begin /Times-Roman findfont 50 scalefont setfont

gsave 0 setgray 0 0 moveto (F) show grestore

gsave 0 0 1 setrgbcolor 50 50 translate 0 0 moveto (F) show grestore

The output is included in this picture:

But of course that is using only the (ef) part of the transformation. More interesting is a rotation through an angle θ, where the matrix is:

PostScript allows this to be specified using a translation and a rotation angle in degrees (red F) or as an (abcdef) matrix which combines the rotation matrix with a (180, 0) translation (grey F):

gsave 1 0 0 setrgbcolor 100 0 translate 30 rotate 0 0 moveto (F) show grestore

gsave 0.5 setgray 30 [0.8660 0.5 -0.5 0.8660 180 0] concat 0 0 moveto (F) show grestore

A diagonal matrix provides scaling in the x and y directions, with negative scaling factors giving a reflection. Again, PostScript allows the scaling factors to be provided directly (green F), or as an (abcdef) matrix (brown F):

gsave 0 0.7 0 setrgbcolor 100 100 translate -2 0.5 scale 0 0 moveto (F) show grestore

gsave 0.5 0.3 0 setrgbcolor [-2 0 0 0.5 175 75] concat 0 0 moveto (F) show grestore

end grestore showpage

Copying and pasting the three blocks of PostScript into a text file with a .EPS extension will give the coloured image above, which can be viewed by printing it, or by inserting it into a Microsoft Word document. Experimentation with other, more complex, affine transformations is easy that way.

The Bunsen burner

The Bunsen burner was invented in 1855 by the German chemist Robert Bunsen at the University of Heidelberg, assisted by Peter Desaga, an instrument maker there. Bunsen wanted a device that could produce heat without light, unlike the gas flames used for lighting at the time.

Bunsen was particularly interested in using the burner to identify elements by the colour of the flame they produced (or, more precisely, to identify elements by their emission spectrum). The image above shows the flames produced by placing salts of lithium, sodium, potassium, and copper in the flame of a Bunsen burner, for example. The image below shows the corresponding emission spectra (from top to bottom: Li, Na, K, Cu).


Rainbows are one of the most frequently observed atmospheric phenomena, although double rainbows can still get a strong reaction.

Rainbows form when light is refracted and reflected in droplets of water from rain (or some other source) as shown below. The light emerges at angles of up to 42°, so that the primary rainbow forms a circular halo around the antisolar point, at an angle of 42° from it. For the secondary rainbow, light enters the droplet from below and is internally reflected twice, emerging at angles of 51° or more, thus forming a larger halo (with reversed colours) around the antisolar point.

No light is refracted into the region between the primary and secondary rainbow, and this dark region (shown below in a photo by L.T. Hunter) is called Alexander’s band, after Alexander of Aphrodisias, who first discussed it in around 200 AD, in his commentary on Aristotle’s Meteorology.

Great Maps: a book to look out for

Great Maps by Jerry Brotton (August 2014)

Here is another beautifully illustrated book to look out for: Great Maps (by Jerry Brotton), from Dorling Kindersley and the Smithsonian. I have no review, but Wired reports some of the wonderful and historic maps in the book.

The book appears very well designed, combining large two-page spreads, such as the one below, with detailed “zoomed in” images of particular map features. I’m certainly on the lookout for a copy!

Tear down the Wall!

November 9 marks the 25th anniversary of the fall of the Berlin Wall (see photo above by J. Dykstra). In the sciences, the reunification which followed saw both winners and losers. Some scientific institutes in the former East Germany folded, while others thrived. Some Easterners made career changes – Angela Merkel, the current Chancellor of Germany, was a physical chemist in the East, for example.

In a 1993 article in Science, Bernhard Sabel draws five lessons from the German experience:

  1. Science should not be assessed by the political leanings of its practitioners;
  2. Scientists and science students should participate freely in international exchange;
  3. Large-scale research institutions have not proven beneficial;
  4. Reintegration of science from research institutions back into universities strengthens both teaching and research; and
  5. Good will from West Germany and the wider international community was essential to German scientific reunification.

I recall that, as a young scientist, one society I belonged to encouraged Western members to pay the membership fee of one person in the Soviet Bloc. The resulting international exchanges were indeed beneficial to both sides.

I’ll leave the last word to Pink Floyd, who first commented on the Wall in 1979, and who performed live in Berlin eight months after the Wall fell:

The price of coffee

The price of coffee is going up, as a result of drought in Brazil and a fungal disease of coffee plants. Prices hit US$2.23 per pound last month (for Colombian Mild Arabica). Of course, droughts and disease are perennial features of the coffee industry, and prices have oscillated for decades (see the chart above, in which the dashed red line shows the “Fairtrade” floor price). Of course these prices are for “commodity” coffee – quality coffee sells at auction for twenty times the commodity price. For farmers, quality coffee is where the money is. And for lovers of coffee – really, why would we drink anything else?

Coffea arabica plant

The race that stops a nation

The first Tuesday in November marks the Melbourne Cup, Australia’s most famous horse race. The race was first held in 1861 (over 2 miles) and altered to cover 3.2 km in 1972. The chart below shows winning times since then.

But Melbourne Cup Day often sees another big race too: the Tuesday after the first Monday in November is US Election Day. This year, it promises to be significant, with the entire US House of Representatives up for grabs, along with 33 Senate seats and numerous state positions. It will be interesting to see who wins this year!

Update: The Australian race was won by Protectionist in 3:17.71. The race was marred by the death of the race favourite, Admire Rakti. The American race is still to be decided.