Distribution of a Robot Swarm in a Square under Gravity

This Demonstration determines the mean, variance, and covariance for a very large swarm of robots as they move inside a square workplace under the influence of gravity, pointing in the direction . The swarm is large, but the robots are comparatively small and together cover a constant area . Under gravity, they flow like a liquid, moving to one side of the workplace to form a polygonal shape.
<>DemonstrationSite`Private`CreateWebControllerLink[{}]<>DemonstrationSite`Private`CreateWebControllerLink[{}]<>DemonstrationSite`Private`CreateWebControllerLink[{}]<>DemonstrationSite`Private`CreateWebControllerLink[{}]<>

THINGS TO TRY

SNAPSHOTS

  • [Snapshot]
  • [Snapshot]
  • [Snapshot]

DETAILS

The direction of the force of gravity is determined by the angle , in , such that the swarm can assume eight different polygonal shapes. The shapes alternate between triangles and trapezoids when , and alternate between squares with one corner removed and trapezoids when .
Computing the means and , variances and , covariance , and correlation requires integration over the area containing the swarm. One way is to use an indicator function that returns 1 if the point is inside the region containing the swarm and 0 otherwise. The formulas are as follows, integrating over the unit square with and from 0 to 1.
, ,
, ,
,
.
Instead of using an indicator function, the region of integration can be changed to only include the polygon containing the swarm. As an example calculation, if the force angle is , the mean when the swarm is in the lower-left corner is
for and for .
A few interesting results: the correlation is maximized when the swarm has a triangular shape, and equals . The covariance of the triangle is always . Variance is maximized in one direction and minimized in the other when the swarm is in a rectangular position. Mean positions are maximized when is small.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.