The Power of Mathematical Modeling
What do online rumors, computer viruses and zombie apocalypses have in common?
Hey! It’s Tivadar from The Palindrome.
This week, it’s my pleasure to introduce Manlio De Domenico, Ph.D., a fellow scholar working at the forefront of physics, mathematics, and computer science.
One of the main reasons behind the success of modern science is mathematical modeling, the process of translating complex real-life observations into a language that allows us to generalize, understand, and predict.
If you have enjoyed this post, subscribe to his newsletter Complexity Thoughts, a space dedicated to translating the complexity of the empirical world, from your cells to entire societies, into language that is as simple as possible, though not necessarily simpler.

In 2000, a computer worm named ILOVEYOU infected millions of machines in a single day.
Two years later, a post-apocalyptic horror movie directed by Danny Boyle — 28 days later — was released. A story about how humans turned into zombies after getting infected by a virus.
Despite their stacking differences, both follow the same simple logic: interactions lead to contact, contact allows transmission, and transmission triggers transformation.
The surprising fact? Mathematics can capture that logic with striking simplicity and remarkable explanatory power.
Today we will see this in action with a twofold purpose: by focusing on these two seemingly different contagion processes, we will show how the same math can be fundamental to describe what’s going on — and, more broadly, why modeling matters.
Act 0 – What’s a model?
Mathematical models are not decorations on science: they are thinking tools. They allow us to distill messy realities into a few essential gears, showing how motion in one part turns another. This becomes immediately useful when the world feels too complex to grasp: a model offers a translation from tangled stories to relationships we can reason about, test, and sometimes even control.
However, a good model is not meant to reproduce every detail of reality: its purpose is to be useful, helping us identify what can drive a phenomenon, what can be ignored and where small interventions create large effects. The art of modeling lies in choosing the right simplifications: keeping what matters, discarding what doesn’t.
Compartments: how to turn “stories” into equations
In the vast universe of mathematical models, we will focus on contagion because its complexity can be captured in an elegant way.
Which complexity? Well, we should consider that there are people that take the bus or the metro, go to the cinema or supermarket, kids going to the school, people meeting in companies, at any hour of the day, in different part of a cities, or an entire country. These events actually corresponds to some form of interaction, each one able to trigger the reaction chain: contact → transmission → transformation.
In the animation below, that I have built from the amazing ComplexityExplorables, it is possible to appreciate a computer simulation of this process in a very simplified digital world without buses, metros, supermarkets, schools, just four groups (or communities). Initially, the majority of people are healthy and susceptible (white) to the virus brought by sick and infectious individuals (red). Because of random contacts, the virus can spread among individuals, and their movement can spread the virus from one community to another. If the disease is like a seasonal flu, red individuals turn into recovered (grey) after a while: they get healthy again. And after more time, those ones who recovered can become sick again, and so forth and so on.
However, if once get infected one cannot recover, all individuals will eventually turn red, as towards the end of the simulation, where I have intentionally changed the virus.
Obviously, this complexity is cumbersome: uncountable and often untrackable interactions, different immunological response (e.g., from a few symptoms to high fever) from different people, different behavioral response (e.g., from staying at home to compulsory job presence), just to mention some.
However, when we model epidemics we do not track every individual. We often make the rather simplifying assumption that they are like some labeled/colored particles, and we group them by state (i.e., the color) into compartments.
A compartment is simply a box collecting things that behave the same way: uninfected computers, infected ones, or those that can no longer be infected (like the recovered). Therefore, the story of a contagion then becomes a story of flows between those boxes: one box loses what another gains, exactly as in the illustration below.
Mathematically, we can use a minimal map like this:
where each arrow represents a rate indicating how often a change of state happens. Once the compartments and flows are clearly defined, the equations almost write themselves. The rest is interpretation.
Act I — The cyber epidemic
In May 2000, the ILOVEYOU worm spread through email attachments. One infected computer sent the same message to every contact in its address book; each new victim did the same. It’s a perfect digital analogue of infection.

