# -*- coding: utf-8 -*- """ logistic_iterator.py finds values of the logistic map, f[i](x) = ax(1-x), for repeated iterations as i becomes large, approximates period doubling points, and finds said period points for a between 2.9 and values close to 4.0 I'm trying to do something like this: en.wikipedia.org/wiki/File:LogisticMap_BifurcationDiagram.png Created on Sun Oct 6 12:48:35 2013 @author: coriander """ import numpy as np import matplotlib.pyplot as plt def iterated_logistic(a_val, x, n=1000): for i in xrange(0, n): x = a_val*x*(1-x) return x def logi_loop(a_0=2.95, x_0=0.25): x_i = x_0 # for clarity for a in np.arange(a_0, 3.98, 0.01): #start, (up to) end, step (rationals), x_i = iterated_logistic(a, x_i) print "For a = {:.3f}: x_n = {:.4f}".format(a, x_i) plt.plot(a, x_i) plt.show() #return x_n def main(): logi_loop() pass main()