Αρχείο:Demj.jpg

Τα περιεχόμενα της σελίδας δεν υποστηρίζονται σε άλλες γλώσσες.
Αυτό το αρχείο προέρχεται από το Wikimedia Commons
Από τη Βικιπαίδεια, την ελεύθερη εγκυκλοπαίδεια

Εικόνα σε υψηλότερη ανάλυση(2.000 × 1.250 εικονοστοιχεία, μέγεθος αρχείου: 332 KB, τύπος MIME: image/jpeg)

Σύνοψη

Περιγραφή Julia set using DEM/J for c=-0.74543+0.11301*i and f(z)=z*z+c. It is the same as Fig 4.15 on page 194 from "The science of fractal images" by Peitgen and Saupe
Ημερομηνία
Πηγή self-made ( C program )
Δημιουργός Adam majewski

Compare with


http://www.mostlymaths.net/2011/06/gift-quadratic-julia-set-for-icelands.html

https://plus.google.com/+OwenMaresh/posts/TPPdrnC56t9

  To construct: find the parameter value associated with the frond-tail Misiurewicz point of the period-27 bulb of the n-Mandelbrot set, and make pictures of the Julia sets associated with them. Owen Maresh

C source code

It is a console C program ( one file) It can be compiled under :

  • windows ( gcc through Dev-C++ )
  • linux and mac using gcc :
gcc main.c -lm

it creates a.out file. Then run it :

./a.out

It creates ppm file in program directory.

Convert to jpg and resize from 2.8 GB ppm file to 331 kB jpg file with Image Magic:

convert g3.ppm -resize 2000x1250 g3.jpg

Use file viewer to see it.

 /* 
   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

   it creates a.out file. Then run it :

   ./a.out




*/



#include <stdio.h>
#include <math.h>



int GiveEscapeTimeJ(double _Zx0, double _Zy0,double C_x, double C_y, int iMax, double _ER2)
{ 
  int i;
  double Zx, Zy;
  double Zx2, Zy2; /* Zx2=Zx*Zx;  Zy2=Zy*Zy  */
 
  Zx=_Zx0; /* initial value of orbit  */
  Zy=_Zy0;
  Zx2=Zx*Zx;
  Zy2=Zy*Zy;
 
  for (i=0;i<iMax && ((Zx2+Zy2)<_ER2);i++)
    {
      Zy=2*Zx*Zy + C_y;
      Zx=Zx2-Zy2 +C_x;
      Zx2=Zx*Zx;
      Zy2=Zy*Zy;
    };
  return i;
}

 


/*
  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 = 40000; 
  const int iYmax = 25000;
  /* world ( double) coordinate = parameter plane*/
  const double ZxMin=-2.0;
  const double ZxMax=2.0;
  const double ZyMin=-1.25;
  const double ZyMax=1.25;
  /* */
  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="g3.ppm";
  char *comment="# ";/* comment should start with # */

  static unsigned char color[3];

  double Zx0, Zy0;  /* Z0 = Zx0 + Zy0*i */
    
  /*  */
  int LastIteration;
  const int IterationMax=2000;
  /* bail-out value , radius of circle ;  */
  const int EscapeRadius=400;
  int ER2=EscapeRadius*EscapeRadius;
  double distanceMax=PixelWidth/5; /*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)
    {
      Zy0=ZyMax - iY*PixelHeight; /* reverse Y  axis */
      if (fabs(Zy0)<PixelHeight/2) Zy0=0.0; /*  */    
      for(iX=0;iX<iXmax;++iX)
	{    /* initial value of orbit Z0 */
	  Zx0=ZxMin + iX*PixelWidth;

	  LastIteration = GiveEscapeTimeJ(Zx0, Zy0, Cx, Cy, IterationMax, ER2);

	  /* compute  pixel color (24 bit = 3 bytes) */
	  if (LastIteration==IterationMax)
	    { /*  interior of Julia set  = white */
	      color[0]=255;
	      color[1]=255;
	      color[2]=255;                           
	    }
	  else /* exterior of Filled-in Julia set  =  */
	    {  double distance=jdist(Zx0,Zy0,Cx,Cy,IterationMax);
	      if (distance<distanceMax)
		{ /*  Julia set  = black */
		  color[0]=0; /* Red*/
		  color[1]=0;  /* Green */ 
		  color[2]=0;/* Blue */
		}
	      else 
		{ /*  exterior of Julia set  = white */
		  color[0]=255;
		  color[1]=255;
		  color[2]=255;                           
		};
	    }
	  /* 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  %s saved\n", filename);
  getchar();
  return 0;
}

Αδειοδότηση

w:el:Creative Commons
αναφορά προέλευσης παρόμοια διανομή
Είστε ελεύθερος:
  • να μοιραστείτε – να αντιγράψετε, διανέμετε και να μεταδώσετε το έργο
  • να διασκευάσετε – να τροποποιήσετε το έργο
Υπό τις ακόλουθες προϋποθέσεις:
  • αναφορά προέλευσης – Θα πρέπει να κάνετε κατάλληλη αναφορά, να παρέχετε σύνδεσμο για την άδεια και να επισημάνετε εάν έγιναν αλλαγές. Μπορείτε να το κάνετε με οποιοδήποτε αιτιολογήσιμο λόγο, χωρίς όμως να εννοείται με οποιονδήποτε τρόπο ότι εγκρίνουν εσάς ή τη χρήση του έργου από εσάς.
  • παρόμοια διανομή – Εάν αλλάξετε, τροποποιήσετε ή δημιουργήσετε πάνω στο έργο αυτό, μπορείτε να διανείμετε αυτό που θα προκύψει μόνο υπό τους όρους της ίδιας ή συμβατής άδειας με το πρωτότυπο.

Λεζάντες

Δεν ορίστηκε λεζάντα

Items portrayed in this file

απεικονίζει

Ιστορικό αρχείου

Κλικάρετε σε μια ημερομηνία/ώρα για να δείτε το αρχείο όπως εμφανιζόταν εκείνη τη στιγμή.

Ώρα/Ημερομ.ΜικρογραφίαΔιαστάσειςΧρήστηςΣχόλια
τελευταία19:45, 26 Ιουνίου 2011Μικρογραφία για την έκδοση της 19:45, 26 Ιουνίου 20112.000 × 1.250 (332 KB)Soul windsurferbetter quality
20:39, 27 Μαΐου 2011Μικρογραφία για την έκδοση της 20:39, 27 Μαΐου 20112.000 × 2.000 (351 KB)Soul windsurferremoved error in code (thx to Hyunsuk Kim ). Converted with Image Magic : convert d.ppm -resize 2000x2000 d.jpg
17:13, 1 Μαρτίου 2008Μικρογραφία για την έκδοση της 17:13, 1 Μαρτίου 20087.000 × 7.000 (3,01 MB)Soul windsurfer{{Information |Description=Julia set using DEM/J for c=-0.74543+0.11301*i and f(z)=z*z+c |Source=self-made |Date= |Author= Adam majewski |Permission= |other_versions= }}

Τα παρακάτω λήμματα συνδέουν σε αυτό το αρχείο:

Καθολική χρήση αρχείου

Τα ακόλουθα άλλα wiki χρησιμοποιούν αυτό το αρχείο:

Μεταδεδομένα