Ivan Debono

A notebook of science, thoughts and reason

The Champernowne and Copeland-Erdős constants in Python

Python is a great tool. One of the best things about it, as anyone who’s used it will tell you, is the vast collection of useful libraries.

The mathematics libraries include a bewildering array of functions, but they were missing two important ones: the Champernowne constant, and the  Copeland-Erdős constant. So I did my bit for the community and wrote two modules to output these numbers to any desired digit.

David Gawen Champernowne (1912-2000)

Paul Erdős (1913-1996)

Arthur Herbert Copeland (1898-1970)

The modules are included in a package called idmaths, which is available on Github.

Here’s some sample code.

The first graph

Data visualisation is, we are told, the hottest keyword in data science. Like many items of jargon fashionable in these modern times (just like the phrase ‘data science’ itself), its meaning is at best vague. The tech industry like to think of data visualisation as somehow computer-related, or the final stage of a process of computation and data manipulation which involves coding or the use of software tools. But human beings have been manipulating data and doing data science for millennia, so it follows that the history of data visualisation goes back a long way, long before computers were invented.

Consider graphs, the most common form of data visualisation. A graph is a visual representation of the relation between two variables (I mean the kind that’s plotted on a flat surface).

Who drew the first graph?

In 1936, Howard Gray Funkhouser described an image in a manuscript discovered by Siegmund Günther in 1877. The manuscript, a copy of Macrobius’s commentary on Cicero’s Somnium Scipionis, is located in the Bayerische Staatsbibliothek in Munich (BSB Clm 14436). It appears to date from the first quarter of the 11th century.

The graph is in the appendix, which bears the title De cursu per zodiacum (‘On the movement through the zodiac’). It was possibly added by an unknown transcriber.  The graph seems to represent a plot of the inclinations of the planetary orbits as a function of the time. The zodiac is shown on a plane, with the horizontal axies showing time (divided into thirty parts), while the vertical axis shows the width of the zodiac.

The world’s first graph?
Folio 61 recto of a copy of Macrobius’s commentary on Cicero’s ‘Somnium Scipionis’. The lines show seven heavenly bodies: Venus, Mercury, Saturn, the Sun, Mars, Jupiter, and the Moon.

Is the the world’s first graph? The use of a grid is uncannily modern. But there are some difficulties.

Each line, belonging to a different planet, is plotted on a different scale, so the periods cannot be reconciled. It would be more accurate to call it a schematic diagram of the data. In other words, the values for the amplitudes which are described in the accompanying text, cannot be read off the graph.

A final note on data visualisation: Funkhouser’s research was motivated by the explosion in the use of graphical methods in the 1930s. That’s eighty years before DJ Patil popularised the term ‘data science’.

Forecasting an election result

In the run-up to the French presidential election in mid-2017, G. Elliott Morris at The Crosstab published some interesting forecasts using simulated Dirichlet draws. The post in question is no longer online. It was previously available on http://www.thecrosstab.com/2017/02/14/france-2017-methodology .

The method itself is fairly well-known (see e.g. Rigdon et al. 2009, A Bayesian Prediction Model for the U.S. Presidential Election ).

I thought it would be interesting to apply the technique when the poll samples and voter base are both tiny. So I did it for Malta, which held a snap election in June 2017. The main problem here is the inconsistency of the polls. For the last few data points, I used a series of voluntary online surveys carried out by a Facebook group calling themselves MaltaSurvey. In hindsight, the survey results appear to have been biased, but at the time there was no way of knowing how to model this bias.

So, without further ado, here is the link to the code on Github.




The earliest image of another galaxy

The constellation of Andromeda, from the earliest copy of the Al-Sufi manuscript, written c. 1009-1010 A.D. (Oxford, Bodleian Library MS. Marsh 144, page 167). The image is reversed here. This is how the constellation would appear to an observer.

The Andromeda Galaxy holds several distinctions. It is the closest galaxy to our own (the Milky Way) – about 2.4×1019 km from the Earth. It is also the largest and most massive galaxy in the Local Group, which includes about 45 galaxies.

Its size and proximity make it visible to the naked eye.

When Claudius Ptolemy of Alexandria made a catalogue of all known astronomical objects in the second century A.D., his only instrument was the naked eye. His Almagest lists five stars as ‘nebulous’, together with a ‘nebulous complex’. These data were the gold standard in astronomy right through the Middle Ages.

But Ptolemy did not include the Andromeda Nebula. This nebula, which is in fact the Andromeda galaxy, was first described by the Persian astronomer Abd al-Rahman al-Sufi (903-986 A.D.). Al-Sufi worked at the Buyid court in Isfahan. Some time around 964 A.D., he wrote the Book of Pictures of the (Fixed) Stars, which was a synthesis of Graeco-Roman knowledge contained in the Almagest with Arabic astronomical tradition.

The manuscript consisted of text and accompanying diagrams. The drawing of the constellation of Andromeda as described by Ptolemy, or “the woman in chains” in Arabic, is superimposed by the Big Fish, an Arabic constellation not found in the Almagest.

