23 US Competition (Question A) Complete Code of Mathematical Modeling + Full Analysis of the Modeling Process! Plant model adaptability, Alpha diversity analysis! Lotka-Volterra model modeling

To study the adaptability and survivability of plant communities during irregular weather cycles, we can use individual-based models to describe the dynamic behavior of the community. The model can take into account the following factors:

Species richness: Considers the number and types of different species in a community. Models should document each species' growth rates, reproductive and mortality rates, as well as interactions (such as competition or mutualisms).
Weather conditions: Record rainfall and temperature at each time step, as well as the probability and severity of droughts and other climate events.
Community ecology factors: Consider interactions within plant communities such as competition, symbiosis, and reproductive limitations.
External ecological factors: Consider interactions between a community and the surrounding environment, such as food webs, predation, and habitat changes.

Insert image description here

The model can use algebraic equations, difference equations, or differential equations to describe the dynamic behavior of plant communities. We can use numerical simulations to simulate community behavior over multiple life cycles to understand how plant communities adapt to different weather conditions and changes in species richness.
Exploring long-term interactions: By analyzing model results, we can explore long-term interactions between plant communities and the environment. Here are some possible conclusions:

Species richness: Model results show that the adaptive capacity of plant communities increases with species richness. Introducing more species into a community may increase the community's viability.
Species type: Model results show that different types of species in plant communities have different adaptability to drought. For example, grasses may be better suited to drought conditions than shrubs. Therefore, the introduction of more adaptable species into a community may increase the fitness of the community.
Weather changes: Model results show that changes in the frequency and severity of droughts can affect the ability of plant communities to adapt. If droughts occur more frequently, communities will need higher species richness to survive.
We need to take into account the dynamic processes of plant communities, including plant growth, death, reproduction, etc. On this basis, we also need to take into account environmental changes in the plant community, including the effects of weather changes and other external factors. Therefore, we can build the following model
:
Insert image description here

Among them, N i N_iNiThis is number iiThe number of individuals of species i ; is the intrinsic growth rate of the species; is species iii andjjCompetition coefficient between j , α ij \alpha_{ij}aijIndicates species jjThe effect of j on species i;K i K_iKiis the maximum capacity of the species under current environmental conditions, that is, the maximum number of individuals supported by the environment; di d_idiis the mortality rate of the species.
This model describes changes in the number of individuals of each species in a plant community over time. Among them, the first term represents species iiThe growth rate of i , including the inherent growth rateri r_iriand the impact of competitive pressure; the second term represents species iiThe death speed of i , that is, the death rate di d_idiand the number of individuals N i N_iNi
product of . Competition coefficient α ij \alpha_{ij}aijReflects the impact of species j on species i, when α ij > 1 \alpha_{ij} > 1aij>When 1 , species j has a negative impact on species i; whenα ij < 1 \alpha_{ij} < 1aij<At 1 , species j has a positive impact on species i.

Next, we consider how to take environmental factors like drought into account. Drought can cause environmental degradation, affecting plant growth and reproduction. We can introduce environmental factors into
K i K_iKi, to reflect the impact of environmental changes on the number of species:
​whereInsert image description here , K i ˉ \bar{K_i}Kiˉis the maximum capacity of the species under normal environmental conditions; DDD is the degree of drought, the value range is[0, 1] [0,1][0,1]
γ \gamma γ is the sensitivity coefficient of the species to drought. Drought level DD
in the modelD can be estimated based on actual conditions. For example, it can be predicted based on historical meteorological data or climate models. Additionally, the degree of drought can be determined based on the water status of the plant community.
Now, we need to set some assumptions for plant growth. Assume that the life cycle of each plant is the same, and during its life cycle, it can grow with probabilityα \alphaα reproduces with probabilityβ \betaBeta death. In the model, we useni , t n_{i,t}ni,t, means at time ttt
, kindiiThe number of individuals of i . Then, for each species, we can update its quantity as
:Insert image description here

