Pencil charts for visualising colours

As a result of a discussion with a photographer friend of mine, I’ve been thinking (not for the first time) about visualising the colour palette of images. Consider this sunset, for example (a picture I took in Adelaide 8 years ago):

The photograph is rich in yellow and orange. However, the apparent blue in the sky is actually grey, and the apparent grey of the sea is actually brown. If we postulate a standard set of 35 plausible pencil colours, and map each pixel to the closest-matching pencil colour, we get this (I have done the comparison in RGB space):

Then we can visualise the colour palette of the image by showing the wear on the virtual pencils, if each virtual pencil has been used to colour the corresponding pixels. It can be seen that a lot of orange, brown, and grey was used (click to zoom):

Conversely, this beach scene (photographed in Vanuatu in 2016) is rich in blues:

The warm light greys of the beach don’t quite find an exact match among the pencils, but the other colours match fairly well:

And here is the pencil visualisation (click to zoom):

If, rather than using a standard set of colours, we extract the pencil colours from the image itself (image quantisation), fewer pencils will, of course, be required:

The fit to the original image will be much closer as well:

So this is a trick to remember for another day – pencil visualisations!


Solar Car Racing Status Check

In solar car racing news, preparations are beginning for the SASOL Solar Challenge in South Africa (September 22 to 30). It seems that both Nuon and Tokai will attend this event, along with local teams.

Nuon at WSC 2017 (photo: Anthony Dekker)

Thirteen teams have registered so far for the 24 hour iLumen European Solar Challenge in Belgium (September 19 to 23), and Twente will be defending their title there. I am maintaining an information page and teams list for this race. See also the official iESC social media at  

Twente at WSC 2017 (photo: Anthony Dekker)

The American Solar Challenge is a lot closer than those two races, with scrutineering beginning on July 6, track racing on July 10, and the road race running from July 14 to July 22. I am maintaining a detailed information page and teams list for this race. At last count, 34 teams were registered, with Anderson, UCSD, Principia, UC Irvine, Phoenix, and UT Austin having, sadly, dropped out.

Six teams are attending with cars that raced at WSC 2017, although these cars will require adjustment to satisfy ASC rules (Michigan, Western Sydney, Principia, and Illini, plus the Cruisers PrISUm and Minnesota). Six other teams are attending with cars that previously raced at ASC.

PrISUm at WSC 2017 (photo: Anthony Dekker)

Twenty-two other teams are frantically building cars for ASC. Car unveils that have been announced include team 42 (Missouri) on 18 April, team 55 (Esteban) on 23 April, team 101 (Eclipse) in mid May, team 828 (AppState) in mid June, and team 65 (Calgary) on 16 June.

Missouri’s unfinished car (picture credit)

See my detailed information page and teams list for this race for more information and for social media links. I will continue to update that page as news comes in.

The Sand Reckoner

In his short work The Sand Reckoner, Archimedes (c. 287 BC – c. 212 BC) identifies a number larger than what he believed was the number of grains of sand which would fit into the Universe. He was hampered by the fact that the largest number-word he knew was myriad (10,000), so that he had to invent his own notation for large numbers (I will use modern scientific notation instead).

Archimedes’ began with poppyseeds, which he estimated were at least 0.5 mm in diameter (using modern terminology), and which would contain at most 10,000 grains of sand. This makes the volume of a sand-grain at least 6.5×10−15 cubic metres (in fact, even fine sand-grains have a volume at least 10 times that).

Archimedes estimated the diameter of the sphere containing the fixed stars (yellow in the diagram below) as about 2 light-years or 2×1016 metres (we now know that even the closest star is about 4 light-years away). This makes the volume of the sphere 4×1048 cubic metres which means, as Archimedes shows, that less than 1063 grains of sand will fit.

A more modern figure for the diameter of the observable universe is 93 billion light-years, which means that less than 1095 grains of sand would fit. For atoms packed closely together (as in ordinary matter), less than 10110 atoms would fit. For neutrons packed closely together (as in a neutron star), less than 10126 neutrons would fit. But these are still puny numbers compared to, say, 277,232,917 − 1, the largest known prime!

Religious knowledge in the United States

Part of the US religious landscape. Clockwise from top left: Evangelical Protestant, Mainline Protestant, Jewish, Catholic, Other Christian, Other

Readers of this blog know that I really love social statistics, and among the masters of that field are the people at Pew Forum. Back in 2010, they ran an interesting survey of religious knowledge. A simple 15-question version of the survey can be found online [if you want to try it, do so now, since this post has spoilers]. A total of 3,412 adults were interviewed (in English and Spanish). The focus of the survey was on the religious knowledge of different religious groups in the United States:

