OR - Logistic Function

2562 days ago by kcrisman

This online response worksheet is about the logistic function.  As before, each time you get to an instruction, just do it, and Sage will take care of the rest for you! You will probably need to scroll occasionally, depending on your web browser; that is okay. Again, I hope you enjoy this exploration, and see the end for instructions on the writeup.

%auto %hide def my_eulers_method_plot(f,x0,y0,h,x1): n=int((1.0)*(x1-x0)/h) x00=x0; y00=y0 x01=x0; y01=y0 P=point((x00,y00),rgbcolor=hue(1)) # red Q=Graphics() # default is blue if f.number_of_arguments()==1: try: f = f._fast_float_(f.args()[0]) except AttributeError: pass for i in range(n+1): y01 = y00+h*f(x00) x01 = x00+h P=P+point((x01,y01),rgbcolor=hue(1)) Q=Q+line([(x00,y00),(x01,y01)]) x00=x01 y00=y01 if f.number_of_arguments()==2: try: f = f._fast_float_(f.args()[0],f.args()[1]) except AttributeError: pass for i in range(n+1): y01 = y00+h*f(x00,y00) x01 = x00+h P=P+point((x01,y01),rgbcolor=hue(1)) Q=Q+line([(x00,y00),(x01,y01)]) x00=x01 y00=y01 return(P+Q) var('t,x,y') def euler_logistic_plot(parameter,y_start,end=15,step=1): function(x,y)=parameter*y*(1-y) my_eulers_method_plot(function,0,y_start,step,end).show(ymin=0)

Okay, now we get to the exploration. What you are trying to do is explore what the logistic map does if you approximate with it, versus the idealized example in the book.

That is, what happens if $$y'=cy(1-y)$$ is the governing equation for my population growth (this is called the Verhulst model), but you only do a little bit of change at a time?

Remember, we have to think of our population as being a percentage of a maximum sustainable population. That is because if $y>1$, then $y'$ is actually negative (since $y>0$ but $1-y<0$), so the population would have to decrease if it got above $y=1$. That is reasonable, though; think of a Petri dish and bacteria, or fish in a pond - there is definitely a maximum possible sustainable population, and we will let $y=1$ be $100\%$ of that.

Secondly, we will have to decide upon how often we approximate. We can start with $\Delta x=1$, which we can think of as once a year. Finally, I'll let the parameter $c$ vary freely.

What inputs of the sliders and parameter make it look a lot like the logistic function in the book? Which ones have cyclic behavior (going between a few different values)? What values lead to ... something strange? I also allow you to mess with the step size; mathematically, this is $\Delta x=h$, but biologically you could think of it as how often your organism reproduces.

%auto @interact def _(start=slider(0,1,.05,.4),parameter=RR(2),end=slider(10,100,1,14),step=slider(.1,1,.1,1)): print 'starting population percent = %.1f%%' %float(100*start) print 'parameter =', parameter, '(Warning: do not let this get above 3)' print 'length of time =', end+1 print 'step size = %.1f' %float(step) euler_logistic_plot(parameter,start,end,step)

start
parameter
end
step

Click to the left again to hide and once more to show the dynamic interactive window