Message Boards Message Boards

Wolfram MathWorld notebook dynamic plot not working?

Posted 2 years ago

I got this notebook from the MathWorld page on the Lotka Volterra equations and am running it in Mathematica 12.3

The notebook comes with a Dynamic plot of the phase plot of the Lotka Volterra equations with widgets that let you see the behavior of the plot as the parameters change, it uses the Manipulate command.

However when I run it on my computer nothing appears on the actual plot no matter what the parameters are. And this is a notebook pulled straight from MathWorld with no modifications. This is after executing the entire notebook of course. Any ideas how to get it working?

POSTED BY: R S

I assume the notebook might not be complete. Please try the following code using new features from later version of WL (nb also attached):

  • Function definition

    LotkaVolterra[{a_?NumericQ,b_?NumericQ,c_?NumericQ,d_?NumericQ},{prey0_?NumericQ,preditor0_?NumericQ},tmax_?NumericQ]:=NDSolveValue[{x'[t]==a *x[t]-b* x[t]*y[t],y'[t]==-c*y[t]+d* x[t]*y[t],x[0]==prey0,y[0]==preditor0},{x[t],y[t]},{t,0,tmax}]
    
  • Dynamic Interface

    Manipulate[Plot[Evaluate[LotkaVolterra[{a,b,c,d},{prey0,preditor0},tmax]],{t,0,tmax},PlotRange->All,PlotStyle->{Red,Blue}],{{a,1},-5,5},{{b,1},-5,5},{{c,1},-5,5},{{d,1},-5,5},{{prey0,3},0,20},{{preditor0,5},0,20},{{tmax,40},.01,50},ControlPlacement->Top]
    

I have this result in V12.3+

enter image description here

Attachments:
POSTED BY: Shenghui Yang
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract