Question regarding the graphing of differential equations in grapher (mac)

524 Views Asked by At

I am new to grapher (mac) and I am trying to graph Lotka-Volterra equations. For those of you who you do not know, the Lotka-Volterra model is a model that describes the population of two competing species in an environment (predator-prey represented by x and y respectively). I had someone in my class help me graph a graph of population x vs. population y. I am not very familiar with calculus in general. I know the basics, but here is what I have:

$ \frac{dx}{dt} = a* x - b* x*y $

$ \frac{dy}{dt} = d* x*y - c*y $

initial values $ x(0) =50 ; y(0) =15; $

time domain $( t, 0, 500)$

constants (a,b,c,d) = ( .1,.01..05,.001)

What I want to do along with this is create a plot that features the two populations as a function of time. Something that looks like this.

Population vs. Time

Is there anyway to do this. Be it in the same graph or be it in a new file or graph.

THANK YOU SO MUCH, this is a school project I need help on. I would appreciate it.

1

There are 1 best solutions below

0
On

You need a software that solves ODEs numerically. Mathematica code is given that produces same graphs:

{a, b, c, d} = {.1, .01, .05, .001};

NDSolve[{X'[t] == a X[t] - b X[t] Y[t], X[0] == 50, Y'[t] == d X[t] Y[t] - c Y[t], Y[0] == 15}, {X, Y}, {t, 0, 500}];

{x[u_], y[u_]} = {X[u], Y[u]} /. First[%];

Plot[{x[t], y[t]}, {t, 0, 500}, AspectRatio -> Automatic, PlotLabel -> "Prey-Predator-time-Populations"]

ParametricPlot[{x[t], y[t]}, {t, 0, 500}, AspectRatio -> Automatic, PlotLabel -> "Prey vs Predator_Population"]

The second graph plots prey-predator numbers together.