Among them, SSS is the total number of species,aij a_{ij}aijis species iii andjjThe interaction coefficient between j . This interaction coefficient represents species
jjj and speciesiiiThe strength of the interaction. For example, if
aij = 0.5 a_{ij} = 0.5aij=0.5 , then when speciesjjInsert image description hereWhen the number of jInsert image description here
is, it will have an impactIfα ij < 0 \alpha_{ij} < 0aij<0 , then species J will have a negative impact on the number of species i, that is, reduce its number.

Next, we need to consider the effects of drought. Suppose we have a drought event occurring, it will occur at time t 0 t_0t0
Start and last D time steps. During droughts, reproductive rates of all species decrease, so we can define α \alphaThe value of α is reduced toα ′ \alpha'a , and returns to the original value α \alphaafter the drought endsα . For simplicity, we defineα \alphaα andα ′ \alpha'a' are set to the same value. Therefore, we can
modify the update formula of to
:Insert image description here

We have now developed a plant community model that incorporates interactions between species and the effects of drought. The next step is to add consideration of biodiversity to the model.

We can think of interactions between different species in a community in the following ways:
Competition: Different species compete with each other for limited resources, such as water and nutrients.
Cooperation: Some species may live in symbiosis, promoting each other's growth.
Predation: Some species may prey on other species.
We can consider these interactions using the following equation:
Competition: The growth rate of each species should be affected by the number of other species and the competition coefficient, which reflects the degree of competition between different species.
Insert image description here

​In that
, N i N_iNiRepresents the iithThe number of i species,ri r_iriRepresents the iithCompetition-free growth rate of species i , C ij C_{ij}CijIndicates the jjthspecies j versus iiCompetition coefficient of species i , K i K_iKiRepresents the iithThe environmental capacity of species i .
Cooperation: The growth rate of each species should be affected by the number of symbiotic species and the cooperation coefficient, which reflects the degree of cooperation between different species.
​Among themInsert image description here
,A ij A_{ij}AijIndicates the jjthspecies j versus iiThe collaboration coefficient of species i .
Predation: The growth rate of each species should be affected by the number of predators and the predation coefficient, which reflects the degree of predation among different species.
Insert image description here

Among them, P ij P_{ij}PijIndicates the jjthspecies j versus iiPredation coefficient of species i .
Considering these three interactions comprehensively, the following equation can be obtained
:Insert image description here

Therefore, we can use this equation to predict changes in the abundance of different species in a community over time, including periods of drought.

Used to simulate changes in plant communities over time, including drought cycles and interactions between different species. This model assumes that every species in the plant community has the same code for growth rate, death rate, and drought resistance:

import random
import matplotlib.pyplot as plt
 
# 模拟参数
num_species = 4         # 物种数量
pop_size = 1000         # 群落初始总体积
time_steps = 500        # 模拟时间步数
rainy_season_len = 100  # 雨季的长度
dry_season_len = 50     # 干季的长度
reproduction_rate = 0.01  # 繁殖率
mortality_rate = 0.005    # 死亡率
drought_resistance = [0.5, 0.7, 0.9, 1.0]  # 干旱抵抗力
 
# 初始化物种
species = [i+1 for i in range(num_species)]
 