I was a little frustrated with the survey, since it mixed religion, history, and politics, with questions at quite different levels – ranging from “Where was Jesus born?” (multiple choice: Bethlehem, Jericho, Jerusalem, or Nazareth) to “What religion was Maimonides?” There was, however, an interesting subset of five easy questions about the Hebrew Bible (Old Testament), which Christians and Jews have in common, and I decided to do my own analysis of these questions:

  1. What is the first book of the Bible? (Genesis/Bereishit)
  2. Which of the following is NOT one of the Ten Commandments? (Do unto others as you would have them do unto you)
  3. Which Bible figure is most closely associated with remaining obedient to God despite suffering? (Job)
  4. Which Bible figure is most closely associated with leading the exodus from Egypt? (Moses)
  5. Which Bible figure is most closely associated with willingness to sacrifice his son for God? (Abraham)

Since these questions are closely related and of similar difficulty, it makes sense to add them together. Notice also that Pew’s interviewers were instructed to accept both English and Hebrew answers to (a). The last four questions were multiple-choice, with “Do not commit adultery,” “Do not steal,” and “Keep the Sabbath holy” the other options for (b), and with Job, Elijah, Moses, and Abraham the options for (c) to (e). I would expect a bright child in Sunday School to get 5 out of 5 on these questions, and just guessing should average around 1 out of 5.

Which Bible figure is most closely associated with leading the exodus from Egypt?

Answers to these questions in fact depended quite substantially on education level, and this complicates analysis, because average education level in the US itself varies between religious groups. I coded education numerically as follows:

  • Level 0: No High School (grades 1 to 8)
  • Level 1: Partial High School (grades 9 to 11)
  • Level 2: High School graduate
  • Level 3: High School Plus: technical, trade, vocational, or college education after High School, but less than a 4-year college degree
  • Level 4: College (university) graduate with 4-year degree
  • Level 5: Post-graduate training

The chart below shows the 11 religious groups I looked at, and their average (mean) education level. Note that Jews are the best-educated (presumably for cultural reasons), followed by Atheists/Agnostics (possibly because many people in the US become Atheists/Agnostics while at university). The lowest average education levels were for Other Protestants (which includes Black Protestants) and for Hispanic Catholics. Each coloured bar has an “error range,” which is the 95% confidence interval (calculated using bootstrapping). Religious groups with overlapping error ranges can’t really be distinguished statistically:

I “chunked” these education levels into two groups: less-educated (0 to 2, everything up to a High School diploma) and more-educated (3 to 5, everything beyond a High School diploma, be it trade school or a PhD). The chart below shows the average number of correct answers for the five questions, by religious group / education group combination. Each religious group has two coloured bars, the first (marked with +) being for the more-educated subgroup, and the second for the less-educated subgroup:

The more-educated group gets more questions right (on average, 3.4 compared to 2.3), and within both education groups, there is a similar ordering of religious groups:

  • Mormons do best (4.5 or 3.4 questions right, depending on education subgroup).
  • White Evangelical Protestants come next (4.0 or 3.1). Both Mormons and Evangelicals put great weight on Bible study, so this makes sense.
  • Then comes a group of three with similar results: Jews, Other Protestants (including Black Protestants), and Atheists/Agnostics. Orthodox Jews put great weight on studying the Torah, but many Jews in the US are in fact fairly secular. More interesting is the high score for Atheists and Agnostics – they do seem to have some knowledge of the beliefs they are rejecting (Atheists and Agnostics also scored highest on the complete survey).
  • Then comes a group of five: Other Christians, Unknown/Other, White (non-Hispanic) Catholics, White Mainline Protestants, and Unaffiliated (“nothing in particular”). Notice that White Mainline Protestants (ABCUSA, UMC, ELCA, PCUSA, UCC, RCA, Episcopal, etc.) get about one question less right (3.1 or 2.1) than their Evangelical counterparts, reflecting less of an emphasis on the Bible in mainline denominations.
  • The lowest scores were for Hispanic Catholics (2.7 or 1.5 questions right, depending on education subgroup). Given that guessing gives an average score of 1, this suggests that many Hispanic Catholics in the US have a rather tenuous link to their faith (many of them appear to strengthen this connection by becoming Protestants).

