Personal tools

universalhorizontal.py

Plot the convergence to the universal functions g_i

universalhorizontal.py — Python Source, 0Kb

File contents

#!
from superstable import *
from pylab import *

rsuper = getsuperstablevalues()

xrange=arange(4000)/3999.0

def ff(x, r, iters ): # assume x can be a vector for plotting
    for i in range(iters):
        x=r*x*(1-x)
    return(x)

for DELTAINDEX in range(1,4):
    for FL in range(0,3):
        subplot(3,3,3*DELTAINDEX+FL+1-3) # ugly hack.
        # RL in vertical coords, FL in horizontal coord.
        RL = FL+DELTAINDEX

        r=rsuper[RL]
        iter=2**FL
        
        plot(xrange,ff(xrange,r,iter) )
        plot( (0,1), (0,1))
        
        orbit = zeros(2**RL)
        orbit[0]=0.5
        
        for i in range(1,2**RL): # orbit will contain individual elements of the orbit
            orbit[i]=r*orbit[i-1]*(1.0-orbit[i-1])
        
        forbit = ff(orbit,r,2**FL)
        
        for i in range(2**RL):
            plot( (orbit[i],orbit[i],forbit[i]), (orbit[i],forbit[i],forbit[i]), 'r')

show()
Document Actions