Long-range Acoustic Interactions in Insect Swarms: An Adaptive Gravity Model

The collective motion of groups of animals emerges from the net effect of the interactions between individual members of the group. In many cases, such as birds, fish, or ungulates, these interactions are mediated by sensory stimuli that predominantly arise from nearby neighbors. But not all stimuli in animal groups are short range. Here, we consider mating swarms of midges, which interact primarily via long-range acoustic stimuli. We exploit the similarity in form between the decay of acoustic and gravitational sources to build a model for swarm behavior. By accounting for the adaptive nature of the midges' acoustic sensing, we show that our"adaptive gravity"model makes mean-field predictions that agree well with experimental observations of laboratory swarms. Our results highlight the role of sensory mechanisms and interaction range in collective animal behavior. The adaptive interactions that we present here open a new class of equations of motion, which may appear in other biological contexts.


Introduction
Collective behavior of groups of social animals is widespread in nature [1], and occurs on size scales ranging from single-celled organisms [2,3] such as bacteria [4][5][6] to insects [7][8][9][10] to larger animals such as birds [11,12] or fish [13][14][15]. Animals are thought to aggregate and move cooperatively for many reasons; collective behavior may, for example, reduce the risk of predation for an individual in a group [1,16], promote efficient mating and decrease inbreeding in dispersed populations [17], modulate the energetic cost of migration [18], or enable enhanced sensing [15]. Because of both its ubiquity and the potentially advantageous properties it conveys for groups, collective behavior has engaged a broad cross-section of scientists, ranging from physicists and applied mathematicians who hope to tease out the general principles that drive the emergence of collective states in nonequilibrium systems to engineers who hope to develop bio-inspired control strategies for distributed multiagent systems.
Collective behavior therefore has a long modeling history [1,19,20]. Models are useful both as a check on our fundamental understanding of the low-level interactions that lead to the emergent group properties and as a stepping stone to the design of engineered systems that exploit them. Many models treat the group as a collection of self-propelled agents that are in some way coupled [21,22]. Building such an agent-based model requires several fundamental choices [23]. We must specify the base-case, non-interacting behavior of each individual; we must choose a functional form for the interactions that couple the individuals; we must decide whether these rules are uniform throughout the population and in time; and we must decide which individuals interact. Each of these choices can be difficult to make with certainty, and yet has significant ramifications for model performance and fidelity.
Here, we focus on the last of these modeling assumptions: the choice of which individuals interact. From passive observations alone, it is difficult to discern the correct interactions in a group of animals [8], since it requires the solution of a challenging inverse problem. Thus, it is common to replace the difficult-to-measure interaction network with the more straightforward proximity network [24]; that is, one assumes that the local neighborhood (defined by, for example, either metric or topological distance [25,26]) of an individual dominates that individual's behavior. This assumption is reasonable, and appears to be valid [13,14,25,27,28], for dense groups of animals such as flocks of birds or schools of fish that interact primarily through vision and that move in a coordinated, directed fashion. But it is not always true; crowds of humans moving toward goals, for example, can show emergent collective behavior while 'interacting' with other individuals with whom they are likely to collide in the future rather than with those who are closest to them [29].
We consider here a canonical example of collective animal behavior-mating swarms of flying insectswhere local interactions do not clearly play a major role and yet where the animals display group-level cohesion [8].
Recently this system has also generated interest for possible indications of critical behavior [10,30]. Previous descriptions of insect swarms have accounted for the tight binding of individuals to the group either by introducing a confining potential [9,10] or by invoking external environmental cues [17]. Here, we instead develop a swarm model inspired by the dominant sensory mechanism of the insects, and show that group cohesion can emerge naturally instead of being externally imposed.
Swarming species of Chironomid midges, such as those we consider here, are known to be very sensitive to acoustic signals [31], and are thought to be attracted to swarms by the sound they produce. Motivated by these observations, we make the ansatz that swarming midges accelerate toward the sound produced by others; in essence, we hypothesize that in addition to their known pairwise function, acoustic interactions are the basis for coordinating the large-scale collective behavior of the swarm. The exact structure of the acoustic field produced by a freely flying midge is not known. However, the acoustic field produced by other flying insects (flies, for example) has been found to have both monopole and dipole components [32]. Since the monopole field decays more slowly compared to the dipole (and any higher multipole) component, in our model we include only its contribution; thus, our model should be seen as a simplified representation of acoustic interactions that coarsegrains over many of the specific details of insect hearing. The monopole sound intensity falls off according to an inverse-square law, and so this hypothesis results in an effective gravity-like force that promotes group cohesion while still allowing for complex individual motion. We additionally account for the possibility that the midges' sensory perception may adapt to the overall sound level they experience. Our model is thus not derived from an underlying kinetic theory, as is commonly done in models of collective behavior [21], but rather is explicitly long-range and many-body.
We use in this work concepts and techniques from classical N-body self-gravitating systems to explain the collective swarming behavior of insects (midges). Although models of collective behavior abound in the literature, they are not typically so tightly tied to models of other well known physical systems. We find two features of the model to be especially appealing. First, it is well known that gravity can produce very complex behavior from simple interactions. Similar dynamics are expected to occur in collective behavior in biology. By explicitly making a link between the two, we can draw on the intuition built up from studying gravity in how these complex dynamics arise to gain insight into collective animal behavior. At the same time, we introduce a new concept to the gravitational physics community that is taken from biology, namely the adaptivity of the sensory mechanism, ending up with a new form of gravitational interaction that we term 'adaptive gravity'.
To establish the plausibility of this model, we compare some of its predictions with laboratory measurements of swarms of the non-biting midge Chironomus riparius, and find surprisingly good agreement. Although we certainly do not account for all of the details of acoustic signal transduction by the insects, we show that our leading-order, coarse-grained model performs surprisingly well when compared with the empirical data. Given the long-range nature of our model, our results suggest that the midges may process more than just local information, as has also recently been proposed for bird flocks [33].

Experimental setup
Before discussing our model and its comparison with our empirical data, we describe our laboratory experiments with midge swarms The details of these measurements have been discussed elsewhere [7,8,34], and so we only give a brief overview here.
Our self-sustaining colony of C.riparius midges was originally established from egg sacs purchased from Environmental Consulting and Testing, Inc. The colony is maintained in a transparent cubical enclosure, 91 cm on a side, at a constant 22°C. The midges are exposed to overhead light on a circadian cycle, with 16 h of light and 8 h of darkness per day. When the overhead light turns on and off (corresponding to 'dawn' and 'dusk'), adult males spontaneously form swarms. To promote swarm nucleation and to position the swarm in the enclosure, we use a black felt 'swarm marker' measuring 30×30 cm 2 placed just above the development tanks. Although the marker can affect the overall swarm morphology for small swarms, we have shown that once the swarm is relatively large its effect is very weak [34]. Further details of our husbandry procedures are given in [7,8].
To quantify the motion of the midges, we record movies of swarming events with three hardwaresynchronized Point Grey Flea3 cameras at a rate of 100 frames per second. We have shown previously that this data rate is sufficient to resolve even the acceleration of the midges [7]. The cameras are arranged in a horizontal plane about 1m from the center of the swarm with angular separations of approximately • 30 and • 70 . Prior to recording data, the camera system is calibrated using Tsai's model [35]; subsequently, the two-dimensional coordinates of each midge on each camera (found by simple image segmentation and intensity-weighted averaging) can be combined to find the midge positions in three-dimensional space. The sequences of timeresolved positions are then linked into trajectories using a fully automated multi-frame predictive tracking algorithm [36]. For various reasons, trajectories may sometimes be broken; thus, in a post-processing step we link trajectory fragments using Xu's method of re-tracking in a six-dimensional position-velocity space [37]. After trajectory construction, we compute accurate time derivatives (namely, velocity and acceleration) by convolving the tracks with a smoothing and differentiating kernel [7]. Statistics of the velocity and acceleration at different locations in the swarm are computed by averaging over many midges over many swarming events to obtain converged results.
For the results shown here, we analyzed data from 128 swarming events. Although the number of individuals was not uniform from swarm to swarm, we have shown previously that the swarms reach a statistical 'asymptotic' regime at surprisingly small population sizes [34]; here, the mean number of individuals per swarm was about 10. Finally, for reference below, we note that the body size of a male C.riparius midge is about 7mm in length. Typical flight speeds of the midges are roughly 0.5 m s −1 , and peak instantaneous accelerations are on the order of 5 m s −2 . The sound produced by a male's beating wings is broadband, but has a fundamental frequency of about 575Hz, as measured in our experiments [38]. It is difficult to measure the sound amplitude produced by a freely flying midge precisely; within a few body lengths of the midge, we have measured it to be roughly 55dB.
In previous work, we have analyzed data from these swarms to characterize their dynamics [7,8,34,39]. Without going into detail here, we briefly summarize our primary findings. Although our midge swarms remain confined to a compact region of space with a statistically sharp boundary (in a way that appears to be selforganized [34]), teasing out pairwise interactions within the swarm is very challenging [8,39] and the swarms show no net internal order [7]. At a mean-field level, the statistics of the swarms share some features of an ideal gas in a harmonic trap [7,8]. Thus, with our model, we attempt to capture these primary effects: strong binding of individuals to the swarm as a whole but no strong signature of pairwise interaction at the mean-field level, overall disorder inside the swarm, and complex individual trajectories.

