Design and Analysis of Firefly Response to the Stimulus

Sanyukta Suman
The Startup
Published in
9 min readAug 6, 2020

--

Introduction

The dynamical system in simple words is a system whose state changes over time. The example includes the mathematical model that describes population growth, swinging of a pendulum, or predator-prey model. There are two types of dynamical systems: iterated maps and differentials equations. The iterated maps are used to solve problems where time is discrete, whereas the differential equation is used to solve problems where time is continuous.

Now confining our attention to differential equations, it can be divided into various types: Ordinary or Partial and Linear or Nonlinear, etc. In this report, we will deal with Ordinary differential equations and Nonlinear differential equations.

We can understand the idea of a dynamic system, ordinary and nonlinear differential equations by using an example of a population growth model. In any population, the number of individuals changes over time. The change in population can occur due to various reasons, for example, resource availability, competition, and disease. The simplest model describing changes in the population size is the exponential growth model. For simplicity, we will assume that the population does not interact with its environment and does not get affected by environmental changes. Therefore the equation will be

dn(t)/ dt = rn

Where dn(t)/ dt is a first degree ordinary differential equation, where r is a growth rate and n in the population size. Figure 1, shows an exponential growth in population.

Figure 1: Exponential growth in population.

Synchronization in Fireflies

Synchronization — the operation or activity of two or more things at the same time or rate, often occurs in nature. For example, neurons in our brain, cardiac pacemaker cells, blinking of fireflies in unison.

Oscillators are a system which has some kind of periodic movement and shows steady state behaviour over a period of time [1]. In nature some systems become synchronized through the oscillation phenomena. Oscillator is a huge area of mathematics, therefore, we will only describe phase oscillators in this report.

Entertainment of fireflies

Fireflies are the soft bodied beetles commonly known as lightning bugs for their use of bioluminescence during twilight to attract mates. When the fireflies begin to imitate light. The fireflies blink at their own pace and frequency, however there comes a time when thousands of fireflies start flashing on and off all at once. Most of the fireflies can modify their natural frequencies to match up with the fireflies around it.Here, every firefly is trying to dynamically synchronize its frequency with that of every other firefly. This synchronization phenomenon has been studied by many scholars. We are taking a simplified model from the chapter on Firefly from the book “Nonlinear Dynamics and Chaos” -by Steven H. Strogatz. Here in the model

In this chapter, Strogatz examines a model where firefly responds to rhythm of a flashing stimuli. Let us assume that the phase of the firefly’s flashing is given by θ(t) where θ=0 is the instant when the firefly emits the flash. We also assume that θ is 2π-periodic. Therefore, θ= 2πn. Then its natural frequency -the frequency at which it blinks without the presence of a stimuli be θ=ω. Similarly, now let us introduce a stimulus with 2π-periodic phase Θ(t) where Θ=0 is the instant of the stimulus flashing, and Θ = Ω is its frequency.

As we know that, firefly will attempt to synchronize with the stimulus, if the stimulus flashes after the firefly then firefly will attempt to slow. Similarly, if the stimulus is flashing before the firefly then the firefly will attempt to speed up to synchronize with the stimulus. We can describe this model with an equation as

Θ =˙ ω + A sin(Θ − θ) (1)

Where A is a measure of the ability of firefly to change its frequency in response to a stimulus, and (Θ − θ) is a phase difference between the stimulus and the firefly. In order to have a better picture of a above equation (1), we plotted a graph by giving a initial value for ω , Ω and A. Figure 2, shows the curve for phases of firefly and the stimulus.

Figure 2: Phase of firefly and stimulus.

From this equation we can imply that if 0 < Θ − θ < π, which means stimulus is ahead of the firefly, meaningΘ˙ > ω, therefore the firefly speeds up. Similarly, if −π < Θ − θ < 0, meaning Θ˙ < ω, and the firefly slows down.

Now that we have a model, we analyze the firefly’s response to the stimulus. When the entertainment occurs, the difference in phase between the stimulus and the firefly φ approaches a fixed constant. This can show various behaviour in the system : phase synchronization, phase locked, phase drift. Using equation,

φ˙= Ω − ω − A sin(φ) (2)

If the constant is 0, that means that the firefly has synchronized with the stimulus and the firefly and stimulus are flashing together. We can show this phenomenon by solving equation (2) and plotting the graph for φ vs time, where time is in the range of 0 to 2π splitted into 1000, and the initial value for ω and Ω is 11.5564 Hz. Figure 3 shows the phase synchronization.

Figure 3: Phase Synchronization

Similarly, if the constant is not 0 then it can show two different behaviours. The firefly can either be in a phase locked to the stimulus, meaning that firefly and the stimulus have the same instantaneous frequency, but the firefly will always flash behind or ahead by a fixed amount. Figure 4 shows Phase locked behaviour.

Figure 4: Phase locked.

Finally, if the constant is not 0 and if the frequency of the stimulus is too high or too low then firefly will struggle to match the frequency of the stimulus, and thus entertainment will not occur, this behaviour is known as phase drift. Figure 5 shows the phase drift behaviour.

