File:Predator prey dynamics.svg

Original file (SVG file, nominally 466 × 451 pixels, file size: 47 KB)

Summary

Description
English: The Phase plot for Lotka-Volterra model for predator-prey dynamics for varying initial populations of the predator. The parameters are:

alpha = 1.1 # prey growth rate
beta = 0.4 # prey death rate
gamma = 0.4 # predator death rate
delta = 0.1 # predator growth rate

x0 = 10 # initial prey population
Date
Source Own work
Author Krishnavedala
SVG development
InfoField
 
The SVG code is valid.
 
This plot was created with Matplotlib.
Source code
InfoField

Python code

Source code
import numpy as np
import matplotlib.pyplot as plt

alpha = 1.1   # prey growth rate 
beta = 0.4    # prey death rate 
gamma = 0.4   # predator death rate 
delta = 0.1   # predator growth rate 
x0 = 10       # initial prey population
y0s = [1, 2, 5, 7, 10, 12, 15] # initial predator population

fig, ax = plt.subplots(figsize=(6,6))
for y0 in y0s: 
    dt = 1e-3
    T_MAX = 20
    t = np.arange(0,T_MAX,dt)
    x = np.zeros_like(t, dtype=np.float)
    y = np.zeros_like(t, dtype=np.float)
    x[0], y[0] = x0, y0

    for i, tt in enumerate(t):
        if i == 0:
            continue
        x[i] = x[i-1] + (alpha * x[i-1] - beta * x[i-1] * y[i-1]) * dt
        y[i] = y[i-1] + (delta * x[i-1] * y[i-1] - gamma * y[i-1]) * dt
        
    ax.plot(x, y, label='$y_0=%d$' % y0)

ax.grid(True)
ax.legend()
fig.savefig('predator_prey.svg',
            bbox_inches='tight', transparent=True)

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

20 December 2018

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current17:13, 20 December 2018Thumbnail for version as of 17:13, 20 December 2018466 × 451 (47 KB)KrishnavedalaCross-wiki upload from en.wiki.x.io

The following page uses this file:

Global file usage

The following other wikis use this file:

Metadata