Model
A flying insect will produce sound by beating its wings. Typically, this field will be complex, and composed of at least monopole and dipole components [32]. Of the two, the monopole term will decay more slowly, and so we include only that component here. Midges detect sound from the bending of hairs on their antennae caused by passing sound waves [31,40,41]. To accomplish this detection, the sound waves must do work on the hairs; thus, to determine the rate at which the sound signal produced by a single midge decays in space, we must consider the decay of the energy flux. This flux can be written as the product of the pressure fluctuation and the fluid velocity induced by the sound wave [42]. For a monopole source, the time average of this product falls off as r 1 2 , where r is the distance from the emitting midge.
Next, we make the hypothesis that an individual midge accelerates towards a neighbor via an effective 'force' that is proportional to the sound intensity. Given the estimates above, this means that the force between a pair of midges i and j separated by a distance = -| | r r r ij i j   will scale as r 1 ij 2 , just as the gravitational attraction between a pair of point masses would. At present, we must treat this choice purely as an ansatz, as the details of the form of any pairwise interactions between midges is very difficult to access experimentally [8,39]. However, the assumption that the midge response to acoustic signals is an acceleration towards the sound source is the simplest choice one can make. Choosing the response to be at the velocity level would be somewhat un-natural, since velocity cannot be directly controlled by the insects: changes to the velocity must come from forces applied by the insect, and therefore accelerations. Strong (albeit indirect) experimental support for this assumption comes from the observation of a net linear restoring force acting towards the swarm center ( figure 1(b)). The only form of binary interactions that gives this linear restoring force towards the swarm center is an inverse-square force relation.
For many animals, the perception of sound is not fixed, but rather adapts to the total sound intensity so that acoustic sensitivity drops when there is strong background noise. This is a common feature of biological sensory organs, preventing their damage and saturation. We thus make a second ansatz: that in general the midges' acoustic perception adapts to the overall sound level, and that specifically it follows the fold-change detection mechanism [43], which is ubiquitous in nature. In that case, the effective force on midge i due to midge j is given by where r i  is the position vector for midge i,r ij is the unit vector pointing from midge i to midge j, C is a constant with dimensions of · mass length time 3 2 , and R ad is the length scale over which adaptivity occurs. In other words, when a single midge is closer than R ad the sound it emits is strong enough that the receiving midge needs to adapt its sensitivity to reduce the perceived signal. Beyond this distance there is no need for such adaptivity for the sound of a single midge. Note that there is no known relation between the wavelength of the sound emitted by the midges and R ad .
Equation (1) constitutes the core of our 'adaptive gravity' model (AGM) for the acoustic interactions of the midges. We note that this model assumes that the midges can sense both the intensity and the direction of the sound produced by others; it is thought, however, that the specialized Johnston's organs of male swarming insects are indeed able to do so [44]. Furthermore, it was recently demonstrated that the midges in a swarm do respond to the recorded sound produced by flying midges [38]. We also note that we are making the simplifying assumption that each midge is identical; although this assumption is certainly not fully accurate, it should allow us to make reasonable mean-field predictions.
With the assumption of adaptivity, the force felt by each midge is inherently many-body and cannot be written as a sum of two-body interactions (equations (3) and (4)) due to the sum over all the midges that appears in the denominator of the adaptivity factor (equation (1)). Thus, in this formulation, every midge feels a force that contains global, long-range information about the swarm, but this force cannot be parsed to distinguish the effects of any single neighbor. Thus, in this AGM the force that binds individual midges to the swarm is truly an emergent, group-level property that arises naturally from within the swarm without any appeal to external effects.
To build intuition for the behavior of this model, let us consider two limits. For r N R ij ad  (that is, when the distance between a pair of midges far exceeds the range of adaptivity, and N is the number of midges in the swarm), the effective force reduces to a purely gravitational interaction and becomes In the opposite limit, when < r N R ij ad , the adaptive nature of the acoustic sensitivity becomes dominant. In that case, the adaptivity simply reduces to a rescaling of the sound perceived by each midge by the total buzzing noise amplitude, and the effective force becomes where the total buzzing noise amplitude at r i  is proportional to  , the quantity we will use to represent that amplitude (despite the difference in units).
In pure gravity, the potential is additive, and the principle of superposition applies. Due to adaptivity, however, this property is lost in our model. That is, the effective potential felt by a midge due to many other midges is not the sum of two-body interactions using equation (S3) in the supplementary material. This can be seen by considering many interacting midges. The effective force felt by midge i due to the others (indices j) is given in equation (1) which is not equal to the sum over two-body forces (see equation (S1) in the supplementary material), which would be Unlike in pure gravity, the forces on midge i due to others are not additive and the superposition principle does not apply, since the total buzzing noise term does not depend on direction. As a consequence, there are no conservation laws in such a system (except mass conservation), and the sum of forces felt by all the midges within an isolated swarm need not vanish, as it must in regular gravity. Thus, in this model the center of mass of the swarm can experience accelerations; so, even though the AGM naturally leads to swarm cohesion, one may need to posit external effects to prevent drift of the swarm as a whole. Note that without some kind of additional effect such as self-propulsion or a short-range repulsive interaction, a purely attractive interaction like our AGM is susceptible to collapse. In our analytical calculations below, we assume uniform-density swarms, implicitly assuming that some such collapse-prevention mechanism is present; and in our simulations of the AGM, we add an additional short-range repulsive force, motivated by empirical observations [8].
Before describing the predictions of the AGM, let us briefly recapitulate our modeling approach, and its expected range of applicability. Given that we expect that the primary interaction modality between swarming midges is acoustic, we consider a simplified representation for how the sound emitted by a midge is perceived by its conspecifics, and assume that the perceived sound can be treated like an attractive force. In this framework, we are of course oversimplifying the actual biology; we are, for example, neglecting the details of the acoustic signal transduction, and the specific nature of the sound emitted by a potentially rapidly maneuvering insect. Thus, we would not expect to be able to faithfully represent the specific flight trajectories of individual midges, nor would we anticipate being able to predict the instantaneous acceleration of each midge. What we do expect to be able to reproduce are the coarse-grained, statistical properties of the swarms, as a whole, as we describe below.

