A blog of Python-related topics and code.

Plotting nuclear fusion cross sections

In a nuclear fusion reaction two atomic nuclei combine to form a single nucleus of lower total mass, the difference in mass, $\Delta m$ being released as energy in accordance with $E = \Delta m c^2$. It is this process which powers stars (in our own sun, hydrogen nuclei are fused into helium), and nuclear fusion has been actively pursued as a potential clean and cheap energy source in reactors on Earth for over 50 years.

Constructing Reuleaux polygons

A Reuleaux polygon is a curvilinear polygon built up of circular arcs. For an odd number of vertices, it has a constant width, and for this reason many polygonal coins, such as the UK's 50p piece and this Bermudian dollar coin are Reuleaux polygons. This property also means they make serviceable bicycle wheels:

What happens to carbon dioxide dissolved in water?

Carbon dioxide ($\mathrm{CO_2}$) dissolves in water, and some of the dissolved $\mathrm{CO_2}$ forms carbonic acid, $\mathrm{H_2CO_3(aq)}$: $$ \mathrm{CO_2(g)} + \mathrm{H_2O(l)} \rightleftharpoons \mathrm{H_2CO_3(aq)}. $$ This acid can then dissociate to form bicarbonate, $\mathrm{HCO_3^-}$: $$ K_1: \mathrm{H_2CO_3(aq)} \rightleftharpoons \mathrm{HCO_3^-(aq)} + \mathrm{H^+(aq)}, $$ which may further dissociate to carbonate, $\mathrm{CO_3^{2-}}$: $$ K_2: \mathrm{HCO_3^-(aq)} \rightleftharpoons \mathrm{CO_3^{2-}(aq)} + \mathrm{H^+(aq)}. $$

The world's nuclear reactors over time

The Python program given below generates this stacked area plot of the number of nuclear reactors in different countries over the last six decades or so.

The Duffing Oscillator

The previous blog post described the motion of a quartic oscillator: a particle moving in the potential $V(x) = \frac{1}{4}x^4 - \frac{1}{2}x^2$. In this case, the motion was always periodic (since the particle's energy is conserved).