User:Chas zzz brown/predator prey

Aesthetically speaking, a problem with the algae shrimp alewife model is that if the alewife population is 0, the model acts differently than then algae shrimp model does by itself; in fact the shrimp grow without bounds.

We can adjust for this and create a more faithful model by combining observations about the standard predator prey model and the competition models.

General Competition Model
The general competition model for n species is described as:


 * $$\frac {d x_i}{dt} = r_i x_i (1 - \sum_{j=1}^n( a_{ij} x_j))$$

In this model, the elements of the interaction matrix $$A = \{a_{ij}\}$$ are typically all positive; and the coefficient $$a_{ij}$$ encodes the degree to which species j decreases the rate of growth of species i.

Note that in this model, if $$x_j = 0$$ for all j except for one species i, (i.e., there is only 1 species actually present), then we have the equation


 * $$\frac {d x_i}{dt} = r_i x_i (1 - a_{ii} x_i))$$

If we let $$a_{ii} = \frac{1}{k_i}$$ where $$k_i$$ is the carrying capacity of species i, we get the familiar equation:


 * $$\frac {d x_i}{dt} = r_i x_i (1 - \frac {x_i}{k_i}))$$

In this case, r_i represents the birth rate $$b_i$$ without any other limiting factors involved; and $$a_{ii}$$ is a self-limiting factor.

It is slightly counter-intuitive to denote interactions which decrease a species with positive numbers, and those which increase a species with negative numbers; and in fact with appropriate sign changes for the elements of A, we can rewrite the the general equation as:


 * $$\frac {d x_i}{dt} = r_i x_i (1 + \sum_{j=1}^n( a_{ij} x_j))$$

or, after appropriately rescaling the coefficients of A by $$b_i$$,


 * $$\frac {d x_i}{dt} = x_i (r_i + \sum_{j=1}^n( a_{ij} x_j))$$

As we shall see, in this form the general competition equations are compatible with the predator prey equations.

Predator Prey Equations
The predator prey equations for two species are often written as:


 * $$\frac{dx}{dt} = x(b - cy)$$
 * $$\frac{dy}{dt} = y(gx - d)$$

where x is the prey species, y is the predator species, and the coefficients are all positive real numbers, with b being the prey species birth rate, c being the effect of predation, g being the rate of growth in the predator species from consuming prey, and d being the death rate for the predator species.

Now, if we remove the constraint that all coefficients be positive, we can make the following assignments:


 * $$x_1 = x$$
 * $$x_2 = y$$
 * $$a_{12} = -c$$
 * $$r_1 = b$$
 * $$a_{21} = g$$
 * $$r_2 = -d$$

And then after substitution, the above equations become:


 * $$\frac{dx_1}{dt} = x_1(r_1 + a_{12} x_2)$$
 * $$\frac{dx_2}{dt} = x_2(r_2 + a_{21} x_1)$$

Now we can add in a (negative!) carrying capacity factor $$a_{11} = -\frac{r_1}{k_1}$$ for the prey, and no such self-limiting factor for the predator; and write the above as:


 * $$\frac{dx_1}{dt} = x_1(r_1 + a_{11} x_1 + a_{12} x_2)$$
 * $$\frac{dx_2}{dt} = x_2(r_2 + a_{21} x_1)$$

or more compactly, letting $$a_{22}=0$$,


 * $$\frac {d x_i}{dt} = x_i (r_i + \sum_{j=1}^n( a_{ij} x_j))$$

which is then the same form as the set of equations for general competition given above.

General System Model
As a start, a more general approach for n different species is as follows:


 * $$\frac {dx_i}{dt} = x_i (b_i - d_i + \sum_{j=1}^n( a_{ij} x_j))$$

where we have

$$b_i$$ is the (fixed) birth rate,

$$d_i$$ is the (fixed) death rate,

and there is an array (the interaction matrix) $$A = \{a_{ij}\}$$ where the element $$a_{ij}$$ captures the effect of species j on species i.


 * When $$a_{i,j}>0$$, the effect of species j on species i is to increase species i.


 * When $$a_{i,j}<0$$, the effect of species j on species i is to deccrease species i.

Typically, we have that if species i is a producer (e.g., algae), then $$b_i - d_i$$ is positive; and if species i is a consumer, then $$b_i - d_i$$ is negative; in other words, for producers we consider the net birth rate in the absence of other species, and for consumers we consider the net death rate. So we might as well write $$r_i = b_i - d_i$$ in the above equations, and we get the same form as in the previous two examples:


 * $$\frac {d x_i}{dt} = x_i (r_i + \sum_{j=1}^n( a_{ij} x_j))$$

Application to the models from the Excel spreadsheets
Details as I get to them! Primarily, we want to normalize the interaction matrix by dividing the coefficients by $$r_i$$; but in the case of consumers, this flips the meaning of the sign of those coefficients (since consumers have $$r_i$$ negative).