Effective spring constants: spherical swarms
Gauss's law for gravity states that the gravitational flux through a closed surface is proportional to the enclosed mass [45]. In our analogy, each midge has an effective unit 'mass,' and therefore Gauss's law for the force in the 'pure gravity' regime (equation (2)) is We begin with a spherical swarm centered at the origin of uniform density ρ and radius = á ñ R r s (defined as the mean distance of a midge from the center of the mass of the swarm). The characteristic value of the total buzzing noise intensity at the origin isÑ N R S tot 2 , where N is the number of midges. Thus, when R N R S ad  we are in the pure gravity regime. In this case, from the analog of Gauss's law (equation (5)), the force is restoring and linear with respect to the distance r  of a midge from the center of the swarm ( figure 1(a)), and is given by Since this force is harmonic (that is, restoring and linear in r  ), we can characterize its strength with an effective 3 . We stress that this behavior is unique forr r ij ij 2 interactions, assuming that the motion arises only from interactions between the midges. Previously, we found that the average acceleration of midges in laboratory swarms also has this harmonic form [7], providing support for our model. However, in these laboratory swarms, the spring constants were found to depend on the swarm size R s ( figure 1(b)), unlike in pure gravity.
For swarms with large numbers of individuals, however, our model enters its adaptive regime, where < R N R S ad . In this regime, the net force is still linear and restoring; but due to the adaptive terms in equation (1), the spring constant K will depend on the swarm size R s . To leading order in r R s , the model predicts that µ . This result is derived in the supplementary material (equations (S4)-(S6)), and also follows from equation (3) using simple dimensional analysis, since When we examine the experimental data for K x and K y (where x and y are in the plane and z is vertical), we find good agreement with the model prediction that µ -K R s 1 (figures 2(a) and (b)). This agreement is a consequence of the roughly constant density in swarms of different sizes (except for small swarms of fewer than ∼10 midges [34]), and gives a lower bound on  R 45 mm ad since the adaptive regime applies to the smallest swarms For K z we find a decrease that is faster than predicted (figure 2(c)), as discussed further below.
These results are consistent with the adaptive regime as described above; thus, we cannot estimate R ad for the real midges based on the results at hand.
We note that away from the swarm center the adaptive-gravity interaction gives rise to a restoring force that deviates from the form of pure gravity even for a uniform density swarm ( figure 1(a)). Thus, we also calculated the force for a swarm with a Gaussian density profile, as was observed in experiments [7] ( figure 1(a)), and find that it is roughly linear over the entire swarm size, but saturates at large radii.
The calculation of the adaptive force near the swarm center, for a Gaussian density profile, is as follows. We take a Gaussian density profile with width s s , so that the density in cylindrical coordinates is given by where ξ is the polar radial coordinate and η is the coordinate along the axis of symmetry. The gravitational force at an arbitrary point h h = 0 is then and the total buzzing noise is The integrals were solved numerically using Mathematica 9.0, and were used to plot the dotted line in figure 1(a).
In addition we note that away from the center the effects of adaptivity are much weaker, and the acceleration to the swarm center persists even for large swarms, thereby maintaining their cohesion. The weakening of the accelerations at the swarm center for large swarms may possibly be related to the appearance of maximal size of swarms, beyond which they become unstable and split. Figure 2. Effective spring constants in the horizontal directions (K x and K y ) and the vertical direction (K z ) as a function of the average swarm radius R s , plotted on logarithmic axes. The black circles denote the raw data for each swarm, the red circles show binned averages, and the dashed lines denote the -R s 1 scaling predicted by the AGM (equation (7)). We also plot the -R s 2 scaling predicted for cylindrical swarms (regular gravity, equation (S15) in the supplementary material), which seems to fit the behavior of larger swarms Note that in the vertical z-direction the data is more scattered, which may be due to Earth's gravity.
To conclude this part, we find that the accelerations of midges near the swarm center follow the linear relation expected from gravity-like interactions. Furthermore, the effective spring constant decreases with swarm size, exactly as predicted by adaptivity. The effects of higher multipoles in the decay of the acoustic signal, are minor compared to the monopole term for large swarms, as shown in the supplementary material (equation S8). The effects of non-spherical swarms are dealt with next.

