0
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

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

$\endgroup$
  • $\begingroup$ Thank you very much, it helped a lot. $\endgroup$ – Bryce Ramgovind Sep 25 '14 at 7:13
2
$\begingroup$

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]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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