Blog

A blog of Python-related topics and code.

The n-second rule

How long have you got before a piece of food dropped on the floor is unsafe to eat?

Nuclear binding energies #2

The semi-empirical mass formula parameters used in the previous post were taken from the text book of J. W. Rohlf (1994) [1]. Another, older set of parameters are presented in the compilation of A. H. Wapstra (1958)[2]. Below we compare each with the experimental data from the OECD-NEA (in the file mass.mas03).

Nuclear binding energies #1

The binding energy of a nucleus is the energy that would be required to split apart each of its constituent protons and neutrons (nucleons). This energy is due to the forces that hold the nucleus together, which may be thought of as a balance between the attractive strong nuclear force and the electromagnetic force (which is repulsive between the positively-charged protons). The binding energy manifests itself in a mass difference between the nucleus and the individual nucleons ($E=mc^2$) and the difference in binding energy between different nuclei is the energy released in the process of nuclear fusion and fission.

Binning a 2D array in NumPy

The standard way to bin a large array to a smaller one by averaging is to reshape it into a higher dimension and then take the means over the appropriate new axes. The following function does this, assuming that each dimension of the new shape is a factor of the corresponding dimension in the old one.

Visualizing the bivariate Gaussian distribution

The multivariate Gaussian distribution of an $n$-dimensional vector $\boldsymbol{x}=(x_1, x_2, \cdots, x_n)$ may be written