Effective spring constants: ellipsoidal swarms
In the measured swarms, the effective spring constant in the vertical (z) direction is consistently smaller than those in the horizontal (x y , ) directions [7]; additionally, it is also observed to decrease faster with swarm size than is predicted by our AGM for spherical swarms ( figure 2(c)). For real swarms, the z direction differs from the x and y directions in several ways. First, along this direction midges are affected by the Earth's gravitational pull. Additionally, swarms tend to form over visual features on the ground [34], which breaks the isotropic symmetry. Empirically, all these differences tend to cause larger swarms to elongate along the z-axis [7,34] (figure 3(a)). As we calculate below (and show in figure 3(b)), for swarms that are elongated along the z-axis, our model predicts that the effective spring constant in the x y , -plane (K 1,2 ) is larger than in the z-direction (K 3 ). We therefore attribute the observed smaller spring constant in the z-direction for larger swarms (figure 2) to the elongation of the swarms along the vertical axis. Furthermore, we can calculate the scaling of K 3 with swarm size in the limit of a highly elongated (cylindrical) swarm, such that it has a fixed radius R in the xy-plane and a variable length L R  along the z-axis. In this limit we find the scaling µ -K R s 3 2 (equation (S15) in the supplementary material), as denoted in figure 2(c). Note that in this limit, we are beyond the perfect adaptivity regime, and the scaling result for K 3 is identical to that of pure gravity.
In figure 4(a) we show the shape of a typical elongated swarm. We treat the swarm shape using an ellipsoidal approximation to refine the analysis of the effective spring constants along the different directions. We assume that the swarm is an ellipsoid with semi-axes a, b, and c, where < < c b a(see figure 4(a)), along the x y z , , -axes. The effective spring constants are then given by (see the supplementary material, equations (S16)-(S46)) and > > K K K 1 2 3 since < < c b a. Equations (11)-(13) relate the effective forces in the swarm to its overall shape. The measured values of the spring constants and shapes of the swarms are summarized in table 1. We characterize the shapes by the ratios of the moments of inertia-tensor eigenvalues h = I I 1 1 2 and h = I I 2 1 3 . As part of our ellipsoid approximation, we assume that the inertia eigenvectors are oriented along the principal axes of the ellipsoid and that each inertia tensor eigenvalue  1 3 as a function of the swarm size R s (blue circles: raw data for each swarm, red circles: binned average). For smaller swarms, the ratio is ∼1 which is the spherical limit, while for larger swarms this ratio is larger than 1 due to the elongation of the swarm in the z-direction ( > I I 3 1 , figure 4(a)). (b) Calculated spring constant ratio K K 1 3 for a prolate, axisymmetric swarm, using equation (21), as a function of the aspect ratio º p a c (solid line). For small p the behavior is linear, as given in equation (22). corresponds to one of the axes. Let us assume that > > I I I From equations (17) and (18), one can express the parameters of the ellipsoid as a function of h 1 and h 2 :   and then the ratios K K 1 2 and K K 1 3 can be obtained from equations (11)- (13). Note that in this analysis (table 1) the direction of each K i can be different, as they are defined by their relative strength so that > > K K K 1 2 3 . In all cases, however, the smallest effective spring constant is in the z direction ( = K K z 3 ), since we always observe that swarms are stretched in the vertical direction ( figure 3).
The ellipsoid parameters can be expressed in terms of the ratios of the inertia-tensor eigenvalues (equations (14)-(20)), thereby relating the effective spring constant ratios K K 1 2 and K K 1 3 to the measured shape. We plot these ratios for both measured swarms and for the model in figure 4(b). For smaller swarms, we find good agreement between the theoretical and measured values, where the discrepancies are primarily due to misalignment of the inertia-tensor eigenvectors with the principal axes of the ellipsoid. For the largest swarms, however, there is a significant deviation between the two. In those cases, the ellipsoidal approximation may not be valid, as we sometimes observed a tendency for these large swarms to split into a main body and satellite swarm and thus violate the assumptions of the model.
In the case of a prolate axisymmetric ellipsoid = < b c a, we have = K K where º p a c. For small deviations from spherical symmetry = +  p 1 , 1  we have This result is shown in figure 3(b).
To summarize the results of this part, our AGM explains why the elongation of the swarms along the vertical axis gives rise to lower effective spring constant that is observed in this direction, as well as to the different scaling with the swarm size (figure 2).

