Fractals/Iterations of real numbers/r iterations
r_values = (2:0.0002:4)'; iterations_per_value = 10; y = zeros(length(r_values), iterations_per_value); y0 = 0.5; y(:,1) = r_values.*y0*(1-y0); for i = 1:iterations_per_value-1 y(:,i+1) = r_values.*y(:,i).*(1-y(:,i)); end plot(r_values, y, '.', 'MarkerSize', 1); grid on;
/* Logistic diagram by Mario Rodriguez Riotorto using Maxima CAS draw packag */ pts:; for r:2.5 while r <= 4.0 step 0.001 do /* min r = 1 */ (x: 0.25, for k:1 thru 1000 do x: r * x * (1-x), /* to remove points from image compute and do not draw it */ for k:1 thru 500 do (x: r * x * (1-x), /* compute and draw it */ pts: cons([r,x], pts))); /* save points to draw it later, re=r, im=x */ load(draw); draw2d( terminal = 'png, file_name = "v", dimensions = [1900,1300], title = "Bifurcation diagram, x[i+1] = r*x[i]*(1 - x[i])", point_type = filled_circle, point_size = 0.2, color = black, points(pts));
"The horizontal axis is the r parameter, the vertical axis is the x variable. The image was created by forming a 1601 x 1001 array representing increments of 0.001 in r and x. A starting value of x=0.25 was used, and the map was iterated 1000 times in order to stabilize the values of x. 100,000 x -values were then calculated for each value of r and for each x value, the corresponding (x,r) pixel in the image was incremented by one. All values in a column (corresponding to a particular value of r) were then multiplied by the number of non-zero pixels in that column, in order to even out the intensities. Values above 250,000 were set to 250,000, and then the entire image was normalized to 0-255. Finally, pixels for values of r below 3.57 were darkened to increase visibility."
Real quadratic map
For , the code in MATLAB can be written as:
c = (0:0.001:2)'; iterations_per_value = 100; y = zeros(length(c), iterations_per_value); y0 = 0; y(:,1) = y0.^2 - c; for i = 1:iterations_per_value-1 y(:,i+1) = y(:,i).^2 - c; end plot(c, y, '.', 'MarkerSize', 1, 'MarkerEdgeColor', 'black');