11524

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

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

### PERMANENT CITATION

 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 » Download Demonstration as CDF » Download Author Code »(preview ») Files require Wolfram CDF Player or Mathematica.

#### Related Topics

 RELATED RESOURCES
 The #1 tool for creating Demonstrations and anything technical. Explore anything with the first computational knowledge engine. The web's most extensive mathematics resource. An app for every course—right in the palm of your hand. Read our views on math,science, and technology. The format that makes Demonstrations (and any information) easy to share and interact with. Programs & resources for educators, schools & students. Join the initiative for modernizing math education. Walk through homework problems one step at a time, with hints to help along the way. Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet. Knowledge-based programming for everyone.