fractals - extending mandelbrot to generate julia -


working on project requiring me use same code ,note in same file generate mandelbrot set , julia sets ,i hav working mandelbrot set can see how extend julia set using same code. maybe not getting differences between ? can elaborate

import numpy np import matplotlib.pyplot plt import math    def mandelbrot(zmin, zmax, m, n, tmax=256):      xs = np.linspace(zmin, zmax, n)     ys = np.linspace(zmin, zmax, m)     x, y = np.meshgrid(xs, ys)       z = x + 1j * y     c = np.copy(z)     m = np.ones(z.shape) * tmax      t in xrange(tmax):         mask = np.abs(z) <= 2.         z[ mask] = z[mask]**2 + c[mask]         m[-mask] -= 1.     return m  list=mandelbrot(-2,2,500,500) plt.imshow(list.t, extent=[-2, 1, -1.5, 1.5]) plt.gray() plt.savefig('mandelbrot.png') 

the mandelbrot set special set in terms of julia sets, documentation writes mandelbrot set index set of julia sets (there 1 , 1 index set - mandelbrot - , there infinite number of julia sets.)

when calculate point on mandelbrot set , iterate on z^2 + c, c takes same value point try decide if part of map or not. c change if go next point (that how did in calculation).

in other words have value constant while go through iteration change every different point.

when calculate julia sets, calculation 99.9% same except have use c value constant during entire calculation not single point. , why not named c avoid confusion, k.

now if confused enough, solution dead simple. have change this:

z[ mask] = z[mask]**2 + c[mask] 

to this:

z[ mask] = z[mask]**2 + (-0.8+0.156j) 

check same set here: http://en.wikipedia.org/wiki/file:julia_set_camp4_hi_rez.png


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -