File:Julia dem c=-0.1+0.651.png

From testwiki
Jump to navigation Jump to search
    Original file (2,000 × 2,000 pixels, file size: 454 KB, MIME type: image/png)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: Imploaded Rabbit Julia set : Julia set for fc(z)=z*z + c and c=-0.1+0.651. Made using DEM/J. C parameter for this file is from program by Jonas Lundgren
    Date
    Source Own work
    Author Adam majewski
    Other versions

    Long description

    program

    This is console c program. It makes ppm file. It uses DEM/J method[1]

    c parameter

    C parameter for this file is from program by Jonas Lundgren[2]

    it is :

    • outside Mandelbrot set thus Julia set is disconnected
    • between period 1 and 3
    • on the right to the root of period 3 component
    • in the 1/3-wake ( wake of the period-3 component) = above ray 1/7=0.(001) =
    • in the (1/3, 1/25)-subwake bounded by rays 5396990266136737387082/37778931862957161709567 and 5396990266136737387089/37778931862957161709567

    dynamic rays and periodic points

    Rays : 1/7, 2/7, 4/7 land on period one point :

     z = -0.237943688964178  +0.441090566757054 i
    

    which is a center of 3-arm spiral

    So here period of landing point is different then period of points on the external rays that lands on it


    Period 3 points :

    • z = -0.437544375897169 +0.596837602749673 i
    • z = -0.264770043176733 +0.128714127185863 i
    • z = -0.046464150773409 +0.582840709975087 i

    are centers of 3 one-arm spirals

    What rays land on these points ?

    Not (checked manually ):

    • period 6 wher angle = p/63
    • not period 9 where angle = p/511

    First angle is :

    10/63 = 0.158 < angle < 1/7 = 0.1428

    Note that 1/7 = 9/63 = 73/511

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
    You are free:
    • to share – to copy, distribute and transmit the work
    • to remix – to adapt the work
    Under the following conditions:
    • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
    • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.


    C source code

    gcc d.c -lm -Wall 
     ./a.out
    

    Postprocessing using ImageMagic library :

    convert f.ppm -resize 2000x2000 f.png
    
    /* 
       c console  program:
       1. draws Julia setfor Fc(z)=z*z +c
       using DEM/J algorithm ( Distance Esthimation Method for Julia set )
       -------------------------------         
       2. technic of creating ppm file is  based on the code of Claudio Rocchini
       http://en.wikipedia.org/wiki/Image:Color_complex_plot.jpg
       create 24 bit color graphic file ,  portable pixmap file = PPM 
       see http://en.wikipedia.org/wiki/Portable_pixmap
       to see the file use external application ( graphic viewer)
       ---------------------------------
       I think that creating graphic can't be simpler
       comments : Adam Majewski 
    
       gcc d.c -lm -Wall
    
       it creates a.out file. Then run it :
    
       ./a.out
    
    
    
    
    */
    
    
    
    #include <stdio.h>
    #include <math.h>
    
    
    /*
      estimates distance from point c to nearest point in Julia  set 
      for Fc(z)= z*z + c
      z(n+1) = Fc(zn)  
      this function is based on function  mndlbrot::dist  from  mndlbrot.cpp
      from program mandel by Wolf Jung (GNU GPL )
      http://www.mndynamics.com/indexp.html 
    
      Hyunsuk Kim  : 
      For Julia sets, z is the variable and c is a constant. Therefore df[n+1](z)/dz = 2*f[n]*f'[n] -- you don't add 1.
    
      For the Mandelbrot set on the parameter plane, you start at z=0 and c becomes the variable. df[n+1](c)/dc = 2*f[n]*f'[n] + 1. 
    
    
    */
    double jdist(double Zx, double Zy, double Cx, double Cy ,  int iter_max)
    { 
      int i;
      double x = Zx, /* Z = x+y*i */
        y = Zy, 
        /* Zp = xp+yp*1 = 1  */
        xp = 1, 
        yp = 0, 
        /* temporary */
        nz,  
        nzp,
        /* a = abs(z) */
        a; 
      for (i = 1; i <= iter_max; i++)
        { /* first derivative   zp = 2*z*zp  = xp + yp*i; */
          nz = 2*(x*xp - y*yp) ; 
          yp = 2*(x*yp + y*xp); 
          xp = nz;
          /* z = z*z + c = x+y*i */
          nz = x*x - y*y + Cx; 
          y = 2*x*y + Cy; 
          x = nz; 
          /* */
          nz = x*x + y*y; 
          nzp = xp*xp + yp*yp;
          if (nzp > 1e60 || nz > 1e60) break;
        }
      a=sqrt(nz);
      /* distance = 2 * |Zn| * log|Zn| / |dZn| */
      return 2* a*log(a)/sqrt(nzp); 
    }
    /* ------------------------------------------------------*/
    int main(void)
    {
      const double Cx=-0.74543;
      const double Cy=0.11301;
      /* screen ( integer) coordinate */
      int iX,iY;
      const int iXmax = 10000; 
      const int iYmax = 10000;
      /* world ( double) coordinate = parameter plane*/
      const double ZxMin=-2.;
      const double ZxMax=2.0;
      const double ZyMin=-2.0;
      const double ZyMax=2.0;
      /* */
      double PixelWidth=(ZxMax-ZxMin)/iXmax;
      double PixelHeight=(ZyMax-ZyMin)/iYmax;
      /* color component ( R or G or B) is coded from 0 to 255 */
      /* it is 24 bit color RGB file */
      const int MaxColorComponentValue=255; 
      FILE * fp;
      char *filename="demj-.ppm";
      char *comment="# ";/* comment should start with # */
      static unsigned char color[3];
      double Zx, Zy,    /* Z=Zx+Zy*i   */
        Z0x, Z0y,  /* Z0 = Z0x + Z0y*i */
        Zx2, Zy2; /* Zx2=Zx*Zx;  Zy2=Zy*Zy  */
      /*  */
      int Iteration;
      const int IterationMax=2000;
      /* bail-out value , radius of circle ;  */
      const int EscapeRadius=400;
      int ER2=EscapeRadius*EscapeRadius;
      double distanceMax=PixelWidth/15; /*jdist( 0,0,Cx,Cy, IterationMax);*/
      /*create new file,give it a name and open it in binary mode  */
      fp= fopen(filename,"wb"); /* b -  binary mode */
      /*write ASCII header to the file*/
      fprintf(fp,"P6\n %s\n %d\n %d\n %d\n",comment,iXmax,iYmax,MaxColorComponentValue);
      /* compute and write image data bytes to the file*/
      for(iY=0;iY<iYmax;++iY)
        {
          Z0y=ZyMax - iY*PixelHeight; /* reverse Y  axis */
          if (fabs(Z0y)<PixelHeight/2) Z0y=0.0; /*  */    
          for(iX=0;iX<iXmax;++iX)
    	{    /* initial value of orbit Z0 */
    	  Z0x=ZxMin + iX*PixelWidth;
    	  /* Z = Z0 */
    	  Zx=Z0x;
    	  Zy=Z0y;
    	  Zx2=Zx*Zx;
    	  Zy2=Zy*Zy;
    	  /* */
    	  for (Iteration=0;Iteration<IterationMax && ((Zx2+Zy2)<ER2);Iteration++)
    	    {
    	      Zy=2*Zx*Zy + Cy;
    	      Zx=Zx2-Zy2 +Cx;
    	      Zx2=Zx*Zx;
    	      Zy2=Zy*Zy;
    	    };
    	  /* compute  pixel color (24 bit = 3 bytes) */
    	  if (Iteration==IterationMax)
    	    { /*  interior of Julia set  = black */
    	      color[0]=0;
    	      color[1]=0;
    	      color[2]=0;                           
    	    }
    	  else /* exterior of Filled-in Julia set  =  */
    	    {  double distance=jdist(Z0x,Z0y,Cx,Cy,IterationMax);
    	      if (distance<distanceMax)
    		{ /*  Julia set  = white */
    		  color[0]=255; /* Red*/
    		  color[1]=255;  /* Green */ 
    		  color[2]=255;/* Blue */
    		}
    	      else 
    		{ /*  exterior of Julia set  = black */
    		  color[0]=0;
    		  color[1]=0;
    		  color[2]=0;                           
    		};
    	    }
    	  /* check the orientation of Z-plane */
    	  /* mark first quadrant of cartesian plane*/     
    	  /*     if (Z0x>0 && Z0y>0) color[0]=255-color[0];  */
    	  /*write color to the file*/
    	  fwrite(color,1,3,fp);
    	}
        }
      fclose(fp);
      printf("file saved ");
      getchar();
      return 0;
    }
    

    References

    1. ↑ DEM/J in wikibooks
    2. ↑ Julia sets in Matlab using DEM by Jonas Lundgren [dead link]

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    26 June 2011

    image/png

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current14:21, 26 June 2011Thumbnail for version as of 14:21, 26 June 20112,000 × 2,000 (454 KB)wikimediacommons>Soul windsurfer

    There are no pages that use this file.