How to "increase" on the Mandelbrot site?

I created a Python file to create a given Mandelbrot image. The source math code was not mine, so I don’t understand it - I only modified it a lot to make it about 250 times faster (thread rule!).

Anyway, I was wondering how I can change part of the math code to make it one specific. Here is a piece of math:

for y in xrange(size[1]):
        coords = (uleft[0] + (x/size[0]) * (xwidth),uleft[1] - (y/size[1]) * (ywidth))
        z = complex(coords[0],coords[1])
        o = complex(0,0)
        dotcolor = 0  # default, convergent
        for trials in xrange(n):
            if abs(o) <= 2.0:
                o = o**2 + z
            else:
                dotcolor = trials
                break  # diverged
        im.putpixel((x,y),dotcolor)

And sizing:

size1 = 500
size2 = 500
n=64
box=((-2,1.25),(0.5,-1.25))
plus = size[1]+size[0]
uleft = box[0]
lright = box[1]
xwidth = lright[0] - uleft[0]
ywidth = uleft[1] - lright[1]

What do I need to change to make it render for a specific section of the set?

+5
source share
2 answers

Line:

box=((-2,1.25),(0.5,-1.25))

- , , , . - , - .

, . , "image" 100x100 , (0,0). "" , "". X:

X_complex=X_complex_origin+(X_image/X_image_width)*X_complex_width
+14

, , , coords =:

coords = (uleft[0] + (x/size[0]) * (xwidth),uleft[1] - (y/size[1]) * (ywidth))

x y, , , . , (0,0) , (-2,1.25), (1,0) , 1/500 ( 500 ) -2 0.5 x-.

, - X- , :

mandel_x = mandel_start_x + (screen_x / screen_width) * mandel_width

( mandel_ , screen_ .)

, , : , , uleft lright. .. , (x1, y1).. (x2, y2), :

new_uleft = (uleft[0] + (x1/size[0]) * (xwidth), uleft[1] - (y1/size[1]) * (ywidth))
new_lright = (uleft[0] + (x2/size[0]) * (xwidth), uleft[1] - (y2/size[1]) * (ywidth))

(, , xwidth, ywidth )

, , , mandelbrot, ( ). , , , , .

, , , . (, (0.0, 0.0) . ( ) - , . 5, - 2.0 sqrt(5) (~ 2.236), .

, , , ( trials ), .

+4

All Articles