1. Introduction
Populations of living organisms are dynamic systems
which, under the action of some external action, may change [
1,
2]. such as resource availability, predation, and
environmental conditions-for example, climate change; along with internal
factors like mutations and diseases. Understanding these variations It is
important in ecology, evolutionary biology, and genetics. These factors show
the survivability of a species, and sustainability and balance of an ecosystem.
Naturally, ecosystems, organisms constantly adapt to a change in the
environment. When there is a sudden depression in resources, for example,
competition or drought may lead to a reduced growth rate or an overall decline
in population size [
2,
3]. Likewise, a sudden
plenty of resources can create a boom, which may be followed by resource
depletion. These dynamics are reflected in population growth curves and reflect
how a species interacts with its surroundings [
1,
2].
The study of these responses is necessary in that it enables us to predict how
a population might react to different stimuli in its environment.
In the modern ERA, it is possible to carry out
computational modeling and efficiently investigate such scenarios by
computational simulations. this provides a powerful tool for visualising and
analysing the complex interplay between environment, genetics, and increasing
population.
Gregor Mendel founded the basis for our knowledge
in inheritance with his three fundamental laws of inheritance [
4]:
Law of Dominance : When two different alleles are present in an organism, one may mask the expression of the other. The expressed trait is called dominant, while the hidden trait is recessive.
Law of Segregation :An organism possesses two alleles for a particular trait, which segregate during gamete formation. Consequently, each gamete receives only one allele from each pair, Ensures genetic variation in the offspring.
Law of Independent Assortment : The alleles of different genes are distributed to gametes independently of one another. Consequently, the inheritance of one trait generally does not influence the pattern of inheritance of another, given that the genes are on dissimilar chromosomes. or are far apart on the same chromosome.
The concepts established the basis of classical
genetics and allowed us to understand how certain traits move. through
generations and how genetic diversity arises in a population.
In the real world, population Studies take decades,
and it is difficult to study or predict populations under different conditions.
(e.g., lack of resources or low genetic diversity) for such a duration of time
(hundreds of Generations are assisted in software modeling, which helps in
simulating, analyzing, and predicting populations across: hundreds or thousands
of generations. It is also possible to do what-if scenario simulations-for
Examples include removal of a genotype or resource shocks—without interfering
with real populations. Hence, such simulations are resource-efficient. This
project attempts to simulate the growth and genetic composition of the
population over several generations using Python. By incorporating Following
Mendelian rules of inheritance combined with models of population growth, the
program traces the evolution of while changing genotype frequencies and overall
population size yield interesting interaction between the genetics and the
demographic factors. Therefore, combining a computational approach with
classical genetics Coupled with the interaction between these diseases and
population dynamics, this project thus presents a framework within which an
analysis of the long-term effects of environmental change and genetic variation.
By bridging the gap between theory and application,
Through better visualisation, we further our understanding of population
dynamics but also play to improve into predictive modeling in evolutionary
biology. Studying these responses is not only about Graphs and data constitute
only a small part; it deals with the living systems and the organisms in
general. share this planet. Each graph tells a story: the rise of a species, or
perhaps its fall, driven by the forces of nature. This is basically where, by
understanding these simulations, we put on nature’s shoes and explore Scenarios
that could take decades to develop.
2. Methodology
2.1. Basis of Population Growth
To study population growth, we require certain
variables and initial data.
2.1.1. Initial Population Data
Sex Ratio The sex ratio of a population is the
number of females per given number of males. For our case, we track the total
numbers of males and females in the population. This is critical, as it can
strongly affect growth trends. For example, if the number of females is very
low relative to males, initial growth will be slow until the difference reduces
and approaches balance.
Genotypic Data We use Mendelian inheritance;
therefore, we require the initial genotype counts to start the simulation:
| RR |
Homozygous dominant |
| Rr |
Heterozygous |
| rr |
Homozygous recessive |
2.1.2. Birth Rate (Natality)
Birth rate is the number of live births for a given
population in a given time period [
8]. In our
simulation, we treat the birth rate as the
average number of children
produced per mating pair. Birth rate determines how fast a population grows
and how well it can recover from shocks.
*Factors Affecting Birth Rate
Fertility of the population: Every individual has a reproductive capacity determined by reproductive health. If a greater fraction of individuals are infertile, the birth rate per pair decreases.
Resource availability: When a population demands more resources than the ecosystem can provide, resources are shared thinly. Individuals receive less than needed to remain healthy, indirectly lowering birth rate.
Sex ratio: In populations where polygamy is common, a higher number of females allows growth even with fewer males (tending towards a 1:1 ratio). Where polygamy is not common, birth rates collapse if too few pairs can form.
2.1.3. Death Rate (Mortality)
Death rate is the number of deaths in a population per unit time. In our simulation we model death rate as an
individual-level probability of death that may depend on external or internal factors [
9].
*Factors Affecting Death Rate
Resource consumption of the population: If the population demands more than the ecosystem can supply, health declines and mortality increases.
Diseases: Diseases or genetic disorders can significantly increase mortality overall or for specific genotypes.
Disasters: Stochastic disasters can cause sudden population declines.
2.1.4. Carrying Capacity (K)
Carrying capacity is the total amount of resources that the environment or ecosystem can provide [
1,
10]. It may vary by ecosystem and over time due to external drivers.
2.1.5. Resource Consumption per Capita (RCPC)
RCPC is the total amount of resources one individual needs to stay healthy and reproduce.
2.2. Assumptions Taken for the Model
Each Individual has one mate only.
Generation n will have lower death rates than generation n-1.
Generation n-2 will die out completely as they are too old to survive.
Birth rate depends on how much resources are present per individual in the population after reaching carrying capacity it becomes constant.
Death rate also varies with resource consumption per capita of the population.
Infant mortality rates, deaths due to diseases, etc are all included in the in death rate of the population.
2.3. Algorithm
The algorithm starts with population and environment initialization. The program then itera- tively simulates the cycle of pairing, reproduction, and death over multiple generations. New individuals are generated according to Mendelian rules of inheritance each generation, and death is applied probabilistically depending on available resources. The program repeats this cycle to produce realistic growth and decline curves of the population and changes in genotype frequencies.
2.4. Input
The simulation takes the following user inputs:
Homozygous dominant males:
Homozygous dominant females:
Homozygous recessive males:
Homozygous recessive females:
Heterozygous males:
Heterozygous females:
Ecosystem system data:
Enter Total resource availability:
Enter resource consumption per individual:
Birth rate:
Enter the number of generations to simulate:
These would be stored in some variables.
This information is retained in a list of tuples as the genepool. Each tuple has two items: genotype and sex.
For instance:
2.5. Birth Probability Calculation
Birth rate is taken as input from the user. We are considering birth as the average number of offsprings born per mating pair in the population.
The probability of the number of offsprings will be calculated using Poisson’s distribution [
7].
k = average births per mating pair.
λ = number of offspings for which we are calculating probability.
We take maximum k as 8.
Function for the following distribution is:
Also we are considering birth rate to be slightly higher when population size is significantly below carrying capacity of the ecosystem. After the population reaches a certain mark the birth rate stabilizes.
2.6. Pairing
Males and females are sorted into two lists and paired randomly. A male can only pair with one female per generation. Any remaining individuals (excess males or females) are retained in the current generation but do not add offspring in that cycle.
2.7. Crossing
The number of offspring per pair is determined for each pair using a Poisson distribution modified for resource consumption. Probability distribution is computed in the birthrate() function, taking into account both the intrinsic birth rate and the impact of resource availability.
Mendelian inheritance laws are then used to produce offspring genotypes:
The specific lines of code cover all possible pairs formed and assign sex at random.
2.8. Updation
Updates all the data to the current gene pool:
2.9. Death Rules
Once reproduction is over, the population experiences mortality due to age and resource utilization.
Old adults (generation n-2) are eliminated entirely (aging-related death).
Middle-aged adults (generation n-1) survive probabilistically via the resource() function.
Newborn adults (generation n) survive by the resource1() function, which provides them with slightly greater survival probabilities than old adults.
Both functions compute death probabilities as a function of the ratio:
death function scans each individual in the population and kills them at random chance. Which is calculated in the resource function.
2.10. Resource Functions
The function returns a list consisting of the probability of death based on resource consumption of the entire population. Where 1 is life and 0 is death.
4. Results and Discussions
4.1. Population Collapse for Lower Birth Rates
At low birth rates-roughly =
< 1.7-1.8-the population has an initial growth phase due to the initial favorability of resource availability and low mortality from density dependence[
2,
8]. However, it is not sustainable for the long term. Resource limitation begins to escalate as population size increases, resulting in increased mortality and decreased effective reproduction. Subsequently, it ends in a population collapse.
With the simulation framework, we can estimate the time to collapse defined as the generation at which the population size declines irreversibly below a viable threshold. This allows us to quantify how long populations can persist under subcritical birth-rate regimes and to compare collapse dynamics across different environmental and genetic scenarios.
We can estimate after how many generations population collapse occurs and how it depends on the following variables:
- -
Nt: Population size at generation t
- -
N0: Initial population
- -
TR: Total available resources
- -
RPC: Resource consumption per capita
- -
BR: Birth rate
- -
µ(λ): Average number of children produced per pair
- -

: Resource usage ratio
TR
The total population in the next generation depends on:
Survival of existing individuals, given by probability Sold(λ)
Survival of newborn individuals, given by probability Snew(λ)
Average reproduction — each pair produces on average µ(λ) offspring. Since only half of the population can breed (assuming equal sexes), the fraction of new offspring relative to the total population is 1 .
The total population in the next generation is directly proportional to the population in the previous generation:
Hence, population dynamics can be expressed through a survival constant R(λ), defined as:
Here R(λ) can be termed as the average of survivablity of both older and younger generations including the new born individuals of the population, it gives us as idea about the survival of the entire population in general.
This leads to the recurrence relation:
- -
If R > 1, the population grows or survives.
- -
If R < 1, the population shrinks and eventually collapses to extinction.
Also R(λ) is not constant for throught the time period a population exists but changes as λ changes for the population. ∴ It cannot be defined for the population but for the population at a specific time.
The number of generations until the population falls below one individual can be estimated as:
4.2. Stable Phase
We can observe that in simulation for birth rates above a certain threshold the population grows exponentially and eventually stabilizes at a certain level. Using the model we can estimate this stabilizing zone for any population.
A population will stabilize when its birth rate or the number of offsprings produced in a given time is equal to the death rate[
24]. If we were to describe it in terms of
R(
λ) it is the time when
R(
λ) for population is approximately equal to one.
Here:
- -
sold(λ) is a function that depends on λ and defines the survivability for older genera- tions.
- -
snew(λ) is a function that depends on λ and defines the survivability for younger generations.
- -
µ(λ) is a function that depends on λ and defines the birth rate of the population.
Let λ* be the solution for R(λ) = 1.
Now the number at which the population will stablize can be given as:
4.3. Birthrate as a Function of λ
However for our model due to computational limitations we use a discrete function of birthrate variation with λ we can represent µ as an exponential function of λ.
We know that fertility(birth rate) decreases exponentially as the population more and more resource pressure.
Therefore we can write:
Here Bmax is the maximum birth rate the population can achieve. Also the different types of environments and species can lead to different kind of dependence on λ which means the sensitivity to change in resource pressure can be different in each case. For this we define a sensitivity constant a which can be introduced in this equation as:
4.4. Behavior in Absence of Abundant Resources
Populations evolving under these parameter regimes are designed to approximate con- temporary human populations under high resource pressure. In natural systems, these conditions are typically characterized by much more demographic stability at the lower fertility rates, where the slower rate of population increase creates less strain on finite resources. At very high fertility rates, population growth should be rapid enough to quickly exceed ecosystem carrying capacity, and resource depletion, mortality, and—due to the assumed exponential dependence of mortality rate (µ) on resource pressure—the effective fertility rate should decline markedly.
However, this behavior, empirically expected, is not fully reproduced by the present model. On the contrary, the simulations show a larger stability of populations for higher birth rates, even under conditions of constrained resource availability. This is most likely the result of structural simplifications in the model, especially in how resource pressure feeds back to fertility and mortality dynamics.
Even with this limitation, this model does provide an essential insight: with severe resource scarcity, the minimum fertility rate needed to maintain a viable population is much higher than under resource-abundant or baseline conditions. This shift in the critical fertility threshold underlines how environmental stress can fundamentally alter the demographic requirements for population persistence.
4.5. Genotypic Analysis
This not only constitutes a strong basis against which internal consistency and biological plausibility can be measured for population-genetic models but also allows the assessment of the genuineness and reliability of model outcomes through the examination of whether simulated genotype frequencies conform to theoretically established expectations.
In this regard, we have done 20 independent runs of the simulation under the condition of plentiful resources and a fixed birth rate of 2.5 offspring per mating pair. For these runs, the total population stabilizes at an average of 8098 individuals. The corresponding genotype distributions converge to mean values of around 3756 heterozygous individuals, 2261 homozygous dominant individuals, and 2081 homozygous recessive individuals.
Let:
- -
p = frequency of the allele R.
- -
q = frequency of the allele r.
Also:
p = 0.51111
Now if we were to calculate p2 + 2pq + q2 using these values of p and q.
Which is approximately equal to 1.
This implies that the genotype frequencies given by the model satisfy the Hardy–Weinberg equilibrium, as expected for large, randomly mating populations in the absence of selection, mutation, or migration. We can therefore conclude that under resource abundant and demographically stable conditions, the model yields classical population-genetic behavior similar to that seen in real biological populations.
4.6. Genetic Disorders
4.6.1. Reproductive Recessive
A genetic disorder that manifests in the absence of the dominant allele R is called a recessive disorder. Such disorders decrease the reproductive fitness of the affected indi- viduals by reducing fertility by a specified factor. A typical case is Congenital Hypogo- nadotropic Hypogonadism (CHH)[
15], an autosomal recessive disorder due to the deficiency of gonadotropin-releasing hormone secretion (GnRH). This hormone deficiency causes impaired gonadal function, thus leading to lower fertility both in males and females.
These are modeled, in the simulation framework, by reducing the fertility of homozygous recessive individuals selectively (rr) while keeping the heterozygous (Rr) and homozygous dominant individuals (RR) unchanged. Over successive runs of simulation, the population shows growth and stabilization according to theoretical expectations from recessive fitness impairments.
Under these conditions, the homozygous-dominant genotype is the most frequent, but the heterozygous genotype (Rr) reaches a stable frequency and the homozygous recessive genotype is driven to very low—but nonzero—frequencies. Thus, it will never be completely eliminated from the population.
The persistence of the recessive allele provides a mechanistic explanation for the prevalence of recessive genetic disorders in natural populations. Affected individuals have reduced fertility, but the defective allele is preserved via heterozygous carriers who are phenotypically normal and continue to pass the allele to the next generation.
Quantitatively, after many simulation runs, the stable genotype counts converged to an average of about 5872 homozygous dominant individuals, 918 heterozygous, and 87 homozygous recessive individuals, with the total population stabilizing around 6877 individuals. These results align with established population-genetic principles that attend to the recessive disorders and how alleles persist due to carriers.
If we were to calculate p and q for the stable phase of such simulation. We get:
and
As we can see the allelic frequencies are way off the Hardy Weinberg equilibrium value [
5,
6].
4.6.2. Reproductive Dominant
Dominant reproductive disorders are a class of genetic disorders that manifest phenotyp- ically in the presence of the dominant allele R. Such conditions lower the reproductive fitness of affected individuals due to reduced fertility in all genotypes carrying the dominant allele R; this includes both heterozygous and homozygous dominant individuals, which can be represented as Rr and RR, respectively.
An illustrative example is autosomal dominant hypogonadotropic hypogonadism[
16], a disorder characterized by disrupted development and impaired signaling of gonadotropin- releasing hormone-producing neurons. The disruption further leads to reduced gonadal function and, therefore, lower fertility in both sexes.
For this disorder, the simulation framework uses the application of a fertility reduction to all carriers of the dominant allele, while homozygotes for the recessive allele (rr) are not affected. When the simulation has been run repeatedly, there is a characteristic evolutionary trajectory for the population: selection acts strongly and directly against the dominant allele, leading to its progressive decline and eventual elimination from the population.
Equilibrium is reached where the population settles to a point where only the recessive allele exists and the dominant allele is completely extinct. This result emphasizes the key distinction between dominant and recessive fertility-reducing defects: dominant defects are always exposed to selection, but recessive defects can pass through heterozygous carriers to subsequent generations.
4.6.3. Health recessive
Recessive health disorders these are genetic disorders that get expressed in the phenotype only if the individual does not possess the dominant gene, that is, only in homozygous recessive individuals (rr). These disorders impair biologic fitness by reducing survivability, which means that the chances of survival for the individual until reproductive maturity are reduced.
A classic example is Phenylketonuria (PKU)[
14], which is an autosomal recessive metabolic disorder due to the loss of function of the enzyme Phenylalanine hydroxylase. PKU, if not managed through dietary means, causes an accumulation of toxic metabolites, thereby causing development retardation and mortality.
In the simulated framework, recessive health disorders are represented through an increase in the homozygous recessive mortality rate, with heterozygous (Rr) and homozygous dominant (RR) individuals unaffected. This reproduces real-world simulations of recessive health disorders.
In particular, the population approaches stability for similar ranges of demographics, with the number of homozygous recessive persons censused being drastically reduced though the recessive gene is not totally wiped out. This is also due to the preservation of the defective gene in carrier heterozygotes, protecting it from selection.
4.6.4. Health Dominant
Dominant health disorders refers to the diseases that appear if an organism is carrying at least one dominant allele. This means that both heterozygous individuals with the genotype of Rr and homozygous dominant with the genotype of RR are regarded as having the health disorder. These disorders pose a threat to biologic fitness by causing low survivability rates, often leading to death before the reproductive age.
Dominant health disorders are simulated in the framework using a high mortality rate for all individuals with the dominant allele in the homozygous recessive state (rr), while individuals with the homozygous recessive state remain unaffected by health issues. Due to the influence of selection on the dominant allele in each generation, the selection pressure is strong.
In the repeated simulations, there is a clear and direct evolutionary outcome for the population. The gene frequency of the dominant allele diminishes quickly through the generations and eventually becomes extinct in the population. At the point of equilibrium, the population ends up with only the recessive allele, where all the individuals in the population are homozygous recessive.
This is in contrast to the type of dynamics that is observed for recessive health disorders, in which the deleterious allele is allowed to segregate via heterozygotes. The lack of any such refuge in dominant health disorders is what creates the purging of the deleterious allele, which is exemplary of the principal role of dominance in determining the persistence of the allele.
4.7. Disasters
4.7.1. Type-1
This kind of disaster creates a harsh demographic bottleneck[
11], hence applying a strong selective pressure on the population. Unlike sudden extinction events, in this case, a reduced population is achieved over a protracted but prolonged period, hence sufficient time for selection to become cumulative over a series of generations.
Such simulations indicate that in order for our numbers to successfully begin a recovery and sustained presence in these circumstances, a stable rate of procreation of 2.5 children per reproductive pair would be required. Furthermore, our calculations indicate that at the end of this global disaster, there would be 500 million human beings on this planet.
A theoretical rate of birth of 2.0 or perhaps a fraction lower may perhaps be sufficient to preserve population numbers under ideal circumstances with minimal selective pressure on a species and plenty of available resources. Taking into consideration other practical requirements in a post-disaster setting, population density will most likely be low, with a minimal remnant population scattered geographically and socially in very small groups. This leads to a reduction in effective mating population size, thus impacting reproductive efficiency[
12,
13].
Therefore, a birth rate of 2.5 or so is a much more realistic population requirement in a less connected population remnant under stochastic mating constraint and in a post-disaster selection pressure environment[
20,
23].
4.7.2. Type-2
Type-2 disasters exhibited a more severe demographic bottleneck due to a larger rate of decline of the population than in the case of Type-1 events. Stronger intensity of mortality over shorter timescales applies exceptionally high selective pressures, causing a very rapid decrease in population size and genetic diversity.
These parameters and outcomes of simulation studies suggest that, in such conditions, the human populations are able to avoid extinction and achieve their long-term persistence only at birth rates no lower than at least 3.0 offspring per mating pair. At lower levels of fertility, the population decline is rapid and irreversible, considering the combined effects of high mortality, reduced effective population size, and intensified selection.
By quantifying the simulation trajectories below, we estimate that in the wake of a Type-2 disaster, the human population would decline to as low as 32 million individuals. Recovery after the disaster is further hindered at such low population sizes by extreme population fragmentation, limited availability of mates, and increased stochastic effects[
17,
18] .
Accordingly, a birth rate of at least 3.0 is the practical demographic threshold needed to overcome the combined effects of a high mortality rate, decreased connectivity among the remaining groups, and environmental stress persisting during the aftermath of a Type-2 disaster.
4.7.3. Type-3
This class of disaster involves an extremely steep and rapid decline in the population, which results in an extreme demographic bottleneck over a very short time. The intensity of mortality and sudden loss of population impose very strong selective pressures that severely constrain recovery potential during an immediate post-disaster period.
The results of the simulations suggest a minimum stable birth rate of about 2.8 offspring for every mating pair is essential for a human population to successfully survive such a bottleneck event. If it were less than this, continued decline in population is expected due to the small effective population size with its associated higher stochastic mortality and restricted mating opportunities.
This consideration yields, according to the quantitative analysis, a conservative estimate that, in the wake of such a disaster, the number of humans surviving would fall back to about 80 million. In such a small population size, population fragmentation and reduced connectivity among surviving groups further hinder demographic recovery and increase the fertility threshold required above the normal rate for long-term persistence.
4.8. Limitations
Although it has produced important results concerning population and genotypic dynamics under varying environments and genotypes, among other aspects, some of the drawbacks of the current model are below:
Computational Constraints as
The model will not be able to realistically reproduce a very large population size due to the constraint of resources and processing capacity. The model will not be able to simulate over a very large number of generations because the long-term evolution will definitely be understated.
Single-Gene Inheritance Framework
The model is limited by single-locus, two-allele inheritance, which is a greatly simplified representation of the genetics of natural populations. Complex traits with multiple genes, epistasis, and polygenic selection are not accounted for.
Limited Accuracy Under Extreme Resource Pressure
Resource-dependent fertility and death rates are incorporated into this model, but under very high resource pressure, it fails to correctly model real population dynamic behavior. This is because simplified cycles of resource depletion, death rates, collapsed fertility, and recovery are not incorporated into this model.
Mutation Absence and Evolutionary Innovation. The above model does not take into consideration the role of mutation, gene flow, or adaptive evolution. Therefore, this model will not be able to incorporate new alleles and will not show any eventual evolution based on selective pressure. Such deficiencies suggest a slew of future considerations, including better scaling algorithms, multilocus genetics, evolution processes, and resource demography couplings.