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.



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


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.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+