Thus if the Hebrew Bible (Old Testament) is a religious meeting place, it is a meeting place between Mormons, Evangelical Protestants, Jews, and (ironically) Atheists and Agnostics.

It is also interesting to see what happens when we add two simple questions about the New Testament – “Where was Jesus born?” and “Tell me the names of the first four books of the New Testament of the Bible, that is the Four Gospels?” Not surprisingly, Jews now do worse, since the New Testament applies specifically to Christianity. Atheists and Agnostics also do a little worse – apparently they know a little less about the New Testament than about the Old. In spite of the interviews being conducted in English and Spanish, Hispanic Catholics continued to do poorly, with less-educated Jews and Hispanic Catholics providing the wrong answer to “Where was Jesus born?” more than half the time.

Starting an element collection

In the spirit of the wonderful photobook The Elements by Theodore Gray (which I have previously blogged about), starting a collection of elements is a great way of introducing yourself (or your children) to basic chemistry. Here are some suggestions, and a list of 24 elements to start with….

2: Helium (He)

Helium is lighter than air, so balloons are often filled with helium.

6: Carbon (C)

Carbon is most easily added to your collection in the form of charcoal. Zinc–carbon batteries have a carbon rod at the centre.

7: Nitrogen (N)

Air is about 78% nitrogen. To add nitrogen to your collection, just fill a small bottle with air.

8: Oxygen (O)

Air is about 21% oxygen. To add oxygen to your collection, just fill a small bottle with air.

9: Fluorine (F)

Fluorine is a toxic gas. But octahedral fluorite crystals (calcium fluoride, CaF2) make a great addition to a collection.

11: Sodium (Na)

Sodium is a reactive metal which will spontaneously catch fire when in contact with water. But sodium chloride (ordinary table salt, NaCl) is perfectly safe.

12: Magnesium (Mg)

Magnesium is a flammable metal, but you can substitute crystals of Epsom salts (magnesium sulfate, MgSO4), which can be obtained from a pharmacy.

13: Aluminium (Al)

Aluminium (aluminum in the USA) is most easily available as aluminium foil.

14: Silicon (Si)

Silicon is widely used in transistors and integrated circuits (chips).

15: Phosphorus (P)

The side of a box of matches is largely composed of phosphorus.

16: Sulfur (S)

Sulfur powder, also called “flowers of sulfur,” is available from pharmacies.

17: Chlorine (Cl)

Chlorine is a toxic yellowish-green gas. But sodium chloride (ordinary table salt, NaCl) is perfectly safe.

20: Calcium (Ca)

Calcium is a reactive metal, but you can substitute crystals of calcite (calcium carbonate, CaCO3) or gypsum (calcium sulfate, CaSO4).

24: Chromium (Cr)

Chromium is used for plating (“chrome plating”) to prevent rusting. Also, “stainless steel” is between about 16% and 25% chromium.

26: Iron (Fe)

Iron is one of the most widely used metals. Iron nails are easy to add to your collection. Like nickel and cobalt, iron is attracted by a magnet.

28: Nickel (Ni)

The United States “nickel” coin is actually only 25% nickel (and 75% copper), but objects made of pure nickel can be found. Indeed, Canadian “nickel” coins from 1955–1981 are almost pure nickel.

29: Copper (Cu)

Copper pipes are widely used in plumbing. You can buy copper plumbing fittings, or get offcuts of pipe from a plumber. Copper electrical wire is also easy to find.

30: Zinc (Zn)

Galvanised iron is coated with zinc to prevent rusting. Also, filing off the copper coating on a US penny reveals a coin made mostly of zinc.

47: Silver (Ag)

A silver coin, or a piece of silver jewellery, would make a fine addition to your collection.

53: Iodine (I)

Iodine is a dark solid, but is sold in pharmacies as a brown solution in alcohol, called “tincture of iodine.”

60: Neodymium (Nd)

Neodymium is one of the “rare earth” elements. Neodymium magnets are the most common form of strong magnet. They are made of an alloy of neodymium, iron and boron (Nd2Fe14B).

74: Tungsten (W )

The filament in an incandescent light bulb is made from tungsten (but because of the danger of broken glass, only an adult should attempt to remove the filament, and then only with very great care).

79: Gold (Au)

A gold coin, or a piece of gold jewellery, would make a truly wonderful addition to your collection. Alternatively, for under $10, science museums will sell impressive-looking bottles of gold leaf floating in liquid.

82: Lead (Pb)

A fishing sinker is probably the easiest lead object to find.

So there you are. Those could be the first 24 elements in your collection!