Distribution of a Robot Swarm in a Square under Gravity

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

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.

Contributed by: Haoran Zhao and Aaron T. Becker (January 2016)
Open content licensed under CC BY-NC-SA



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.

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.