First-order systems are the systems that do not have higher-order derivative term other than first-order derivative term in their differential equations. These systems are not just mathematical: They can be found everywhere and in our everyday life. Dissolving sugar in coffee, growth of bacteria population in a test tube, radioactive decaying and many other things can be mathematically modeled as a first-order system. Studying nonlinear dynamics and first-order systems taught me how biology contains mathematics. Especially population biology has different kinds of differential equations governing the populations’ size.
The critical thing about first-order differential equations is that they approach some value as the time approaches infinity. They can diverge to plus or minus infinity or converge to a particular value. This is why we usually get exponential functions when we solve them analytically. Equilibrium points, where the differentiation is zero, determine this convergence behavior.
First-order implies damping. If a system is first-order, it will converge to some particular value because of the damping. If the system output approaches infinity, there is still damping; however, it is negative. In nature, almost no such systems exist.
Another critical issue about first-order systems is that no oscillations exist in these systems: Oscillations require second-order differential term. For example, imagine a block of mass m attached to a spring and release the spring from a particular height. The system will oscillate, and this implies we have a second-order differential equation governing the motion, which is named as “Simple Harmonic Oscillator Equation” (above). However, imagine this case: The mass is moving on a rough surface, and there is a lot of friction. Will it oscillate?
The answer is no. It will slow down gradually and stop somewhere without oscillation. If the surface is too rough, first-order damping term coefficient b in the equation will be too large, and m will be too small beside it so that we will ignore m in the equation. If we ignore m, second-order derivative term drops, and we obtain a first-order differential equation. So discussions in this article also apply to oscillatory systems with extreme damping.
Now let’s discuss why it is hard to solve these first-order equations analytically. Commonly found differential equations are not like those you solved in differential equations class: They are nonlinear and complex. Even though it is sometimes possible to solve the equation, we do not go in this way. Let me explain it with an example. Check the differential equation below and try to solve it analytically:
Although it looks like a piece of cake, it is not. A complicated function comes out as the solution, and this solution also does not clearly show which value will the system converges. This is the analytical solution of the equation (obtained from Wolfram Alpha):
This is a perfect example to show that solving analytically is not always the best option. So what can we do? How can we understand the system without such pain and suffering? We have two ways: Using nonlinear dynamics methods, using numerical analysis.
The most practical way is drawing state-space graphs. Considering the previous system, we can draw this graph:
As you can see, when the function is above the x-axis, the derivative is greater than zero, and when the function is below the x-axis, the derivative is less than zero. The plot’s points intersect the x-axis are the equilibrium points: The derivative is zero in those spots. If we start the system just in these points, the system will stay the same because the derivative is zero.
Let’s go one step further. Imagine the x-axis as the location and the y-axis as the velocity. In the regions where the plot is above the x-axis, the velocity will be positive so that the system will move to the right. Similarly, when the plot is below the x-axis, the velocity is negative, and the system will move to the left. Let me show that with arrows on the graph:
As you can see, arrows point to and away from equilibrium points. The points where the arrows point towards are the stable equilibrium points. The points where the arrows point away are the unstable equilibrium points. What does that mean?
It means that we can find the value, which the system will converge to as time approaches infinity. For example, if we release the system from x = 1, the arrow will lead us to the point x = pi. Similarly, if we release the system from x = -0.00001, the system will converge to -pi, the stable equilibrium point where the arrow shows in that region. If we start the system from exactly x = 0, the system will remain there because it is also an equilibrium point. However, if we move to the left or right slightly, the system will converge to the stable equilibrium point.
This is a very practical and fast method, and it allows us to understand how the system behaves immediately. Another technique is using numerical analysis. Using Euler, Runge-Kutta 2, or Runge-Kutta 4 methods, we can calculate the value where the system converges to for a given initial condition. This method also explicitly shows the converged value and it is even easier than the previous way if you have a program that solves the equation.
I wrote a C++ code to solve such first-order differential equations. I was learning C++ and wrote it as a practice, but it is convenient in these calculations. I will talk about the numerical analysis methods and the code in my next article. I am only adding the link to the code at the end of the paper and sharing the results.
Let’s solve the above system using numerical methods. When we insert the equation in place and run the code using any of the methods with 0.1 step size and x = 1 initial condition, I get these results:
The value of x converged to 3.14159, which is the value of pi as we predicted. The remaining results are all equal to pi.
This is another way of determining first-order systems’ behavior. You can use either of them to find how the system will behave without solving the differential equations analytically.
Now skip to a different example of population biology. Imagine the bacteria in a test tube. If there are no bacteria in the tube, there will not be ever; however, if you put one bacteria in the tube, you will have many bacterias soon later. Therefore, we can state that x = 0 is an unstable equilibrium point. The tube’s bacteria population will not grow infinitely; after a threshold is passed, the tube’s resources will not support the whole population and the population size will decrease, and will always be around that threshold. This threshold is the stable equilibrium point.
This is the differential equation that governs the bacteria population in a tube:
k is the proportionality constant that determines how fast he bacterias reproduce and L is the carrying capacity.
Draw the state-space graph (Taking L=1000 and k=5):
As you can see it is a parabolic graph.
Draw the arrows:
Graph analysis led to our statement: x = 0 is an unstable, x = L is a stable equilibrium point. If we start from non-zero bacteria in tube condition, we will have around L bacterias soon.
Using step size of 0.1, the initial condition of 0.0001 (assume it represents one bacteria), method of RK-2, L = 10, k = 5, I obtained the following results by inserting the equation in the code:
Even though we started from a very little number, the population reached its carrying capacity very fast.
And these are the results with the same settings except initial condition is x = 2500 > L = 1000.
If the bacteria population is larger than the carrying capacity, the bacteria population size will decrease to the carrying capacity. We reach the carrying capacity again.
First-order systems are found everywhere in our lives and even if we are not physicists or engineers, understanding them brings us a different view to see the Universe. Once you know the behavior of first-order systems, which is damping, you can easily implement the two methods I explained and quickly understand the system’s future.
You can reach the C++ code I wrote to solve the systems: https://drive.google.com/file/d/1CbVnamaDeiAEIqoxHYJLNoMy_82ZVS20/view?usp=sharing
You can compile and run the code in the website: cpp.sh/
You can follow me on Twitter: twitter.com/metehantasci_