This applet runs a random-scan Metropolis-within-Gibbs MCMC algorithm on a spatial point process model for a fixed number N of particles, with initial distribution independent uniform placement over the pink region, and with target density (with respect to that independent uniform placement) equal to:
pi(x_1, y_1, x_2, ..., y_N) = exp( −H(x_1, y_1, x_2, ..., y_N) )where
H(x_1, y_1, x_2, ..., y_N) = sum_{i<j} ( A * |(x_i, y_i) − (x_j, y_j)| ) + sum_{i<j} ( B / |(x_i, y_i) − (x_j, y_j)| ) + sum_i (C * x_i)and |...| is Euclidean distance. Here (x_i, y_i) is the position of the i'th particle.
The applet also computes and updates the mean inter-particle distance (scaled so the pink region has height 1 and width 1.5).
The applet accepts the following keyboard inputs. (You may need to "click" on the applet first.)