A trie is an ordered tree data structure often used to store word lists, for example, for auto-complete applications. Each node in the tree is associated with a letter; the association of nodes with each other (parents, children, grandchildren, etc.) orders the letters into words. …
Goldbach's conjecture is probably one of the most famous unsolved problems in mathematics. It states that Every even integer can be expressed as the sum of two primes. The number of different ways that can be expressed as the sum of two primes is known …
Wa-Tor is a population dynamics simulation described by Alexander Dewdney in Scientific American (1984): "Computer Recreations: Sharks and fish wage an ecological war on the toroidal planet Wa-Tor". In the above animation, fish (prey) are pink and sharks (predators) are yellow. In this case, the …
Wikipedia has an interesting (if somewhat morbid) list of disasters in Great Britain and Ireland. This blog post will show how to scrape it and plot a chart of the deaths due to these disasters over time. The list is divided into three sections: a …
Wikipedia contains biographical information about most MPs which can be scraped using Python and the BeautifulSoup library. First we need a list of MPs. It doesn't have to be particularly up-to-date, so I'm using the list of those MPs elected at the 2015 General Election. …
The temperature-dependence of the rotational contribution to the heat capacity of gaseous molecular hydrogen shows a Schottky anomaly: whereas for many systems the heat capacity can be expected to increase with increasing temperature, for there is an temperature range within which it reaches a maximum …
It is a standard result of statistical thermodynamics that the molar heat capacity at constant volume, , is related to the molecular partition sum, , through the relation where and represent the first and second derivative of with respect to the "thermodynamic beta", : There …
Suppose a fair coin is tossed times and the number of "heads", , and "tails", , recorded after each toss. Over the course of the trial, how many times is the number of heads recorded greater than the number of tails? Naive intuition might lead …
The problem of predicting the term symbols for states derived from a atomic configuration (without using group theory!) provides a good use of Python's collections and itertools libraries. The function below can be passed the orbital angular momentum quantum number, , and number of electrons, …
The Ebbinghaus illusion is a famous visual effect based on the perception of the relative size. Two circles of the same size are surrounded in one case by obviously larger circles and in the other by obviously smaller circles. The former is perceived as being …