The virial relation
Despite the fact that adaptivity prevents us from formulating many conservation laws, we can still develop an analog to the virial theorem, based on mass conservation. In the supplementary material we derive the continuum tensor virial equations, while here we write its discrete analogues for N particles with equal (unit) masses. The moment of inertia tensor is We use upper indices for the quantities that are defined with discrete summation, contrary to the lower indices used in the supplementary material for the continuous case. In figure 5 we show the values ofM ij taken for Figure 5. The six components of the tensorM ij (equation (24)) that captures deviations from stationarity, as a function of the swarm size R s .
swarms of different sizes. Out of 126 measured swarms, we consider in this section binned data from 69 swarms that consisted of five midges or more, since for swarms with too few midges the average is meaningless. In addition we take time averages of the quantities over roughly one minute, so that the swarm is approximately in a steady state. The average values of the different components ofM ij are small compared to the typical angular momentum, which is two orders of magnitude larger. We therefore conclude that the midge swarms are stationary, and we therefore expect that the virial relation is its 'potential energy' tensor. This is not the usual potential energy since this system does not have a welldefined potential due to the adaptivity. Therefore the viral theorem is different from the usual form for powerlaw potentials, as explained in the supplementary material. The discrete virial equation is therefore (equation (S62) in the supplementary material) whereS ij is the average surface (external) pressure on a midge. It is easier to interpret and check the trace of the tensorial equation (27), namely the scalar form of the virial equation HereT is the mean total kinetic energy of a midge,W is its mean 'potential energy', andS is the mean isotropic surface pressure on a midge. In figure 6 we show the measuredT and -W 2 for different swarm sizes, when integrating over all the midges in the swarm. We can see that they are approximately constant as functions of R s and their mean values are á ñ = á -ñ = ´-- Therefore, according to equation (28), the difference between the two gives the mean surface pressure in the swarm: 1.24 0.14 10 cm s . 30 2 2 2 Figure 6. The mean kinetic energyT (red) and half of the mean 'potential energy' -W 2 (blue), as a function of the swarm size R s (as defined in equations (25), (26) and (28)).
This pressure is negative, indicating that the swarm is experiencing a stabilizing inwards effective pressure on its surface. The origin of this pressure could arise from interactions of the swarm midges with midges outside the swarm, and the 'swarm marker'. Such external stabilizing pressures are commonly found in astrophysical stellar systems, such as globular clusters [46]. In order to confirm that the identification of the mean pressure is correct, we consider each diagonal component of equation (27) separately as is shown in figure 7. From the mean values we get that Since these values are roughly equal it gives us a good confirmation for the isotropic origin of the pressure term in the virial relation (up to geometric deviations from spherical symmetry). Note that the observation thatW is independent of the swarm size when calculated over the observed density profile [7] of the whole swarm is in agreement with a calculation done using regular gravity [47].
In addition we see from figure 7 that the mean values of kinetic and potential energies, which are related to the movement in the z direction, are significantly lower than the x and y directions. This is a result of the external gravitational force in this direction that enters the equations (see equation (S49) in the supplementary material). From the point of view of the midge, it seems that it is more beneficial to respond to the effective pull of neighboring midges, rather than waste energy moving up and down against gravity.
The off-diagonal components of the tensorsT ij andW ij are roughly null (compared to the diagonal ones) as we show in figure 8. This is expected for a system without dissipation, which maintains stationarity. Note that on the 'microscopic' level of each midge, this system is obviously dissipative and out of equilibrium as the midge consumes chemical energy to power its flight. However, we find that on the coarse-grained scale of equivalent particles and forces, the system is effectively dissipation-less. The off-diagonal terms ofS ij vanish for a symmetrical swarm.
So far, we have not considered the adaptive nature of the interactions. Let us assume a uniform density spherical swarm and first calculate the dependence on R s without adaptivity. In order to calculate the behavior of the potential energy with R s , we consider again the continuous version of the mean 'potential energy' Figure 7. The diagonal components of the kineticT ii (red) and 'potential' -W 2 ii (blue) energy tensors (as defined in equations (25) and (26)). Figure 8. The off-diagonal components of kineticT ij (red) and potential -W 2 ij (blue) energy tensors (as defined in equations (25) and (26)).
where r k is the kth component of the vector r  .
In the case of a uniform spherical symmetric swarm we have is the volume of the spherical swarm. For a linear restoring force of the form In the case of gravitational interaction without adaptivity (equation (S4) in the supplementary material), the effective spring constant is and then we get a quadratic dependence on R s : The force with the adaptive correction is obtained by substituting equation (S5) in the supplementary material into equation (3): where º x r R s . Thus, for adaptive gravity in the purely adaptive regime, the 'potential energy' behaves as We now compare this result to the 'potential energy' contribution of the midges near the center of the swarm, where we expect to find the strongest effect of adaptivity. When we include all the midges of the swarm, the adaptivity is not significant since the midges with large radius ( > r R s ) and low density dominate the contribution to the total potential energy. For this purpose we calculated the 'potential' and kinetic energies of the same swarms (more than five midges) but this time the summation was carried out only up to an upper cutoff (R s and R 2 s ). Near the center of the swarm the density is roughly constant and high, so that the adaptive calculation of equations The 'potential energy' is not constant and it is increasing as a function of R s . In figure 9(b) we show that as the center of the swarm is approached (i.e. r is constrained to smaller values), the increase ofW with R s approaches a linear behavior, as we predict in equation (40). Note that this is very different from the quadratic behavior for regular gravity (equation (37)). This observation therefore constitutes an additional independent and strong source of support for our adaptive-gravity form of the interactions within the midge swarm.
The virial relation also allows us to estimate the effect of the swarm size on the mean distance of closest approach between two midges, which was found to decrease for increasing swarm size. This relation is given in the supplementary material (equations (S65)-(S72), figure S4).

