FindEcoCycle
| FindEcoCycle[init] |
| FindEcoCycle[attributes,init] |
(5)
Basic Examples
(5)
An unforced, continuous-time model — the Rosenzweig-MacArthur predator-prey model:
In[1]:=
Needs["EcoEvo`"];
In[2]:=
SetModel[{Pop[n]{Equationn(1-n/k)-anpn/(n+h),ColorGreen},Pop[p]{Equationp(apn/(n+h)-m),ColorRed},Parameters{an≥0,ap≥0,h≥0,m>0,k>0}}];
In[3]:=
an=1;ap=2;h=1;m=1;k=4;
Finding a limit cycle using default Method ("EcoSim" for unforced ContinuousTime models):
In[4]:=
lc=FindEcoCycle[{nk,p0.1}]PlotDynamics[lc]PlotTrajectory[lc]
Out[4]=
n
InterpolatingFunction
,pInterpolatingFunction
Out[4]=
Out[4]=
Comparing the initial and final values shows that this is one complete period of the limit cycle:
In[5]:=
InitialSlice[lc]FinalSlice[lc]
Out[5]=
{n3.13795,p0.93758}
Out[5]=
{n3.13795,p0.93758}
The period of the limit cycle can be found using FinalTime:
In[6]:=
FinalTime[lc]
Out[6]=
13.0781
Using the option TriggerVariablep uses peaks of p to find the cycle:
In[7]:=
lc=FindEcoCycle[{nk,p0.1},TriggerVariablep];PlotDynamics[lc]
Out[7]=
"FindRoot" is an alternative Method (requires an initial guess for the Period):
In[8]:=
lc=FindEcoCycle[{nk,p0.1},Method"FindRoot",Period13];PlotDynamics[lc]
Out[8]=
The number of steps taken is stored in $FindEcoCycleSteps:
In[9]:=
$FindEcoCycleSteps
Out[9]=
31
The option LoggedTrue results in fewer steps to find the limit cycle:
In[10]:=
lc=FindEcoCycle[{nk,p0.1},Method"FindRoot",Period13,LoggedTrue];PlotDynamics[lc]
Out[10]=
In[11]:=
$FindEcoCycleSteps
Out[11]=
26
Using a TemporalRuleList as the initial guess takes the Period from the initial guess and uses method "FindRoot".
In[12]:=
k=4.1;FindEcoCycle[lc]
Out[12]=
n
InterpolatingFunction
,pInterpolatingFunction
FindEcoCycle gives a warning message if the relative amplitude of the solution is less than MinAmplitude, which probably means an equilbrium was found instead.
In[13]:=
k=2.9;(*nolimitcycleexists*)lc=FindEcoCycle[{nk,p0.1},Method"FindRoot",Period13];PlotDynamics[lc]
FindEcoCycle::relamp:Warning: EcoCycle relative amplitude 2.11072× < MinAmplitude = 0.001.
-10
10
Out[13]=
An unforced continuous-time model — a tri-trophic food chain (Hastings & Powell 1991).
Increasing parameter B1 leads to a period doubling bifurcation of the limit cycle:
Method "FindRoot", with an appropriate initial guess of the period, locates the now unstable, original limit cycle:
An unforced discrete-time model — the Ricker equation:
A 2-cycle:
Increased r leads to a stable 4-cycle:
Method "FindRoot" can locate the now unstable, 2-cycle:
Resource competition in a periodic environment:
FindEcoCycle finds a two-species coexistence limit cycle:
Omitting one species in the initial guess fixes it at zero:
The Logged option helps for large periods where the densities approach zero:
The limit cycle that Method "FindRoot" finds can depend on the initial guess and is not necessarily stable:
Each call to FindEcoCycle resets $FindEcoCycleSteps:
A periodically forced model — competition in a variable temperature environment, with optimal temperature as a trait (Norberg et al 2001, Kremer & Klausmeier 2017):
Find a single-species limit cycle:
A three-species limit cycle: