Pages

Saturday, November 26, 2016

Ising the Body Electric

Last week I was in Chicago, visiting my friend Kevin, so I didn't get around to putting up a post, but I did get some material for this week: I've been going to a lot of shows, concerts, and other group events lately, and it got me thinking about crowd dynamics, specifically standing ovations.  I figured there were two factors that determined whether someone would stand up during applause:
  • The quality of the performance
  • Whether nearby people were standing
These two conditions reminded me of the Ising model used to simulate magnetic materials.  The idea is that in a ferromagnetic material (like iron), we can imagine a bunch of arrows, called spins, that point up or down.  The energy of any particular spin is related to those of its neighbors: +1 for each opposite spin, and -1 for matching spin (remember that low-energy states are preferred).  Here's an example:
In the Ising model, we pick a random spin at each time step, and decide if it should be flipped.  The probability is given by the Boltzmann distribution,
where ΔE is the difference in energy between the current state and the flipped state, and kT is the thermal energy.  For cases where the new state is lower energy, we get P > 1, so a flip is guaranteed.  We can also introduce an overall field, which biases the system in one direction – This could represent a permanent magnet near the iron, for example.
So how does this relate to audiences?  Each person can represent a spin, and their neighbors influence their probability of standing or sitting.  Someone could stand independent of their neighbors for an exceptional performance, so that's the external field.  Temperature relates to how willing people are to switch between standing and sitting.

I wrote up a version of the algorithm in Python, which you can try for yourself – I added a bunch of comments, so I hope it's not too opaque.  Here are the results for a performance not quite up to snuff:
And one that got the pixel people a bit more excited:
The only difference in conditions for these was the "performance quality" (external field): 0.1 for the first one and 0.5 for the second.  If you come up with any interesting settings yourself, be sure to leave a comment!

1 comment:

  1. I think you should add some factor to represent that it's embarrassing to keep visibly changing one's mind about the performance. The probability of a state change decreases sharply as the number of prior state changes rises.

    ReplyDelete