Skip to content Skip to sidebar Skip to footer

I became very interested in fractals recently – you can find them everywhere, especially in nature. Here is a nice Python script I found, which generates a mandelbrot. It takes some time to generate the image but it’s definitely worth waiting!

_                                      =   (
                               V       ,B,c
                             :c   and Y(V*V+B,B,  c
               (              2+c-4*abs(V)**-0.4)/i
                 )  ;v,      x=1500,1000;C=range(v*x
                  );import  struct;P=struct.pack;M,\
            j  ='<QIIHHHH',open('M.bmp','wb').write
for X in j('BM'+P(M,v*x*3+26,26,12,v,x,1,24))or C:
            i  ,Y=_;j(P('BBB',*(lambda T:(T*80+T**9
                  *i-950*T  **99,T*70-880*T**18+701*
                 T  **9     ,T*i**(1-T**45*2)))(sum(
               [              Y(0,(A%3/3.+X%v+(X/v+
                             /x   -2.7,i)**2 for  \
                               A       in C
                                       )   )

Leave a comment