[Oops, your browser will not display java applets. Try the JavaScript version instead.]

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.)

• Use the numbers '0' though '9' to set the animation speed level higher or lower. (Note that 0=frozen, and 1=one-step.)
• Use 'A' and 'a' to increase/decrease the value of A, and similarly 'B' and 'b' for B, and 'C' and 'c' for C. (Yes, negative values are allowed.)
• Use 'r' to restart the simulation, or 'z' to just zero the counts. (The initial distribution is always independent uniform placement.)
• Use 'p' and 'm' to increase/decrease the size of the proposal increments.
• Use '+' and '−' to increase/decrease the number N of particles (and restart the simulation).

Applet by Jeffrey S. Rosenthal (contact me).