Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am doing a project on the Allee Effect. I am able to successfully create a stability analysis. That is, I can find the relevant equilibrium points ($y_e = 0,\ y_e = \alpha$ and $y_e=k$) and draw approximation curves. However, I am having trouble plotting the solution.

The differential equation is $$ \frac{dy}{dx} = r y \left( 1 - \frac{y}{k} \right) \left(\frac{y}{\alpha} -1 \right) $$

sol = DSolve[y'[x] == r y[x] (1 - y[x]/k) (y[x]/a - 1), y, x]

Will produce the output:

{{y -> Function[{x}, 
    InverseFunction[
      Log[#1]/(a k) + Log[-a + #1]/(a (a - k)) + Log[-k + #1]/(
        k (-a + k)) &][-((r x)/(a k)) + C[1]]]}}

where a, r, and k are constants depending on the population. When I try to plot sol using the code

Plot[Evaluate[y[x] /. sol /. {C[1] -> 1}], {x, -7, 7}, PlotRange -> All]

It will output an empty.I was told to use the manipulate function for the constants. Please can someone help.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

For illustrative purposes and modify as desired: rate limits,starting populationm carrying capacity etc:

f[a_, k_, r_, n0_] := 
 First@NDSolve[{y'[t] == r y[t] (1 - y[t]/k) (y[t]/a - 1), 
    y[0] == n0}, y[t], {t, 0, 10}]
Manipulate[
 Column[{Plot[Evaluate[y[t] /. f[a, 1, rate, pop0]], {t, 0, 10}, 
    PlotRange -> {0, 1}, Frame -> True, 
    FrameLabel -> {"time", "population"}],
   Plot[ {rate n (1 - n) (n/a - 1), rate n (1 - n)}, {n, 0, 1.1}, 
    PlotRange -> {-0.02/a, 0.02/a}, Frame -> True, 
    FrameLabel -> {"N", "dN/dt"}, 
    PlotLegends -> {"Allee effect", "Logistic"}]}
  ], {a, 0.05, 1}, {pop0, 0.2, 0.5}, {rate, 0.1, 0.3}]

enter image description here

share|improve this answer
    
Thank you very much, it helped a lot. –  user2402501 Sep 25 at 7:13

If you do not define all constants Plot cannot produce any points - how woud it know what to compute? Try

sol = DSolve[y'[x] == r y[x] (1 - y[x]/k) (y[x]/a - 1), y, x];

Plot[Evaluate[
  y[x] /. sol /. {C[1] -> 1, a -> 1, k -> 1/2, r -> 1}], {x, .51, 1}, 
 PlotRange -> All]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.