Figure 5: Phase drift

Fixed Point and Stability Analysis

In previous figures (3,4,5) we saw the phase difference trajectories of different behaviour in the system. Now, to analyze the stability of these behaviours, we can examine the stability of the fixed points. Fixed points are defined by f(x)=0, it is a point which remains stagnant when the system changes along with the time. We can examine the stability by plotting a graph for φ˙ versus φ using equation (2). For each type of behaviour, there are different types of stability of the fixed points. For figure 6, stable fixed point is at φ = 0 which corresponds to phase synchronization, for figure 7,stable fixed point is at φ = c where c is a real constant, which corresponds to phase locked, and finally in figure 8 there are no stable fixed points.

Figure 6: Phase Synchronization Figure 7: Phase Locked

Figure 8: Phase Drift

In order for entertainment to occur , φ should move along with c as time move along with the infinity, here c can be any real number including 0, therefore, for the simplicity we consider c=0, which means fixed point , φ˙ = 0. From equation (2), we can write,

0 = Ω − ω − A sin(φ) (3)

sin(φ) = Ω − ω /A (4)

We know that −1 ≤ sin(φ) ≤ 1, therefore equation 4 will be,

−1 ≤ Ω − ω/ A ≤ 1

−A ≤ Ω − ω ≤ A

ω − A ≤ Ω ≤ ω + A (5)

Therefore, from equation (5) we can say that for the entertainment to occur omega should be between ω − A and ω + A .

We also found out that parameter A also affects the behaviour of the system. According to the plot, larger values of A cause phase synchronization, shown in figure 9, whereas smaller values cause phase drift and phase locking shown in figure 10 and figure 11 respectively.

Figure 9: Phase Synchronization Figure 10: Phase Locked

Figure 11: Phase Drift

Firefly synchronization with two stimuli

So far, we were working with a simple model which had one firefly and one stimulus. We can call this a single stimulus case. But how will the fireflies react to the two different stimuli — stimulus 1 and stimulus 2 represented by Θ1 and Θ2 respectively, meaning two different frequencies? We can explore this case by building another model. The model will be the same as the equation (1). For both the models we will use the same parameters for phase of firefly but two different phases for two different stimuli. Let the frequencies of stimulus 1 Θ1= Ω1 and the frequency of stimulus 2 Θ2=Ω1. Let the phase difference between simulus 1 and firefly and phase difference between stimulus 2 and firefly be φ1 = Θ1 − θ and φ2 = Θ2 − θ respectively. Let us suppose a model that predicts the phase of the firefly change be

θ = ω + A sin(φ1) + A sin(φ2) (6)

We can call equation (6), multiple stimuli models. We know that φ1 = Θ1 − θ and φ2 = Θ2 − θ, therefore we can write equation (6) as

φ˙ 1 = Ω1 − ω − A sin(φ1) − A sin(φ2) (7)

φ˙ 2 = Ω2 − ω − A sin(φ1) − A sin(φ2) (8)

Suppose frequencies for stimulus 1 and 2 both are same, then Ω1 = Ω2. As a result φ1 = φ2. This will be the case where we will not have different types of stimuli, the model will act as a single stimulus model.

However, if the frequencies for stimulus 1 and 2 both are not same, then Ω1 is not equal to Ω2. In this case, when the firefly will begin to change its frequency to match that of stimulus 1, phase difference φ2 will increase or decrease, but then phase difference φ2 will also increase or decrease along with the φ2. Therefore, the trajectories of φ1 and φ2 will be uniformly increasing and decreasing. Thus the firefly will never synchronize with the stimuli, but instead will cause phase drift with both the stimuli.

Figure 12: Firefly behaviour with two stimuli

Conclusion

We tried to understand firefly synchronization in presence of the stimulus. In the model which had only one stimulus, showed three different kinds of behaviour — Phase synchronization, Phase locked and Phase drift. Phase synchronization only occurs when frequency of the firefly and the stimulus is the same, otherwise either the firefly and stimulus and in phase locked state or phase drift state. We also tried to analyze behaviour in the change in the resetting strength (A) of the firefly. We found out that large resetting strength may result in phase synchronization, however, less A will cause either phase lock or there will be no entertainment at all. Finally we tried to see the behaviour of the firefly when two stimuli are present. From the model we found out that in presence of two stimuli, if the frequencies of both the stimuli is same then synchronization can occur, otherwise they will not synchronize.

References

[1] The Oscillator Principle of Nature- A simple Observation

[2] Runyeon, Hope. “Firefly Synchronization.” (2006).

[3] Strogatz, S. H. Nonlinear Dynamics and Chaos, with Applications to Physics, Biology, Chemistry, and Engineering. Reading, MA: Addison-Wesley, 1994.

--

--

Sanyukta Suman
The Startup

Engineer + Loves Computer Vision, ML, Programming, Robotics and Technology. https://sanyuktasuman.com.np