The text describes a “little cloud” (latkha sahabiya) lying near the mouth of the Big Fish. The drawing shows it as a small clump of dots.

This little clump is the Andromeda Galaxy. That drawing is the first image of another galaxy.

Al-Sufi’s text made its way into the Latin West  some time during the 12th century, and was translated into Latin as the Liber locis stellarum fixarum. It has been attributed, with varying degrees of certainty, to an unknown scribe working at the court of  William II of Sicily (1155-1189). The earliest copy of this manuscript in held in the Bibliothèque de l’Arsenal in Paris (MS. 1036) and dates from around 1250-1275. It was probably made in Bologna, in northern Italy.

Liber locis stellarum fixarum, Paris, Bibliothèque de l'Arsenal, MS. 1036, fol. 17v.

Drawing of Andromeda, from the Liber locis stellarum fixarum, Paris, Bibliothèque de l’Arsenal, MS. 1036, fol. 17v. Just like the Arabic Al-Sufi manuscript, it shows the Andromeda Galaxy as a little clump of dots.



The same constellation, from yet another Latin copy of the Al-Sufi manuscript  (so-called Sufi Latinus text). The dots marking the nebulous spot can be seen to the right of the Big Fish’s mouth. This manuscript was made in 1428 in northern Italy (Gotha, Forschungsbibliothek, MS. Memb. II 141).


The Andromeda Galaxy, a.k.a. Messier Object 31.

The real deal. The Andromeda Galaxy, a.k.a. Messier Object 31.




Happy 100th birthday, General Relativity

This year, professional physicists and the few geeks who are still interested in science (should we call them nerds?) are celebrating General Relativity’s centenary.

Great. What of it then?

General Relativity breaks the record for flowery adjectives in science.  It has been described as impossible to understand, poetic, beautiful, elegant and simple.

Book titles must be short and engaging. You are excused.

Book titles must be short and engaging. You are excused.

Surely it’s elegantly simple?


Simple? Einstein’s Zurich notebook. He makes a wrong assumption about weak gravitational fields on this page, and ends up the wrong path. He starts again on the next page, and arrives at the correct solution.

It’s hard to define ‘simple’ in scientific language. I more appropriate (and sober) description would be ‘complete’. General Relativity is the most complete theory of gravity known so far.

Why is it complete?

Because all gravitational phenomena we have observed so far can be modelled by General Relativity. It describes everything from falling apples, to the orbit of planets, the bending of light, the dynamics of galaxy clusters, and even black holes. The domain of validity of the theory covers a wide range of energy levels and scales. And scale is what physics is all about.

When the BICEP-2 experiment claimed to observe gravitational waves, there was a deeper (and probably more significant) result. It meant that General Relativity is valid up to the GeV energy scale, almost reaching the domain where quantum physics becomes the preferred description.

Can it describe the whole Universe?

Almost. Modern cosmology is based on General Relativity applied to a simple model of the Universe.

We have the field equations for gravity: the Einstein field equations.

We have the boundary conditions: homogeneity and isotropy, and the contents of the four-dimensional spacetime – matter or energy.

Put them together and you obtain a metric. Think of it as a generalised gravitational potential for the entire Universe.

Almost? What’s the catch?

The big questions in physics (we should really say Big Questions – they’re that important) , on this 100th birthday of General Relativity are the things that cannot be explained by this model: Dark Energy (the Universe doesn’t just expand, it accelerates), and  Inflation (the initial the matter-energy distribution was not homogeneous).

Einstein published most of his papers on General Relativity in 1914. Why are we celebrating 2015?

Because the essential element of General Relativity is the field equations. Einstein had been working on the problem for some years, starting in 1907. He arrived at the final, correct form  in 1915. And he was fully aware of the significance of this publication. He called it simply ‘The Field Equations of Gravitation’ (‘Feldgleichungen der Gravitation’,  in Akademie der Wissenschaften, Sitzungsberichte 1915 (part 2) pages 844-847).

From then on, it was a matter of working out the derivations.


Manuscript of ‘Grundlage der allgemeinen Relativitätstheorie’ (The Foundation of the General Theory of Relativity).


Printed and published. Job done.

Job done. Printed and published in Annalen der Physik (series 4), 49, 769–822, 1916.


Einstein in 1921.

Einstein in 1921.

Physics 2048

Among the multitude of 2048 spinoffs, it wasn’t long before someone thought of a physics twist to the game

Matt LeBlanc: LHC, or the Higgs boson.

James M Donnelly: Isotopic 256, or nucleosynthesis.

Musica universalis (14) – The inner space

Airwave (2000), Innerspace



Eugenio Calabi (1954), The space of Kähler metrics 

Shing-Tung Yau (1978), On the Ricci curvature of a compact kähler manifold and the complex Monge-Ampère equation

Probably not Thomas Bayes

Anyone who has Googled “Thomas Bayes” or searched Wikipedia will have come across this picture.


