File:Lotka-Volterra model (1.1, 0.4, 0.4, 0.1).svg

Original file(SVG file, nominally 692 × 400 pixels, file size: 43 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary

edit
Description
English: Time evolution of variables following Lotka-Volterra model of predator-prey dynamics. The parameters are as follows:

Prey growth rate: : 1.1
Prey death rate: : 0.4
Predator death rate: : 0.4

Predator growth rate: : 0.1
Date
Source Own work File:Lotka-Volterra model (1.1, 0.4, 0.4, 0.1).png
Author Ian Alexander (parameters, PNG version)
Krishnavedala (vectorisation)
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
y0 = 10       # initial predator population

dt = 1e-3
t = np.arange(0,100,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, _ 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

fig, ax = plt.subplots(figsize=(9,5))
ax.plot(t, x, label='Prey')
ax.plot(t, y, '--', label='Predator')
ax.grid(True)
ax.legend()
ax.set_ylabel('population')
ax.set_xlabel('time')
fig.savefig('predator_prey.svg',
            bbox_inches='tight', transparent=True)

Licensing

edit
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.

File history

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

Date/TimeThumbnailDimensionsUserComment
current16:50, 20 December 2018Thumbnail for version as of 16:50, 20 December 2018692 × 400 (43 KB)Krishnavedala (talk | contribs)graph labels corrected
16:31, 20 December 2018Thumbnail for version as of 16:31, 20 December 2018692 × 400 (42 KB)Krishnavedala (talk | contribs)User created page with UploadWizard

The following page uses this file:

File usage on other wikis

The following other wikis use this file:

Metadata