These fractals were generated by Python programs from the Active State website. They often make use of recursion.
Recursion is the process of repeating items in a self-similar way. For instance, when the surfaces of two mirrors are exactly parallel with each other, the nested images that occur are a form of infinite recursion. The term has a variety of meanings specific to a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathematics and computer science, in which it refers to a method of defining functions in which the function being defined is applied within its own definition. Specifically, this defines an infinite number of instances (function values), using a finite expression that for some instances may refer to other instances, but in such a way that no loop or infinite chain of references can occur. The term is also used more generally to describe a process of repeating objects in a self-similar way. (wikipedia)
Python is an easy language to get started with> Here’s an example program to generate the Mandelbrot Set (or rather, an image of an approximation!):
# Python+Pygame program to illustrate computing the Mandelbrot Set. # Note that it's far from efficient; it can easily be sped up! import pygame # see pygame.org width, height = 1000,1000 # display window size screen = pygame.display.set_mode((width, height)) # initialise pygame window xaxis = width / 1.5 + 140 # scaling for x & y axes yaxis = height / 2 scale = 400 maxit = 99 # maximum iterations for iy in range(height/2+1): # scan y-axis for ix in range(width): # scan x-axis z = 0 + 0j # initialise z=0 # map pixel position to complex plane c = complex(float(ix - xaxis) / scale, float(iy - yaxis) / scale) for it in range(maxit): # up to maximum iterations: z = z*z + c # iterate z^2 + c if abs(z) > 2: # z is flying off to infinity! col=(it % 4 * 64, it % 8 * 32, it % 16 * 16) # pick a colour break # break out of closest loop else: # loop finished so col = (0, 0, 0) # point is in set = colour black screen.set_at((ix, iy), col) # set colour on top half screen.set_at((ix, height-iy), col) # set colour on bottom half pygame.display.update() # update window on screen raw_input("Done") # picture disappears when Enter
The pictures in the gallery were generated by the following programs:
- sfplust
- percolation
- newtonFr
- Fern
- RandomSpiralFractal_7 RandomSpiralIFSFractal
- LogisticMapFractal
- MandelbrotFractal
- Bifurcation
- CircleInversionFractal
- Apollonian Gasket
These fractals were generated by Python programs from the Active State website. They often make use of recursion.
Im getting an error in Line 19:
What does the “& gt; 2:” do?
Im not understanding this part.
That should have been rendered as a greater than sign, i.e. > 2
Sorry for that, pls try again.