Since there’s no natural recovery until someone patches (with an antivirus) or isolates the system, the right compartment model for this process is SI: the story is
where S denote uninfected computers, I the infected machines and β is the rate of successful transmission. Furthermore, let’s also forget about the specific interaction patterns of the machines: instead of caring about which computer is exactly connected to which other computer, let’s work under the “well-mixed” assumption that any infected can contact any susceptible. We are now ready to transform the above story into an equation, relating the rate at which the number of infected individuals increase with the other variables:
At the start, almost everyone is uninfected, so S ~ N, where N is the total number of machines in the world:
That single line explains the worm’s explosive global reach: exponential growth until the susceptible pool runs out (or, equivalently, until the S box becomes empty). Control, in this view, is mechanical: reduce β (slower transmission) or reduce S (fewer vulnerable systems).
What happens next? When the number of infected machines increases, we can no longer approximate and we must write S = N - I. The equation turns into:
The last step, obtained after elementary algebra, provides us with an operational way to estimate the fraction of infected machines over time, according to the model:
That’s pretty cool, isn’t it? Overall, because the shape of the two curve is very similar to the observed ones, with the difference that computer scientists responded back by writing an antivirus able to stop the virus. We could model that by adding the R compartment after some time.

Act II — The Anatomy of a Zombie Apocalypse (S–I–Z–R)
Now let’s make it cinematic, but still mathematical. Do you remember the movie “I am legend” starring Will Smith?

Suppose we have four compartments: S (survivors, susceptible humans), I (infected but not yet zombies), Z (zombies, fully infectious) and R (recovered/removed because immune, deceased, or isolated). The zombie flowchart is given by:
a bit more complicated, although very similar in spirit, to our previous example, where each arrow translates into a rate term. The system dynamics reads:
with N = S + I + Z + R. Early on S ~ N (nearly the whole population consists of susceptible individuals), so the basic reproduction number is
If it is larger than 1, the outbreak grows and zombies spread faster than they’re neutralized. Conversely, if it is smaller than 1, it dies out and humanity survives!

Act III — From well-mixed to networked worlds
So far, we’ve imagined a “well-mixed” world, as if everyone could meet everyone. However, real contagion, digital or biological, spreads on networks: a few hubs connect widely, most nodes connect locally. This structure changes everything:
Ignition: infections that start near hubs explode faster.
Control: targeting those hubs (email relays, hospitals, influencers) is far more effective than random protection, although they are often harder to locate than one could imagine.
The header image of this post shows the air-transport network: airports connected by flight routes, a primary pathway for moving pathogens between countries. Likewise, social networks provide the contact structure for transmitting disease, and the Internet provides the connectivity that enables the spread of computer viruses.

The same logic explains why ILOVEYOU spread via central mail servers and why social media virality behaves like an epidemic of ideas. In both cases, patching or isolating/immunizing the hubs can dramatically changes the system’s trajectory.

Modeling as “compressed understanding”
Mathematical models are compressed stories about cause and effect, how small interactions scale into global patterns. They do not predict the future with certainty, but they make the invisible visible: how rates, connections and structure shape collective outcomes.
Whether the contagion is viral code, zombies or ideas, the same framework applies (compartments, rates, networks). Once you draw the boxes and trace the arrows, you see where and how to act. What’s the take-home message? This one:
The power of mathematical modeling lies in its clarity: it shows that even in chaos, there is structure and in structure, the possibility of understanding.
If you have enjoyed this post, subscribe to Complexity Thoughts, a space dedicated to translating the complexity of the empirical world, from your cells to entire societies, into language that is as simple as possible, though not necessarily simpler.














Thank you so much, Tivadar, for hosting my post in The Palindrome, one of the best Substacks out there.
SIRS has always seemed an oversimplification to me. "Dead" shouldn't be counted the same as "Recovered" in pandemic modelling. We're seeking to minimise deaths while maximising recoveries. The model should reflect that and assist us with that goal.