UserPreferences

LogisticGrowthModelCode


  1 
  2 
  3 
  4 
  5 
  6 
  7 
  8 
  9 
 10 
 11 
 12 
 13 
 14 
 15 
 16 
 17 
 18 
 19 
 20 
 21 
 22 
import Tkinter

# Set up the graphics window
maxheight = 500
maxwidth = 1000
window = Tkinter.Tk()
canvas = Tkinter.Canvas(window, width=maxwidth, height=maxheight, background="white")
canvas.pack()

#Set up parameters and initial popsize
maxtime = 700
R = 2.5
N = 1.0
K = 400.0

for time in range(1,maxtime+1):
    Nnext = N + N * (1 - N/K)*R  #Here is the dynamic!
    if Nnext <= 0:
        Nnext = 0
    print time, Nnext
    canvas.create_line(time, maxheight-N, time+1, maxheight-Nnext)  #Graph it
    N = Nnext