## Make a color representation of the ## logistic map. Previously, we used the ## position of cubes; here we vary the ## color. from visual import * a = 3.8 ### logistic map parameter xA = 0.25 ### initial value of the "population" A xB = 0.250001 ### initial value of the "population" B boxa = box() ### 2 separate cubes - start white boxb = box(x = 2) ## color has red, green, blue components boxa.blue = 0. boxb.blue = 0. while 1: rate(8) ## set colors of cubes, depending on xA, xB boxa.red = xA ## shade cube a with a boxa.green = 1.0 - boxa.red ## color dependent on xA boxb.red = xB ## same with b, xB boxb.green = 1.0 - boxb.red ## if xB is near 1, mostly red ## if xB is near 0, b greenish ## alternatively, could use RGB assignment, something ## like a.color = (xA, 1.0-xA, 0.) ## now update variables, using logistic map xA = a * xA * (1. - xA) xB = a * xB * (1. - xB)