Example 9.3: Volterra-Lotka predator-prey model 2D (Ch 9, page 153)

Clear["Global`*"]
Off[General::spell1]

<<VectorFieldPlots`;

System

Parameters

{(Subscript[x, min]),(Subscript[x, max])}={-4,4};
{(Subscript[y, min]),(Subscript[y, max])}={-4,4};

f[x_,y_]:=x(3 - x - 5 y)

g[x_,y_]:=y(-1+x+y)

Vector field

V={f[x,y],g[x,y]}

Fixed Points & Nullclines

fp=Solve[{f[(Subscript[x, 1]),(Subscript[y, 1])]==0,g[(Subscript[x, 1]),(Subscript[y, 1])]==0},{(Subscript[x, 1]),(Subscript[y, 1])}]

fp1=Sort[fp[[1]]];fp2=Sort[fp[[2]]];fp3=Sort[fp[[3]]];fp4=Sort[fp[[4]]];

{(Subscript[x, 1]),(Subscript[y, 1])}={Extract[fp1,{1}][[2]],Extract[fp1,{2}][[2]]};
fixedpoint1=Show[Graphics[{PointSize[0.025],Hue[1],Point[{(Subscript[x, 1]),(Subscript[y, 1])}]},PlotRange->{{(Subscript[x, min]),(Subscript[x, max])},{(Subscript[y, min]),(Subscript[y, max])}}]];

{(Subscript[x, 2]),(Subscript[y, 2])}={Extract[fp2,{1}][[2]],Extract[fp2,{2}][[2]]};
fixedpoint2=Show[Graphics[{PointSize[0.025],Hue[1],Point[{(Subscript[x, 2]),(Subscript[y, 2])}]},PlotRange->{{(Subscript[x, min]),(Subscript[x, max])},{(Subscript[y, min]),(Subscript[y, max])}}]];

{(Subscript[x, 3]),(Subscript[y, 3])}={Extract[fp3,{1}][[2]],Extract[fp3,{2}][[2]]};
fixedpoint3=Show[Graphics[{PointSize[0.025],Hue[1],Point[{(Subscript[x, 3]),(Subscript[y, 3])}]},PlotRange->{{(Subscript[x, min]),(Subscript[x, max])},{(Subscript[y, min]),(Subscript[y, max])}}]];

{(Subscript[x, 4]),(Subscript[y, 4])}={Extract[fp4,{1}][[2]],Extract[fp4,{2}][[2]]};
fixedpoint4=Show[Graphics[{PointSize[0.025],Hue[1],Point[{(Subscript[x, 4]),(Subscript[y, 4])}]},PlotRange->{{(Subscript[x, min]),(Subscript[x, max])},{(Subscript[y, min]),(Subscript[y, max])}}]];

nullclines=ContourPlot[{f[x,y]==0,g[x,y]==0},{x,(Subscript[x, min]),(Subscript[x, max])},{y,(Subscript[y, min]),(Subscript[y, max])},ContourStyle->{{Green,Thickness[0.005]}}];

Show[nullclines,fixedpoint1,fixedpoint2,fixedpoint3,fixedpoint4]

Jacobian

a11=Simplify[D[f[x,y],x]]

a12=Simplify[D[f[x,y],y]]

a21=Simplify[D[g[x,y],x]]

a22=Simplify[D[g[x,y],y]]

J={{a11,a12},{a21,a22}}

MatrixForm[J]

Acceleration

γ=J . V

Fixed Points Stability - Eigenvalues

Eigenvalues[J]/.{x-> (Subscript[x, 1]),y->(Subscript[y, 1])}

Eigenvalues[J]/.{x-> (Subscript[x, 2]),y->(Subscript[y, 2])}

Eigenvalues[J]/.{x-> (Subscript[x, 3]),y->(Subscript[y, 3])}

Eigenvalues[J]/.{x-> (Subscript[x, 4]),y->(Subscript[y, 4])}

Phase Portrait

solution=NDSolve[{x'[t]==f[x[t],y[t]],x[0]==.1,

y'[t]==g[x[t],y[t]],y[0]==.1},{x,y},

{t,0,200},Method->"ExplicitRungeKutta", MaxSteps->Infinity,StartingStepSize->0.001];phaseplot=ParametricPlot[Evaluate[{x[t],y[t]}/.solution],{t,0,200},PlotPoints->1000,PlotRange->{{(Subscript[x, min]),(Subscript[x, max])},{(Subscript[y, min]),(Subscript[y, max])}},AxesLabel->{"X","Y"},PlotStyle->{{Red,Thickness[0.005]}},AspectRatio->1,Frame->True];

Show[phaseplot,fixedpoint1,nullclines]

plotX=Plot[Evaluate[x[t]/.solution],{t,80,100},PlotRange->{(Subscript[x, min]),(Subscript[x, max])},PlotStyle->{RGBColor[0,0,1]}]

plotY=Plot[Evaluate[y[t]/.solution],{t,80,100},PlotRange->{(Subscript[y, min]),(Subscript[y, max])},PlotStyle->{RGBColor[0,1,0]}]

Show[plotX,plotY]

Flow Curvature Manifold

ϕ=FullSimplify[Det[{V,γ}]]

flowmanifold=ContourPlot[{ϕ==0},{x,(Subscript[x, min]),(Subscript[x, max])},{y,(Subscript[y, min]),(Subscript[y, max])},PlotPoints->25,ContourStyle->{{Blue,Thickness[0.005]}},AspectRatio->1,Frame->True]

Flow Curvature Invariance

ϕ= (x^α) (y^β) (((-3+x+3 y))^δ)

Normal Vector

η={D[ϕ,x],D[ϕ,y]}

Invariance

Ψ=FullSimplify[V . η]

K=FullSimplify[(Ψ/ϕ)]

Collect[K,{x,y,z}]

Solve[{3 α-β==0, (-α+β-δ)==0,(-5 α+β+δ)==0},{α,β,δ}]

α=(δ/2);
β=((3 δ)/2);
δ=2;

ϕ= (x^α) (y^β) (((-3+x+3 y))^δ)/.{x->0.1,y->0.1}

Normal Vector

η={D[ϕ,x],D[ϕ,y]}

Invariance

Ψ=FullSimplify[V . η]

ϕ= (x^α) (y^β) (((-3+x+3 y))^δ)

flowmanifold=ContourPlot[{ϕ==0.0006760000000000003`},{x,(Subscript[x, min]),(Subscript[x, max])},{y,(Subscript[y, min]),(Subscript[y, max])},PlotPoints->25,ContourStyle->{{Blue,Thickness[0.005]}},AspectRatio->1,Frame->True]

Show[phaseplot,fixedpoint1,flowmanifold,Frame->True,ImageSize->{600,600} ,DisplayFunction->$DisplayFunction]