
Size of this preview: 576 × 489 pixels. Other resolution: 283 × 240 pixels.
Original file (576 × 489 pixels, file size: 6.35 MB, MIME type: image/gif, looped, 244 frames, 24 s)
This is a file from the Wikimedia Commons. Information from its description page there is shown below.
Commons is a freely licensed media file repository. You can help.
Commons is a freely licensed media file repository. You can help.
Summary
| DescriptionPredator-prey toy model.gif |
English: An extremely simple predator-prey toy model. At each time step each pray (black dot) has a chance to duplicate, but is eaten if within a distance from predator (red circle). Predators can also duplicate, but have a chance to die, if they don't eat.
To avoid the predator extinction one can either fine-tune the parameter, or build a more complex model. |
| Date | |
| Source | https://twitter.com/j_bertolotti/status/1424778017902039054 |
| Author | Jacopo Bertolotti |
| Permission (Reusing this file) |
https://twitter.com/j_bertolotti/status/1030470604418428929 |
| GIF development InfoField |
Mathematica 12.0 code
nprey = 2*10^3; npredator = 5; predatorradius = 0.3; stepprey = 0.2; steppredator = 0.2;
prey0 = RandomReal[{-10, 10}, {nprey, 2}];
predator0 = RandomReal[{-10, 10}, {npredator, 2}];
prey = prey0; predator = predator0;
probpreybreed = 0.025; probpredatordie = 0.2; probpredatorbreed = 0.2;
histnprey = {}; histnpredator = {};
evo = Reap[
Do[
feedingpredators = Table[0, npredator];
For[j = 1, j <= npredator, j++,
feeding = Position[Norm[# - predator[[j]]] & /@ prey, x_ /; (x < predatorradius)];
prey = Delete[prey, feeding];
If[Total[Flatten@feeding] > 0, feedingpredators[[j]] = 1];
];
random = RandomReal[{0, 1}, npredator];
dyingpredators = Position[random, x_ /; (x <= probpredatordie)];
dyingpredators = DeleteCases[ Abs[(feedingpredators[[Flatten@dyingpredators]] - 1)*dyingpredators], {0}];
predator = Delete[predator, dyingpredators];
nprey = Dimensions[prey][[1]];
npredator = Dimensions[predator][[1]];
random = RandomReal[{0, 1}, npredator];
breedingpredators = Flatten@Position[random, x_ /; (x <= probpredatorbreed)];
predator = Join[predator, predator[[breedingpredators]] ];
nprey = Dimensions[prey][[1]];
npredator = Dimensions[predator][[1]];
random = RandomReal[{0, 1}, nprey];
breedingpreys = Flatten@Position[random, x_ /; (x <= probpreybreed)];
prey = Join[prey, prey[[breedingpreys]] ];
nprey = Dimensions[prey][[1]];
npredator = Dimensions[predator][[1]];
prey = Clip[prey + RandomVariate[NormalDistribution[0, stepprey], {nprey, 2}], {-10, 10}];
predator = Clip[predator + RandomVariate[NormalDistribution[0, steppredator], {npredator, 2}], {-10,
10}];
If[npredator < 1, Break[]];
Sow[{prey, predator}]
, {500}];
][[2]];
history = Table[(Dimensions /@ evo[[1, k]] )[[All, 1]], {k, 1, Dimensions[evo[[1]] ][[1]]}];
frames = Table[
GraphicsRow[{
Graphics[{Point[evo[[1, j, 1]]], Red, Thick, Circle[#, predatorradius] & /@ evo[[1, j, 2]] }, PlotRange -> {{-10, 10}, {-10, 10}}, ImageSize -> Large]
,
GraphicsColumn[{
ListLinePlot[history[[1 ;; j]], PlotRange -> {{0, Max@history[[All, 1]] + 100}, {-1, Max@history[[All, 2]] + 10}}, Axes -> False, Frame -> True, FrameLabel -> {"Prey", "Predators"}, LabelStyle -> {Black, Bold}, FrameTicks -> None, PlotStyle -> {Gray, Thick}, AspectRatio -> 1]
,
ListLinePlot[history[[1 ;; j, 1]], PlotRange -> {{0, Dimensions[evo[[1]] ][[1]]}, {-1, Max@history[[All, 1]] + 10}}, Axes -> False, Frame -> True, FrameLabel -> {"Time", "Prey"}, LabelStyle -> {Orange, Bold}, FrameTicks -> None, PlotStyle -> {Orange, Thick}, AspectRatio -> 1]
,
ListLinePlot[history[[1 ;; j, 2]], PlotRange -> {{0, Dimensions[evo[[1]] ][[1]]}, {-1, Max@history[[All, 2]] + 10}}, Axes -> False, Frame -> True, FrameLabel -> {"Time", "Predators"}, LabelStyle -> {Purple, Bold}, FrameTicks -> None, PlotStyle -> {Purple, Thick}, AspectRatio -> 1]
}]
}, ImageSize -> Large]
, {j, 1, Dimensions[evo[[1]] ][[1]]}];
ListAnimate[frames]
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
| This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. | |
| The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
Captions
An extremely simple predator-prey toy model.
Items portrayed in this file
depicts
9 August 2021
image/gif
File history
Click on a date/time to view the file as it appeared at that time.
| Date/Time | Thumbnail | Dimensions | User | Comment | |
|---|---|---|---|---|---|
| current | 14:10, 11 August 2021 | 576 × 489 (6.35 MB) | Berto | Uploaded own work with UploadWizard |
File usage
The following page uses this file:
Global file usage
The following other wikis use this file:
- Usage on kk.wikipedia.org
Metadata
This file contains additional information, probably added from the digital camera or scanner used to create or digitize it.
If the file has been modified from its original state, some details may not fully reflect the modified file.
| GIF file comment | Created with the Wolfram Language : www.wolfram.com |
|---|
Retrieved from "https://en.wikipedia.org/wiki/File:Predator-prey_toy_model.gif"