A blog of Python-related topics and code.
Wordle is a daily online word-guessing game. The goal is to deduce the hidden five-letter word in as few guesses as possible: after each guess, the player is told which letters which match in the correct position (highlighted in green), which letters are present in the hidden word, but in a different position (highlighted in yellow) and which letters are not present (after those highlighted in green or yellow; these letters are presented on a grey background).
The Python script below generates the following visualization of COVID deaths per 100,000 people for two classes of European country: those with less than 75% of the population vaccinated and those with at least this percentage vaccinated. The ongoing (as of January 2022) third wave of infections is causing fewer deaths in the countries with a higher vaccination rate.
The Klein–Nishina formula gives the differential cross section for the scattering of photons off an electron. At low energies, light scatters elastically (Thomson scattering); at higher energies (for example, gamma radiation), inelastic Compton scattering occurs. In terms of the incoming and outgoing photon wavelengths, $\lambda$ and $\lambda'$:
Lecture 12 of the MIT course 22.01: Introduction to Nuclear Engineering and Ionizing Radiation covers the manufacture of $\mathrm{^{60}Co}$ by neutron irradiation of $\mathrm{^{59}Co}$ in a research reactor. The thermal neutron absorption cross section of $\mathrm{^{59}Co}$ is $\sigma_0 \approx 20 \; \mathrm{barn}$, so for a neutron flux $\Phi$, the rate of change of the number of $\mathrm{^{59}Co}$ nuclei, $N_0$, may be written $$ \frac{\mathrm{d}N_0}{\mathrm{d}t} = -\sigma_0 \Phi N_0 \quad\Rightarrow N_0(t) = N_0(0)\mathrm{e}^{-\sigma_0\Phi t} $$
A short script to reduce the palette of an image and replace it with random colours, using the image mona_lisa_400.jpg.