Most sites helpfully note that this is not an authentic portrait. The costume is anachronistic, and the illustration first appears about two hundred years after Bayes’s death. In fact there is no known portrait of probably the greatest name in probability and statistical theory.

We know very little about Thomas Bayes.

We do know that he was the son of Joshua and Ann Bayes, and was born in London or possibly Herfordshire, most likely in 1701. In 1719, he began to study logic and theology at the University of Edinburgh. When Bayes graduated, his father was the minister of the Presbyterian meeting house in Leather Lane. By 1731, Bayes moved to Tunbridge Wells, Kent, and became the Presbyterian minister of the Mount Sion chapel.

While there, Bayes published his first known work in 1731.  This is a theological rather than a mathematical text, with the rather self-explanatory title of Divine Benevolence or an Attempt to Prove That the Principal End of the Divine Providence and Government is the Happiness of His Creatures. 

His second work was published anonymously in 1736. It was called An Introduction to the Doctrine of Fluxions, and a Defence of the Mathematicians Against the Objections of the Author of the Analyst.

It is an interesting work which gives a glimpse of academic debate in 18th century England. In it, Bayes contradicts the criticisms of Bishop George Berkeley (author of The Analyst), who attacked the logical foundation of Isaac Newton’s calculus (“fluxions”). It contained enough mathematics in the introduction for Bayes to be elected Fellow of the Royal Society in 1742.

In 1752, Bayes retired from his ministry, but remained in Tunbridge Wells for the rest of his life.

Now begins the most interesting chapter of Bayes’s life as a scientist. He became interested in probability. It was a race against death.

Bayes became ill and executed his will on 12th December, 1760. Most of his estate was bequeathed to his brothers, sisters, nephews, and cousins. He also divided 200 pounds between John Boyl and and a certain Reverend Richard Price.

Bayes died in Tunbridge Wells, Kent on 7th April, 1761. After his death, the Reverend Richard Price received Bayes’ manuscript on probability. Richard Price edited the manuscript and introduced Bayes’ theorem to the Royal Statistical Society.

It was called Essay Towards Solving a Problem in the Doctrine of Chances and was published in the Philosophical Transactions of the Royal Society in 1763.


Diagram to illustrate Proposition 10 in the essay

I will leave the last word to the Revered Price himself:

Every judicious person will be sensible that the problem now mentioned is by no means merely a curious speculation in the doctrine of chances, but necessary to be solved in order to a sure foundation for all our reasonings concerning past facts, and what is likely to be hereafter. Common sense is indeed sufficient to show us that, from the observation of what has in former instances been the consequence of a certain cause or action, one may make a judgement what is likely to be the consequence of it another time and that the larger number of experiments we have to support a conclusion, so much more the reason we have to take it for granted. But it is certain that we cannot determine, at least not to any nicety, in what degree repeated experiments confirm a conclusion, without the particular discussion of the beforementioned problem; which, therefore, is necessary to be considered by any that would give a clear account of the strength of analogical or inductive reasoning; concerning, which at present, we seem to know little more than that it does sometimes in fact convince us, and at other times not; and that, as it is the means of acquainting us with many truths, of which otherwise we must have been ignorant; so it is, in all probability, the source of many errors, which perhaps might in some measure be avoided, if the force that this sort of reasoning ought to have with us were more distinctly and clearly understood.

The scourge of graduate unemployment

Berlin's trendence institute surveyed over 300,000 European graduates on their perceived career prospects Illustration: Christine Oliver for the Guardian

Berlin’s trendence institute surveyed over 300,000 European graduates on their perceived career prospects Illustration: Christine Oliver for the Guardian



Or what to do with millions of extra graduates.

Europe isn’t alone in facing the problem of graduate unemployment. The BRIC countries are feeling it too.

The numbers are staggering. In India one in three graduates up to the age of 29 is unemployed, according to a Labour Ministry report released last November. Total unemployment in the country is officially closer to 12%.

In China this month a record 7.26 million will graduate from the country’s universities – more than seven times the number 15 years ago.

Unemployment among new Chines graduates six months after leaving university is officially around 15%.

The real unemployment rate could be closer to 30% – some 2.3 million unemployed from this year’s graduating cohort alone, according to Joseph Cheng, professor of political science at City University of Hong Kong.

Meanwhile, back home in Europe, graduates expect to submit an average of 60 applications before landing their first job.  The average wait between graduation and employment is approaching six months. That’s the average.


Musica universalis (13) – The Higgs boson

John O’Callaghan (2014), One Special Particle



Robert Brout and François Englert (1964), Broken Symmetry and the Mass of Gauge Vector Mesons

Peter Higgs (1964), Broken Symmetries and the Masses of Gauge Bosons

Gerald Guralnik, C. Richard Hagen and Tom Kibble (1964), Global Conservation Laws and Massless Particles

« Older posts

© 2018 Ivan Debono

Theme by Anders NorenUp ↑