Metropolis Hastings Algorithm

In mathematics and physics, the Metropolis-Hastings algorithm is a Markov chain Monte Carlo method for creating a Markov chain that converges on a sequence of samples from a probability distribution that is difficult to sample from directly. This sequence can be used to approximate the distribution (i.e., to generate a histogram), or to compute an integral (such as an expected value).