The Avogadro constant is a fundamental physical constant that plays a crucial role in the field of chemistry. In our first lecture, we discussed one way to determine the Avogadro constant from Brownian motion. This technique was very relevant at the beginning of the 20th century. A list of historic measurements can be found in table 1 of Peter Becker, Rep. Prog. Phys. 64 (2001) 1945–2008.
In this exercise we will test if applying the Kalman filter to the measurement enhances the accuracy of the estimated constant.
plt.errorbar()
-plot in Python.plt.text()
In thermodynamics, the probability density of paricles in a Potential V(x) is given by the Boltzmann distribution. It reads (if constants are set to 1) \[ \rho(x)=e^{-V}. \] We want to study the case of a double-well potential \[ V(x) = x^4-x^2. \]
The Metropolis algorithm is a special case of the Metropolis-Hastings algorithm. It is a Markov Chain Monte Carlo method that uses one artificially generated series (a Markov chain) to approximate the integral \[ \langle f(x) = \int f(x)\rho(x)\mathrm{d}x. \]
The algorithm consists of the following steps:
qt=np.random.normal(0,1)
at=np.random.uniform(0,1)
Plot the generated series x against t. What is the problem with the first values of the series? Remove the initial part of the series and only keep the part, where states are within the region of interest (x=x[1000:]
)
Plot the histogram of the series (plt.hist(x,bins=40,density=True)
); also plot the function rho in a suitable range and compare both plots; was the approximation of the density successful?
Calculate the first, second, and fourth moment of the distribution, using the series x