The discreet logistic growth is described by a simple update rule:

xn+1 = xn + r(1-xn)xn

Depending on r, this iteration may show very strange, and even chaotic behaviour.

This python script

# -*- coding: utf-8 -*-

"""
Created on Mon Nov  2 22:08:46 2015
 
@author: oliver
"""
 
import numpy as np
import matplotlib.pyplot as plt
 
def logGrowthIter(r,x):
    """
    returns next iteration. Takes r and x_n as arguments, returns x_{n+1}
    xn -> xn+1
    """
    
    return x + r*(1-x)*x
    
def logGrowthDiscreet(r,N,x0):
    """
    returns the first N iterations, starting with x0. Arguments: r,N,x0
    """
    
    X = np.zeros(N)
    X[0] = x0
 
    for i in range(1,N):
        X[i] = logGrowthIter(r,X[i-1])
        
    return X
 
 
 
 
if __name__ == '__main__':
    
    plt.figure()
    
    Npre = 1000
    Nplot = 50
    
    for r in np.linspace(1,3,1000):
        
        Xpre = logGrowthDiscreet(r,Npre,0.1)
        Xplot = logGrowthDiscreet(r,Nplot,Xpre[-1])
        #plt.plot([r]*Nplot,Xplot,'k.')
        plt.plot([r]*Nplot,Xplot,color='black',linestyle='none',markersize=1,marker='.')
 
    plt.axis([1,3,0,1.5])
    plt.draw()
    plt.show()

produces

 

  • Keine Stichwörter