Particle-based simulations
So far, we have demonstrated that the mean-field predictions of the AGM are in good agreement with the experimental results. To explore the AGM further, we performed molecular dynamics-type, agent-based simulations. To focus on the effects of the proposed adaptive-gravity interactions, we did not include in the simulation any explicit noise terms. Thus, the motion of each midge arises purely from their mutual interactions. However, to maintain numerical stability and cohesion of the swarm, it was necessary to augment the basic AGM (equation (1)) in three ways.
First, we added a short-range repulsion between midges. This repulsion prevents the fragmentation of the swarm into small groups (such as pairs or triplets) that can become effectively isolated from the rest of the swarm due to adaptivity-induced screening (equation (S73), figure S5 in the supplementary material); additionally, we previously found experimental evidence for this kind of short-range repulsion in real swarms [8]. With this repulsion, the effective force in equation (1)

  
Note that the midges in the simulations do not have a fixed speed, although this is the customary description of self-propelled particles. This is motivated by the observation of a wide distribution of speeds in the swarm [7]. However, to prevent runaway midges and to be physically realistic, we also imposed a maximum midge speed v . max If the midge speed exceeds this value, we re-scale it to that value And finally, we added an overall confining force to prevent the swarm from drifting in space, which simulate the experimental 'swarm marker'. This force is significant only far from the swarm center, acts as an effective reflection boundary condition for the simulations, and is intended to model the attraction to ground-based visual features that localize natural swarms [34]. Therefore its exact functional form is not important. It is given by where the marker size is set by = R R 1.5 marker ad . We do not, however, impose any differences between the vertical direction and the in-plane directions, and so our simulated swarms are statistically isotropic in space. Note that removal of this confining potential does not change the statistics of the dynamics within the swarm, in the swarm center-of-mass frame, as shown in figure S8 in the supplementary material.
The initial conditions in the simulations are as follows. The spatial coordinates for each midge are expressed in spherical coordinates r, θ, and j, and are initially random variables uniformly chosen between [0,R marker ], [0, π] and [0, p 2 ], respectively. The initial velocities are all zero. We then update the locations and velocities of each of the particles in time by solving the (Newton's) equations of motion of the particles (that is, using Runge-Kutta integration. Note that, unlike in real life and unlike in most models, the midges in these simulations do not have any intrinsic self-propelled motion; rather, their motion arises purely due to interactions, and can itself be viewed as an emergent property of the swarm. A sample trajectory of a single midge from a simulated swarm of N=50 midges, is shown in figure 10(a), which qualitatively resembled an observed trajectory ( figure 10(b)). The simulated mean acceleration of a midge towards the swarm center as a function of the distance from the center is shown in figure 10(c). We recover the linear behavior near the swarm center, as expected, while the forces saturate near the swarm edge due to the Gaussian density profile of the swarm ( figure 1(b)). The slopes near the center define the effective spring constants, and are found to decrease with the number of midges, just as they do in the experiments. In figure 10(d), we plot the distribution of midge accelerations, and find that it displays the same qualitative features found in the experiments [7]: the distributions are close to Gaussian for very small accelerations, but show heavy, exponential tails for large accelerations. And just as in the experiments, we find that these distributions are largely independent of the swarm size.
We also compared the velocity distributions from the simulations (figure 10(e)) as a function of the swarm size, and again found the same trend observed in the experiments [7]: as the swarm size increases, the velocity distributions also develop a long exponential tail. This behavior can be quantified by calculating the excess kurtosis of the x-component velocity distribution as a function of the swarm size (figure 10(f)), which follows the same qualitative behavior seen in experiments [34]. For very small swarm sizes, the excess kurtosis is slightly negative (meaning that the tails of the velocity distribution are slightly sub-Gaussian), and becomes positive for larger swarms. Finally, we also compare the calculated distribution of free-path lengths (defined along the trajectories between sharp turns) to the observations [8]. We find that our simulations recover very nicely the exponential tail of this distribution ( figure S7 in the supplementary material). The fact that our simulations, even without explicit noise and self-propulsion, give a qualitative description of the overall acceleration, velocity and spatial distributions in the swarms, provide strong support that the dynamics of the midges are indeed dominated by the type of interactions that we propose in this paper, i.e. the adaptive-gravity interactions due to acoustics. Our model even recovers specific features of the trajectories, such as the tendency of midges to form 'orbiting pairs' (figure S5 in the supplementary material), which was recently observed in experiments [39].
Let us note that in these simulations we did not fit any parameters in an aim to reproduce the experimental observations quantitatively. Rather, we focus here on exploring the qualitative features that arise due to the adaptive-gravity interactions. It is quite satisfying that the distinctly non-Gaussian distributions of the accelerations ( figure 10(d)) and of the velocity (figures 10(e) and (f)) already appear within our simple model, as well as the overall dependence of various features on swarm size. We anticipate that a more detailed model that includes, for example, the stochastic motion of an individual midge in isolation [34] or the Earth'(s) gravitational field, may be able to capture the mean-field behavior of the swarms quantitatively as well.

Discussion
We have presented here a model of collective behavior in insect swarms that is based on the way that midges are thought to sense their environment, i.e. through acoustic signals. The AGM we have constructed introduces features that are not typically considered in models of collective motion, including long-range interactions and a sensitivity to the global properties of the group (through adaptivity). As we have shown, these features combine to produce group cohesion as a natural emergent property. Basic assumptions of the model, such as the precise relation between the received sound and the force produced by the midge await future direct experimentation, by, for example, studying external acoustic perturbations of swarms [38]. However, by comparing the predictions of the model with detailed statistical data extracted from real insect swarms measured in the laboratory, we have demonstrated that our model is able to capture not just the cohesion of swarms but also many of their many-body dynamical properties. The excellent agreement between the AGM and the observed behavior of both the spatial profile of the average forces within the swarm (figures 2 and 4) and the virial relation ( figure 9), gives strong support to the model, and to its two main features: long-range (gravity-like) r 1 2 interactions and an adaptive response that renormalizes the effective forces according to the local noise amplitude.This simplified model can serve as a basis for future models that include more details of the midge physiology.
To conclude, this model opens the door for further tests of the large-scale behavior and stability of swarms Intriguingly, the agreement between the model and the empirical results raises the question of whether some of the well known phenomena that occur in self-gravitating systems, such as the Jeans instability or gravitational collapse [48,49], can occur in this biological system as well. This will be probed in future experiments, using acoustic perturbations of the swarm [38]. From the more general physics point of view, we describe here some of the richness introduced by considering adaptive interactions, which have unusual physical features and may apply as well to other biological systems-for example in the context of chemical sensing, chemotaxis-driven interactions between swarming cells (see for example [50]).