# 初始化种群数量
population = [pop_size//num_species for _ in range(num_species)]
 
# 记录种群数量的变化
populations_over_time = [population]
 
# 开始模拟
for t in range(time_steps):
    # 判断当前是雨季to see the full version below 还是干季
    if t % (rainy_season_len + dry_season_len) < rainy_season_len:
        drought_resistance_factor = 1.0
    else:
        drought_resistance_factor = random.choice(drought_resistance)
 
    # 对每个物种进行模拟
    for i, s in enumerate(species):
        # 计算出生和死亡数量
        births = reproduction_rate * population[i] * drought_resistance_factor
        deaths = mortality_rate * population[i]
 
        # 更新种群数量
        population[i] = int(population[i] + births - deaths)
 
        # 确保种群数量不会变为负数
        if population[i] < 0:
            population[i] = 0>?DA?SD to see the full version below 
 
    # 将本步骤的种群数量添加到列表中
    populations_over_time.append(population)
 
# 绘制图表
plt.figure(figsize=(10, 5))
for i, s in enumeto see the full version below rate(species):
    plt.plot(range(time_steps+1), [p[i] for p in populations_over_time], label='Species {}'.format(s))
plt.xlabel('Time')
plt.ylabto see the full version below el('Population')
plt.title('Plant Community Dynamics')
plt.legend()
plt.show()

The model simply simulates plant communities being randomly exposed to different drought cycles over time. The simulations show how the abundance of each plant species changes over time, with interactions between different species becoming more apparent over time.

Question 2:

The greater the number of species in a community, the more stable and functional the ecosystem is. In mathematical modeling, we can use ecological indices to describe the relationship between species diversity and ecosystem functioning. The following are some commonly used ecological indices:

Alpha diversity: the number and richness of species in a community
Beta diversity: the differences in species between different communities
Gamma diversity: the number and richness of species in a region

Ecosystem function: The ecological services that an ecosystem can provide, such as material recycling, soil conservation, water source protection, etc.

To answer the question "How many different plant species does a community need to benefit? What happens as the number of species increases?", we can consider using a model of the diversity-ecosystem function relationship. The model is based on the following assumptions:

Different species in a community contribute differently to ecosystem functions.
There is an "inflection point" between species diversity and ecosystem function. When species diversity reaches this inflection point, ecosystem function will significantly improve.
Ecosystem functions are closely related to ecosystem stability.
Based on the above assumptions, we can use the following formula to describe the relationship between species diversity and ecosystem functions in the community: E = f ( S ) E = f(S)E=f(S)

Among them, E represents ecosystem function and S represents the number of species in the community. The function f describes the relationship between ecosystem function and the number of species. In practical applications, function f can adopt linear function, exponential function or logarithmic function, etc.

We can determine the function f by fitting experimental data. By fitting the resulting function f, we can estimate the relationship between ecosystem function and community species diversity and predict how many different plant species are needed in the community to maximize ecosystem function.

When the number of species increases, ecosystem function increases. However, when a certain number is reached, adding additional species will no longer significantly improve ecosystem function. This amount is called the "ecosystem functional inflection point."
Therefore, the minimum number of species required for a community depends on the specific relationship between ecosystem function and species diversity being studied. In general, when species numbers are small, increasing the number of species significantly improves ecosystem function.

To better understand the relationship between the number of species in a plant community and drought adaptability, we use the following mathematical formula:

Alpha diversity index:
Alpha diversity index measures the number and relative abundance of different species within a community. It can be calculated by the following formula
:Insert image description here

where S is the number of different species in the community, pi p_ipiis the relative quantity of the i-th plant in the community.
Beta diversity index:
Beta diversity index measures the difference of species between different communities. It can be calculated by the following formula:
WhereInsert image description here
S is the total number of species in different communities, xij x_{ij}xijis the $i -th community and the-th community and thecommunity and the kkthcommunity in the j$ communityThe difference in relative numbers of k species of plants.
Gamma Diversity Index:
The Gamma Diversity Index measures the species diversity of an entire region or different communities within a region, and it can be calculated by the following formula
:Insert image description here

This formula combines the Alpha and Beta diversity indices to give the species diversity of the entire region.
Drought Severity Index:
The Drought Severity Index is a measure of drought severity and can be calculated using the following formula
:Insert image description here

where t is the time step, P_t is the observed rainfall during time t, is the long-term average rainfall,Insert image description here

​is
the standard deviation of rainfall.

import numpy as np
import matplotlib.pyplot as plt
 
# 模型参数
n_species = 10 # 物种数量
n_steps = 1000 # 模拟步数
t_sdama!tep = 0.01 # 时间步长
alpha = 0.2 # 感受性系数
beta = 0.5 # 竞争系数
gamma = 0.2 # 恢复系数
drought_mamafreq = 0.2 # 干旱发生频率
drought_severity = 0.5 # 干旱严重程度
 
# 初始化模型
x = np.random.rand(n_species)
y = np.random.rand(n_species)
 
# 模拟植物群落动态
for i in range(n_steps):
    # 计算当前时间步的环境影响
    env = np.random.rand(n_species)dama1
    drought = np.where(env < drought_freq, drought_severity, 0)
 
    # 计算物种数量变化率
    dx = x * (alpha - beta * x - gamma * y) + drought
    dy = y * (alpha - beta * y - gamma * x)
 
    # 更新物种数量
    x += dx * t_step
    y += dy * t_step
 
    # 保证物种数量非负
    x = np.maximum(x, 0)
    y = np.maximum(y, 0)
 
# 绘制结果
plt.plot(np.arange(n_species), x, label='Species X')
plt.plot(np.arange(n_specidama!es), y, label='Species Y')
plt.legend()
plt.xlabel('Species')
plt.ylabel('Abundance')
plt.show()

This code uses the Lotka-Volterra model to describe interactions between two species in a plant community, including competition and predation. Among them, alpha represents the susceptibility coefficient, beta represents the competition coefficient, and gamma represents the recovery coefficient. At the same time, the code also considers the impact of drought on plant communities, where drought_freq represents the frequency of drought occurrence and drought_severity represents the severity of drought.

Question 3: What will be the impact of more frequent and more variable droughts in future weather cycles? If droughts are less frequent, will species numbers have the same impact on overall populations?

Changes in the frequency of drought may affect the ecosystem dynamics of plant communities, especially over long time scales. In this case, we need to adjust the model to reflect the impact of changes in drought frequency and intensity on plant communities. Below are some possible formulas and methods that can be used to explore these effects.

The impact of changes in drought frequency on plant communities can be reflected by adjusting the probability distribution of drought events. For a given drought event, its occurrence probability can be expressed as a random variable obeying a specific distribution. Different distribution functions, such as normal distribution, Poisson distribution, etc., can be used to represent the probability distribution of drought events. Changes to the model can be achieved by adjusting parameters in these distribution functions.

Changes in drought frequency and intensity also affect plant growth rates and reproductive capabilities. These changes can be reflected using appropriate growth and reproduction functions. For example, the following formula can be used to describe the population growth of a species in a plant community
:

Among them, N_t represents the population number of the species r represents the growth rate of the species, β \betaβ represents the population density dependence factor,D t D_tDtIndicates the number of individuals that died due to lack of water during a drought.

Changes in drought frequency may also affect competitive relationships between different species. When droughts occur more frequently, competition between plant species may become more intense. This influence can be achieved by adjusting the parameters of the competitive relationship. For example, the Lotka-Volterra equation can be used to describe the competitive relationship between plants
:

Among them, N_i represents the population size of species i, ri r_irirepresents the growth rate of species i, α \alphaα represents the population density dependence factor,KKK represents the maximum carrying capacity of the community.

If droughts were less frequent, the impact of species abundance on overall populations might change. In particular, when droughts become rare, communities with more species may fare better because these communities may possess more drought fitness.
Factors such as pollution and habitat loss can negatively impact the viability of plant communities, so the impact of these factors on models needs to be taken into account. Among them, the impact of pollution on plant growth can be simulated by adjusting the maximum value of photosynthetic rate to a certain percentage of its initial value. Habitat reduction can be simulated by reducing the maximum carrying capacity of plant communities.
Specifically, the maximum value of photosynthetic rate can be expressed as
:

where is the initial maximum value of photosynthetic rate, is the influence coefficient of pollution on photosynthetic rate, is the pollution level, and the value range is [0,1]. Habitat reduction can
be achieved

To simulate, k0 is the initial maximum carrying capacity, kh is the impact coefficient of habitat reduction on the maximum carrying capacity, and is the degree of habitat reduction, with the value range being [0,1].
After considering the impact of these factors, the impact of plant numbers in the model needs to be re-evaluated. Because these factors affect plant growth and reproduction, they may slow or distort the effects of plant abundance on the overall population.
Specifically, if habitat reduction and pollution are greater, the maximum carrying capacity and photosynthetic rate of the plant community may be reduced, thereby slowing down the impact of plant numbers on the overall population. Conversely, if the habitat and pollution levels are lower, the effect of plant abundance on the overall population may be more pronounced.
To summarize, here is Python for an updated model that takes into account factors such as pollution and habitat loss

代码:
import numpy as np
import matplotlib.pyplot as plt
 
def alpha_diversity(species_abundances):
    """
 计算Alpha多样性指数
    """
    N = np.sum(species_abundances)
    p = species_abundances / N
    alpha = p * N
    return alpha
 
def beta_diversity(species_abundances_list):
    """
 计算Beta多样性指数
    """
    S = len(species_abundances_list)
    N = np.sum(species_abundances_list)
    p = np.sum(species_abundances_list, axis=0) / N
    beta = (S / (S - 1)) * (1 - np.sum(p ** 2))
    return beta
 
species_abundances_list = np.array([[10, 5, 2, 0], [8, 3, 5, 1], [12, 6, 3, 0]])
 
# 计算Alpha和Beta多样性指数
alpha = alpha_diversity(species_abundances_list[0])
beta = beta_diversity(species_abundances_list)
alpha_list = [0.15, 0.2, 0.25]
beta_list = [0.4, 0.6, 0.8]
 
# 定义物种数量变化函数
def species_change(alpha, beta, t, i, j):
    # 计算物种数量
    s = 100  # 初始物种数量
    n = len(t)
    x = np.zeros(n)
    y = np.zeros(n)
    x[0] = y[0] = s
    alpha, beta = n, n
    for item in range(1, n):
        alpha = alpha - alpha_list[i] * 0.1 * item / pow(n, 0.25)
        beta = beta - beta_list[j] * 0.1 * n / item
        x[item] = x[0] - alpha
        y[item] = y[0] - beta
    # 计算物种数量变化
    return x, y
 
 
# 绘制物种变化图
fig, axs = plt.subplots(len(alpha_list), len(beta_list), figsize=(10, 10))
t = np.arange(0, 100, 1)
for i, alpha in enumerate(alpha_list):
    for j, beta in enumerate(beta_list):
        x, y = species_change(alpha, beta, t, i, j)
        axs[i, j].plot(t, x, label='Species 1')
        axs[i, j].plot(t, y, label='Species 2')
        axs[i, j].set_title(f'Alpha={alpha}, Beta={beta}')
        axs[i, j].set_xlabel('Time')
        axs[i, j].set_ylabel('Population')
        axs[i, j].legend()
 
plt.tight_layout()
plt.savefig("./photo.jpg")
plt.show()

Question: "What does your model suggest should be done to ensure the long-term viability of plant communities, and what are the implications for the larger environment?"

Protect and restore habitat: Habitat loss is one of the major threats to the survival of plant communities. By protecting and restoring habitats, plants can be provided with more living space and resources, promoting the survival and prosperity of plant communities.

Control Pollution: Pollution can negatively impact plant growth and reproduction. Therefore, taking effective measures to control pollution is a necessary step to protect plant communities.

Promote diversity: Our model shows that the presence of multiple plant species in a plant community has a positive impact on the survival and stability of the community. Therefore, by promoting plant species diversity, the viability and stability of plant communities can be improved.

Improve public awareness: Strengthen public education, increase public attention and awareness of plant community protection, and form a good social atmosphere and consensus, which will contribute to the long-term survival and protection of plant communities.

In terms of greater environmental impact, the above measures will also have a positive impact on the entire ecosystem, promote the recovery and development of the ecosystem, improve the stability and anti-interference ability of the ecosystem, and have a positive impact on the entire ecological environment.

The full text and complete ideas, please see the article and code below:
23 US Competition (Question A) Mathematical Modeling Complete Code + Full Analysis of the Modeling Process - csdn

Guess you like

Origin blog.csdn.net/qq_25834913/article/details/132497415