File:Julia set f(z)=z^6+A*z+c A=(-33725751,810162*i)*2^-25 c=(-3096576+8798208*i)*2^-25.png

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(2,000 × 2,000 pixels, file size: 637 KB, MIME type: image/png)

Captions

Captions

Julia set f(z)=z^6+A*z+c A=(-33725751,810162*i)*2^-25 c=(-3096576+8798208*i)*2^-25

Summary[edit]

Description
English: Julia set f(z)=z^6+A*z+c A=(-33725751,810162*i)*2^-25 c=(-3096576+8798208*i)*2^-25. Construction of polynomial (location) and precise description by Marc Meidlinger: "Not a new record" [1]: "Degree-6 polynomial with a period-2 ... and 114 cycle (...). The shapes in the image are quite interesting. The two big immediate basin spirals intertwined with one another - and a lot of smaller ones looking like that. But then there are jets of spirals that seem to stem off from a larger central object (a wall) - and at some point they switch to the 2-spiral type (red lines). But maybe that's just me trying to find patterns in a shape distribution. Numerically all critical points are bounded, so all those spirals are probably connected to one another."
Date
Source Own work
Author Adam majewski

Licensing[edit]

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 4.0 International 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.


desription[edit]

coefficients read from input file notanewrecord.txt
	degree 6 coefficient = ( +1.0000000000000000 +0.0000000000000000*i) 
	degree 1 coefficient = ( -33725751 +810162*i) / 2^25
	degree 0 coefficient = ( -3096576 +8798208*i) / 2^25

Input polynomial p(z)=(1+0i)*z^6+(-1.0051057040691375732+0.024144709110260009766i)*z^1+(-0.09228515625+0.26220703125i)

5 critical points found

	cp#0: -0.56794047426116178734,-0.40847921338878506736 . It's critical orbit is bounded and enters cycle #0 length=114 and it's stability = |multiplier|=0.58362 =attractive 
	internal angle = 0.85112535474998696206
cycle = {
-0.37020738420809090607,-0.088965586879895641736 ; 0.28243304753188291922,0.34569805279417809007 ; -0.38002385518980907886,-0.084957757540849998534 ; 0.29259673183151385656,0.34180025000531666368 ; -0.39091241236066720521,-0.081691333875167193579 ; 0.30392821432048039432,0.33870849493758353743 ; -0.40311199491732430111,-0.079311314695253432028 ; 0.31669559300271959978,0.33660966821970533802 ; -0.41695307975258677491,-0.078058089455040113869 ; 0.33127010805454748521,0.33581626378106310682 ; -0.43290446899351792132,-0.078333171578885585351 ; 0.34817586224484575741,0.33686145530877587007 ; -0.45165111916170375128,-0.080832892552943347297 ; 0.3681639506637739423,0.34069875730463750063 ; -0.4742233171123159674,-0.086844692161181180623 ; 0.39229978819021288361,0.34915925364882566262 ; -0.50218726773222444049,-0.09898168400311774251 ; 0.42191099514053864716,0.36610976063220340704 ; -0.53769493033487136824,-0.12327702740526824687 ; 0.45724168490936079046,0.40064198487853003305 ; -0.58097395865380385693,-0.17603005949438116362 ; 0.4862375602167633426,0.47421224511824577874 ; -0.59982224619979129798,-0.30057576427488386095 ; 0.43231907451188833491,0.58148495909564124062 ; -0.42962891932561164676,-0.40440691235598735798 ; 0.34169065792026426243,0.61680766418450372335 ; -0.3283918808185394278,-0.33645943088012386646 ; 0.24669273114934714419,0.58168337994645391564 ; -0.30708188165256072866,-0.27382819069203701012 ; 0.22134424568745075801,0.52545068003058614803 ; -0.30229519648132496812,-0.23717628417234876137 ; 0.21515636135268378926,0.49087785293649821572 ; -0.30171179602940967346,-0.21139263390234075413 ; 0.2139084342599832933,0.46614053751555617477 ; -0.30312245429950579467,-0.19147704630462025754 ; 0.21494422309921984438,0.44684057062027882079 ; -0.30574177034845045897,-0.17524100853067997585 ; 0.21733384153501317249,0.43099684262531778867 ; -0.30920795152646840531,-0.16153325831138198865 ; 0.22065652689921810836,0.41755068884045265509 ; -0.31333359741882166327,-0.14967584888511975549 ; 0.22469722252600932144,0.40587222683467516493 ; -0.31801819380175611052,-0.13923860209265964683 ; 0.22934146630324936389,0.39555899705730124261 ; -0.32321100454345680353,-0.12993443641588808823 ; 0.2345315011911912606,0.38634133123912600682 ; -0.32889355982298540404,-0.12156558887098040111 ; 0.24024585372280665707,0.37803334033164215366 ; -0.33507108504626625933,-0.11399400646254903569 ; 0.24648946093927215362,0.37050584851020557098 ; -0.34176863929359724281,-0.10712440461044719919 ; 0.25328927841195475468,0.36367099833154348243 ; -0.34903017886557619054,-0.10089463324829034407 ; 0.26069325784976282723,0.35747374388388297728 ; -0.35691986458862090537,-0.095270787242251020466 ; 0.26877189842322291025,0.35188800614169934988 ; -0.36552555719699364456,-0.09024596708981330595 ; 0.27762231254554964321,0.34691667962937522418 ; -0.37496494710561156793,-0.085842576809095127999 ; 0.28737533020733446731,0.34259573511734003892 ; -0.38539535410695452411,-0.08211900408960204345 ; 0.29820683872353492827,0.33900386348478006582 ; -0.39702912968657938508,-0.079182914565264883588 ; 0.31035554759595668228,0.3362810598781597049 ; -0.41015815334429550632,-0.077215981122150445515 ; 0.32415099348752740571,0.33466345162030253224 ; -0.42519380522765509722,-0.076520445120452362797 ; 0.340058265324521658,0.33455045904374258736 ; -0.44273431832161447286,-0.077611229405055992547 ; 0.35874963730904141368,0.3366421269193797805 ; -0.46368168821337241159,-0.08141263501824386184 ; 0.38121376487924563126,0.34224384833279108964 ; -0.48944505821878075968,-0.089724234149542114736 ; 0.40887519564148844253,0.35401611210606775959 ; -0.5222447856411285283,-0.10648547202336994255 ; 0.44335766259527786826,0.37805051168804432171 ; -0.56496463090364845705,-0.1418455424175494306 ; 0.48268981215056594447,0.43002370603362943813 ; -0.61256354774212107284,-0.2270238888617136519 ; 0.48768236180764346077,0.54151070823433555823 ; -0.54933850811923212731,-0.41277099255849059034 ; 0.3910243300147835388,0.59404073130645773659 ; -0.37816265074989963146,-0.36995114154802621886 ; 0.29529803651660552211,0.60304229031064737754 ; -0.31957768758561011513,-0.3002988405599903432 ; 0.23485576374152578039,0.54933424167671240923 ; -0.30734450673233781881,-0.2543631300118066596 ; 0.22061384218185770001,0.50704121479223362989 ; -0.3040264424567433732,-0.22413912908305511085 ; 0.21642925997771061963,0.47834633056465991618 ; -0.30399003525928780522,-0.20166332727085434229 ; 0.21593115380175020857,0.45670188060900573923 ; -0.30569345194724473203,-0.18376651560592527357 ; 0.21735863756648760026,0.4393131236571801157 ; -0.30850929335436833023,-0.16889537174896818161 ; 0.22000178517800322853,0.42477301273766598921 ; -0.31213138857668609738,-0.15617739729918184155 ; 0.22351763745073177647,0.41227890801573852109 ; -0.31639719199414251261,-0.14507670882688566971 ; 0.22772552972227683155,0.40133287589126870332 ; -0.32121950079026273528,-0.13524360383050293422 ; 0.23252901785106322441,0.39160791308236919672 ; -0.32655601204912343416,-0.12644053112983627551 ; 0.23788139656476303685,0.38288123604007834322 ; -0.33239459689060513181,-0.11850251693752816839 ; 0.24376917912853196535,0.37499834983617824635 ; -0.33874611245830293926,-0.11131485411884456393 ; 0.2502041214754174292,0.3678527839831537416 ; -0.3456413808303911428,-0.10480029463322354522 ; 0.2572199410455420221,0.36137462318831914398 ; -0.35313090956055248615,-0.098912045735421338932 ; 0.26487211966539542241,0.3555245853368822484 ; -0.36128686417964228639,-0.093630850053960212875 ; 0.27324025015243263992,0.35029223137992543391 ; }

	cp#1: -0.56399007600458894718,0.41391647012779264614 . It's critical orbit is bounded and enters cycle #1 length=2 and it's stability = |multiplier|=0.95717 =attractive 
	internal angle = 0.027798895886190787968
cycle = {
-0.33222664408882929266,0.39454475039323866348 ; 0.24135668564377149581,-0.12596994278571371773 ; }

	cp#2: 0.21937543797268924117,0.6642936604311414639 . It's critical orbit is bounded  and enters cycle #1

	cp#3: 0.69957155296860529248,-0.0033604094702661367611 . It's critical orbit is bounded  and enters cycle #1

	cp#4: 0.21298355932445617311,-0.66637050769988304122 . It's critical orbit is bounded  and enters cycle #1

c source code[edit]

/*
https://fractalforums.org/fractal-mathematics-and-new-theories/28/julia-sets-true-shape-and-escape-time/2725/msg23429#msg23429
Construction of polynomial (location) and precise description by Marc Meidlinger

"Not a new record"

Degree-6 polynomial with a period-2 cycle detected (turquois) and unfortunately a period-114 cycle I could not find so far with the TSA (not even with monotonicity consideration) at L19R2. L20 will be conducted when I have a faster computer.

The shapes in the image are quite interesting. The two big immediate basin spirals intertwined with one another - and a lot of smaller ones looking like that.

But then there are jets of spirals that seem to stem off from a larger central object (a wall) - and at some point they switch to the 2-spiral type (red lines). But maybe that's just me trying to find patterns in a shape distribution.

Numerically all critical points are bounded, so all those spirals are probably connected to one another.

f(z)=z^6+A*z+c
A=(-33725751,810162*i)*2^-25
c=(-3096576+8798208*i)*2^-25




  Adam Majewski
  adammaj1 aaattt o2 dot pl  // o like oxygen not 0 like zero 
  
  
  
  Structure of a program or how to analyze the program 
  
  
  ============== Image X ========================
  
  DrawImageOfX -> DrawPointOfX -> ComputeColorOfX 
  
  first 2 functions are identical for every X
  check only last function =  ComputeColorOfX
  which computes color of one pixel !
  
  

   
  ==========================================

  
  ---------------------------------
  indent d.c 
  default is gnu style 
  -------------------



  c console progam 
  
	export  OMP_DISPLAY_ENV="TRUE"	
  	gcc d.c -lm -Wall -march=native -fopenmp
  	time ./a.out > b.txt


  gcc d.c -lm -Wall -march=native -fopenmp


  time ./a.out

  time ./a.out >i.txt
  time ./a.out >e.txt
  
  
  
  
  
  
  convert -limit memory 1000mb -limit disk 1gb dd30010000_20_3_0.90.pgm -resize 2000x2000 10.png

  
  
  
*/

#include <stdio.h>
#include <stdlib.h>		// malloc
#include <string.h>		// strcat
#include <math.h>		// M_PI; needs -lm also
#include <complex.h>
#include <omp.h>		// OpenMP
#include <limits.h>		// Maximum value for an unsigned long long int



// https://sourceforge.net/p/predef/wiki/Standards/

#if defined(__STDC__)
#define PREDEF_STANDARD_C_1989
#if defined(__STDC_VERSION__)
#if (__STDC_VERSION__ >= 199409L)
#define PREDEF_STANDARD_C_1994
#endif
#if (__STDC_VERSION__ >= 199901L)
#define PREDEF_STANDARD_C_1999
#endif
#endif
#endif




/* --------------------------------- global variables and consts ------------------------------------------------------------ */



// virtual 2D array and integer ( screen) coordinate
// Indexes of array starts from 0 not 1 
//unsigned int ix, iy; // var
static unsigned int ixMin = 0;	// Indexes of array starts from 0 not 1
static unsigned int ixMax;	//
static unsigned int iWidth;	// horizontal dimension of array

static unsigned int iyMin = 0;	// Indexes of array starts from 0 not 1
static unsigned int iyMax;	//

static unsigned int iHeight = 10000;	//  
// The size of array has to be a positive constant integer 
static unsigned long long int iSize;	// = iWidth*iHeight; 

// memmory 1D array 
unsigned char *data;
unsigned char *edge;
//unsigned char *edge2;

// unsigned int i; // var = index of 1D array
//static unsigned int iMin = 0; // Indexes of array starts from 0 not 1
static unsigned int iMax;	// = i2Dsize-1  = 
// The size of array has to be a positive constant integer 
// unsigned int i1Dsize ; // = i2Dsize  = (iMax -iMin + 1) =  ;  1D array with the same size as 2D array



// see SetPlane

double radius = 1.2; 
complex double center = 0.0;
double AspectRatio = 1.0; // https://en.wikipedia.org/wiki/Aspect_ratio_(image)
// dx = dy compare setup : iWidth = iHeight;
double ZxMin; //= -1.3;	//-0.05;
double ZxMax;// = 1.3;	//0.75;
double ZyMin;// = -1.3;	//-0.1;
double ZyMax;// = 1.3;	//0.7;
double PixelWidth;	// =(ZxMax-ZxMin)/ixMax;
double PixelHeight;	// =(ZyMax-ZyMin)/iyMax;

double ratio; 


/*
ER = pow(10,ERe);
   AR = pow(10,-ARe);
 */
//int ARe ;			// increase ARe until black ( unknown) points disapear 
//int ERe ;
double ER;
double ER2;			//= 1e60;
double AR; // bigger values do not works
double AR2;
double AR12;



int IterMax = 100000;


/* colors = shades of gray from 0 to 255 

 unsigned char colorArray[2][2]={{255,231},    {123,99}};
 color = 245;  exterior 
*/
unsigned char iColorOfExterior = 245;
unsigned char iColorOfInterior1 = 99;
unsigned char iColorOfInterior2 = 183;
unsigned char iColorOfBoundary = 0;
unsigned char iColorOfUnknown = 5;

// pixel counters
unsigned long long int uUnknown = 0;
unsigned long long int uInterior = 0;
unsigned long long int uExterior = 0;



// periodic points = attractors
complex double zp114 =-0.54933850811923212731	-0.41277099255849059034*I ; //period 114
complex double zp2= -0.33222664408882929266	+0.39454475039323866348*I ; // period 2



/*

f(z)=z^6+A*z+c
A=(-33725751,810162*i)*2^-25
c=(-3096576+8798208*i)*2^-25


c is case sensitive 
changed to lower because A is used 
*/

complex double a;
complex double c;

/* ------------------------------------------ functions -------------------------------------------------------------*/





//------------------complex numbers -----------------------------------------------------





// from screen to world coordinate ; linear mapping
// uses global cons
double
GiveZx (int ix)
{
  return (ZxMin + ix * PixelWidth);
}

// uses globaal cons
double
GiveZy (int iy)
{
  return (ZyMax - iy * PixelHeight);
}				// reverse y axis


complex double
GiveZ (int ix, int iy)
{
  double Zx = GiveZx (ix);
  double Zy = GiveZy (iy);

  return Zx + Zy * I;




}



double cabs2(complex double z){

	return creal(z)*creal(z)+cimag(z)*cimag(z);


}


//A=(-33725751,810162*i)*2^-25
//c=(-3096576+8798208*i)*2^-25
complex double ToComplexDouble( double m, double n){

	return (m+n*I)/pow(2.0,25.0);
	


}



// =====================
int IsPointInsideTrap1(complex double  z){

	
	 
	
	if ( cabs2(z - zp114) < AR2) {return 1;} // circle with prabolic point zp on it's boundary
	return 0; // outside



}



// =====================
int IsPointInsideTrap2(complex double  z){

	
	if (cabs2(z - zp2) <AR2) {return 1;} // circle around periodic point
	
	return 0; // outside



}









// ****************** DYNAMICS = trap tests ( target sets) ****************************


/* -----------  array functions = drawing -------------- */

/* gives position of 2D point (ix,iy) in 1D array  ; uses also global variable iWidth */
unsigned int
Give_i (unsigned int ix, unsigned int iy)
{
  return ix + iy * iWidth;
}



// f(z)=1+z−3z2−3.75z3+1.5z4+2.25z5
unsigned char
ComputeColor_Fatou (complex double z, int IterMax)
{



	complex double z6;
	
	double r2;


  	int i;			// number of iteration
  	for (i = 0; i < IterMax; ++i)
    	{


		z6 = z*z*z*z*z*z;

      		z = z6 +a*z +c;		// complex iteration f(z)=z^6+A*z+c
		r2 =cabs2(z);
		
      		if (r2 > ER2) // esaping = exterior
		{
	  		uExterior += 1;
	  		return iColorOfExterior;
		}			
	
	
	
		if ( IsPointInsideTrap1(z)) {
			uInterior +=1;
			return 50 + (i % 114); }
	
		if (IsPointInsideTrap2(z)){
			uInterior +=1;
			return iColorOfInterior2;}

	

    	}

  	uUnknown += 1;
  	return iColorOfUnknown;


}





// plots raster point (ix,iy) 
int
DrawFatouPoint (unsigned char A[], int ix, int iy, int IterMax)
{
  int i;			/* index of 1D array */
  unsigned char iColor = 0;
  complex double z;


  i = Give_i (ix, iy);		/* compute index of 1D array from indices of 2D array */
  z = GiveZ (ix, iy);
  iColor = ComputeColor_Fatou (z, IterMax);
  A[i] = iColor;		// interior

  return 0;
}




// fill array 
// uses global var :  ...
// scanning complex plane 
int
DrawFatouImage (unsigned char A[], int IterMax)
{
  unsigned int ix, iy;		// pixel coordinate 

  fprintf (stdout, "compute Fatou image \n");
  // for all pixels of image 
#pragma omp parallel for schedule(dynamic) private(ix,iy) shared(A, ixMax , iyMax, uUnknown, uInterior, uExterior)
  for (iy = iyMin; iy <= iyMax; ++iy)
    {
      fprintf (stderr, " %d from %d \r", iy, iyMax);	//info 
      for (ix = ixMin; ix <= ixMax; ++ix)
	DrawFatouPoint (A, ix, iy, IterMax);	//  
    }

  return 0;
}


//=========



int IsInside (int x, int y, int xcenter, int ycenter, int r){

	
	double dx = x- xcenter;
	double dy = y - ycenter;
	double d = sqrt(dx*dx+dy*dy);
	if (d<r) 
		return 1;
	return 0;
	  

} 

int PlotBigPoint(complex double z, unsigned char A[]){

	
	unsigned int ix_seed = (creal(z)-ZxMin)/PixelWidth;
	unsigned int iy_seed = (ZyMax - cimag(z))/PixelHeight;
	unsigned int i;
	
	
	 /* mark seed point by big pixel */
  	int iSide =3.0*iWidth/2000.0 ; /* half of width or height of big pixel */
  	int iY;
  	int iX;
  	for(iY=iy_seed-iSide;iY<=iy_seed+iSide;++iY){ 
    		for(iX=ix_seed-iSide;iX<=ix_seed+iSide;++iX){ 
    			if (IsInside(iX, iY, ix_seed, iy_seed, iSide)) {
      			i= Give_i(iX,iY); /* index of _data array */
      			A[i]= 255-A[i];}}}
	
	
	return 0;
	
}


// fill array 
// uses global var :  ...
// scanning complex plane 
int MarkAttractors (unsigned char A[])
{
  
	
	
	
  	fprintf (stderr, "mark attractors \n");
  
  	PlotBigPoint(zp114, A); // period 114  cycle
    	PlotBigPoint(zp2, A);	// period 2 attracting cycle
    		 
      	

  	return 0;
}


// =====================
int IsPointInsideTraps(unsigned int ix, unsigned int iy){

	
	complex double  z = GiveZ (ix, iy);
	
	if ( IsPointInsideTrap1(z)) {return 1;} // circle with prabolic point on it's boundary
	
	if (IsPointInsideTrap2(z)) {return 1;}
	
	return 0; // outside



}





int MarkTraps(unsigned char A[]){

	unsigned int ix, iy;		// pixel coordinate 
	unsigned int i;


  	fprintf (stderr, "Mark traps \n");
  	// for all pixels of image 
	#pragma omp parallel for schedule(dynamic) private(ix,iy) shared(A, ixMax , iyMax, uUnknown, uInterior, uExterior)
  	for (iy = iyMin; iy <= iyMax; ++iy)
    	{
      		fprintf (stderr, " %d from %d \r", iy, iyMax);	//info 
      		for (ix = ixMin; ix <= ixMax; ++ix){
			if (IsPointInsideTraps(ix, iy)) {
      				i= Give_i(ix,iy); /* index of _data array */
      				A[i]= 255-A[i]; // inverse color
      				}}}
  	return 0;
}






int PlotPoint(complex double z, unsigned char A[]){

	
	unsigned int ix = (creal(z)-ZxMin)/PixelWidth;
	unsigned int iy = (ZyMax - cimag(z))/PixelHeight;
	unsigned int i = Give_i(ix,iy); /* index of _data array */
	
	
	A[i]= 255-A[i]; // Mark point with inveres color
	
	
	return 0;
	
}




// ***********************************************************************************************
// ********************** edge detection usung Sobel filter ***************************************
// ***************************************************************************************************

// from Source to Destination
int ComputeBoundaries(unsigned char S[], unsigned char D[])
{
 
  unsigned int iX,iY; /* indices of 2D virtual array (image) = integer coordinate */
  unsigned int i; /* index of 1D array  */
  /* sobel filter */
  unsigned char G, Gh, Gv; 
  // boundaries are in D  array ( global var )
 
  // clear D array
  memset(D, iColorOfExterior, iSize*sizeof(*D)); // for heap-allocated arrays, where N is the number of elements = FillArrayWithColor(D , iColorOfExterior);
 
  // printf(" find boundaries in S array using  Sobel filter\n");   
#pragma omp parallel for schedule(dynamic) private(i,iY,iX,Gv,Gh,G) shared(iyMax,ixMax)
  for(iY=1;iY<iyMax-1;++iY){ 
    for(iX=1;iX<ixMax-1;++iX){ 
      Gv= S[Give_i(iX-1,iY+1)] + 2*S[Give_i(iX,iY+1)] + S[Give_i(iX-1,iY+1)] - S[Give_i(iX-1,iY-1)] - 2*S[Give_i(iX-1,iY)] - S[Give_i(iX+1,iY-1)];
      Gh= S[Give_i(iX+1,iY+1)] + 2*S[Give_i(iX+1,iY)] + S[Give_i(iX-1,iY-1)] - S[Give_i(iX+1,iY-1)] - 2*S[Give_i(iX-1,iY)] - S[Give_i(iX-1,iY-1)];
      G = sqrt(Gh*Gh + Gv*Gv);
      i= Give_i(iX,iY); /* compute index of 1D array from indices of 2D array */
      if (G==0) {D[i]=255;} /* background */
      else {D[i]=0;}  /* boundary */
    }
  }
 
   
 
  return 0;
}



// copy from Source to Destination
int CopyBoundaries(unsigned char S[],  unsigned char D[])
{
 
  unsigned int iX,iY; /* indices of 2D virtual array (image) = integer coordinate */
  unsigned int i; /* index of 1D array  */
 
 
  //printf("copy boundaries from S array to D array \n");
  for(iY=1;iY<iyMax-1;++iY)
    for(iX=1;iX<ixMax-1;++iX)
      {i= Give_i(iX,iY); if (S[i]==0) D[i]=0;}
 
 
 
  return 0;
}
















// *******************************************************************************************
// ********************************** save A array to pgm file ****************************
// *********************************************************************************************

int
SaveArray2PGMFile (unsigned char A[], int a, int b,  int c, char *comment)
{

  FILE *fp;
  const unsigned int MaxColorComponentValue = 255;	/* color component is coded from 0 to 255 ;  it is 8 bit color file */
  char name[100];		/* name of file */
  snprintf (name, sizeof name, "%d_%d_%d", a, b, c );	/*  */
  char *filename = strcat (name, ".pgm");
  char long_comment[200];
  sprintf (long_comment, "f(z)=z^6+A*z+c A=(-33725751,810162*i)*2^-25 c=(-3096576+8798208*i)*2^-25  %s", comment);





  // save image array to the pgm file 
  fp = fopen (filename, "wb");	// create new file,give it a name and open it in binary mode 
  fprintf (fp, "P5\n # %s\n %u %u\n %u\n", long_comment, iWidth, iHeight, MaxColorComponentValue);	// write header to the file
  fwrite (A, iSize, 1, fp);	// write array with image data bytes to the file in one step 
  fclose (fp);

  // info 
  printf ("File %s saved ", filename);
  if (long_comment == NULL || strlen (long_comment) == 0)
    printf ("\n");
  else
    printf (". Comment = %s \n", long_comment);

  return 0;
}




int
PrintCInfo ()
{

  printf ("gcc version: %d.%d.%d\n", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);	// https://stackoverflow.com/questions/20389193/how-do-i-check-my-gcc-c-compiler-version-for-my-eclipse
  // OpenMP version is displayed in the console : export  OMP_DISPLAY_ENV="TRUE"

  printf ("__STDC__ = %d\n", __STDC__);
  printf ("__STDC_VERSION__ = %ld\n", __STDC_VERSION__);
  printf ("c dialect = ");
  switch (__STDC_VERSION__)
    {				// the format YYYYMM 
    case 199409L:
      printf ("C94\n");
      break;
    case 199901L:
      printf ("C99\n");
      break;
    case 201112L:
      printf ("C11\n");
      break;
    case 201710L:
      printf ("C18\n");
      break;
      //default : /* Optional */

    }

  return 0;
}


int
PrintProgramInfo ()
{


  // display info messages
  printf ("Numerical approximation of Julia set for f(z)=z^6+A*z+c A=(-33725751,810162*i)*2^-25 c=(-3096576+8798208*i)*2^-25  \n");
  //printf ("iPeriodParent = %d \n", iPeriodParent);
  //printf ("iPeriodOfChild  = %d \n", iPeriodChild);
  printf ("parameter A = ( %.16f ; %.16f ) \n", creal (a), cimag (a));
  printf ("parameter c = ( %.16f ; %.16f ) \n", creal (c), cimag (c));
  
  

  printf ("Image Width = %f in world coordinate\n", ZxMax - ZxMin);
  printf ("PixelWidth = %.16f \n", PixelWidth);
  printf ("AR = %.16f = %f *PixelWidth\n", AR, AR / PixelWidth);


  printf("pixel counters\n");
  printf ("uUnknown = %llu\n", uUnknown);
  printf ("uExterior = %llu\n", uExterior);
  printf ("uInterior = %llu\n", uInterior);
  printf ("Sum of pixels  = %llu\n", uInterior+uExterior + uUnknown);
  printf ("all pixels of the array = iSize = %llu\n", iSize);


  // image corners in world coordinate
  // center and radius
  // center and zoom
  // GradientRepetition
  printf ("Maximal number of iterations = iterMax = %d \n", IterMax);
  printf ("ratio of image  = %f ; it should be 1.000 ...\n", ratio);
  //




  return 0;
}



int SetPlane(complex double center, double radius, double a_ratio){

	ZxMin = creal(center) - radius*a_ratio;	
	ZxMax = creal(center) + radius*a_ratio;	//0.75;
	ZyMin = cimag(center) - radius;	// inv
	ZyMax = cimag(center) + radius;	//0.7;
	return 0;

}


// *****************************************************************************
//;;;;;;;;;;;;;;;;;;;;;;  setup ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
// **************************************************************************************

int
setup ()
{

  fprintf (stderr, "setup start\n");






  /* 2D array ranges */

  iWidth = iHeight*AspectRatio;
  iSize = iWidth * iHeight;	// size = number of points in array 
  // iy
  iyMax = iHeight - 1;		// Indexes of array starts from 0 not 1 so the highest elements of an array is = array_name[size-1].
  //ix

  ixMax = iWidth - 1;

  /* 1D array ranges */
  // i1Dsize = i2Dsize; // 1D array with the same size as 2D array
  iMax = iSize - 1;		// Indexes of array starts from 0 not 1 so the highest elements of an array is = array_name[size-1].


	SetPlane( center, radius, AspectRatio);	
  	/* Pixel sizes */
  	PixelWidth = (ZxMax - ZxMin) / ixMax;	//  ixMax = (iWidth-1)  step between pixels in world coordinate 
  	PixelHeight = (ZyMax - ZyMin) / iyMax;
  	ratio = ((ZxMax - ZxMin) / (ZyMax - ZyMin)) / ((double) iWidth / (double) iHeight);	// it should be 1.000 ...

  	ER = 2.0; // 
  	ER2 = ER*ER;
  	AR = PixelWidth*20.0*iWidth/2000.0 ; // 
  	AR2 = AR * AR;
  	AR12 = AR/2.0;
  
  
  	// complex coefficients of the function
	a = ToComplexDouble (-33725751,810162);
	c = ToComplexDouble(-3096576,8798208);

  
  



  	/* create dynamic 1D arrays for colors ( shades of gray ) */
  	data = malloc (iSize * sizeof (unsigned char));

	edge = malloc (iSize * sizeof (unsigned char));
  	if (data == NULL || edge == NULL)
    		{
      			fprintf (stderr, " Could not allocate memory");
      			return 1;
    		}





 


  fprintf (stderr, " end of setup \n");

  return 0;

}				// ;;;;;;;;;;;;;;;;;;;;;;;;; end of the setup ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;




int
end ()
{


  fprintf (stderr, " allways free memory (deallocate )  to avoid memory leaks \n");	// https://en.wikipedia.org/wiki/C_dynamic_memory_allocation
  free (data);
  free(edge);


  PrintProgramInfo ();
  PrintCInfo ();
  return 0;

}

// ********************************************************************************************************************
/* -----------------------------------------  main   -------------------------------------------------------------*/
// ********************************************************************************************************************

int
main ()
{
  	setup ();


  	DrawFatouImage (data, IterMax);	// first find Fatou
  	SaveArray2PGMFile (data, iWidth, IterMax, 0, "Fatou, name = iWidth_IterMax_n");
  
  	ComputeBoundaries(data,edge);
  	SaveArray2PGMFile (edge, iWidth, IterMax, 1, "Boundaries of Fatou; name = iWidth_IterMax_n"); 
  
  	CopyBoundaries(edge,data);
  	SaveArray2PGMFile (data, iWidth, IterMax, 2, "Fatou with boundaries; name = iWidth_IterMax_n"); 
  
  	//MarkAttractors(data);
  	MarkTraps(data);
  	SaveArray2PGMFile (data, iWidth, IterMax, 4, "Fatou with boundaries and traps; name = iWidth_IterMax_n"); 

  end ();

  return 0;
}

text output[edit]

export  OMP_DISPLAY_ENV="TRUE"	

OPENMP DISPLAY ENVIRONMENT BEGIN
  _OPENMP = '201511'
  OMP_DYNAMIC = 'FALSE'
  OMP_NESTED = 'FALSE'
  OMP_NUM_THREADS = '8'
  OMP_SCHEDULE = 'DYNAMIC'
  OMP_PROC_BIND = 'FALSE'
  OMP_PLACES = ''
  OMP_STACKSIZE = '0'
  OMP_WAIT_POLICY = 'PASSIVE'
  OMP_THREAD_LIMIT = '4294967295'
  OMP_MAX_ACTIVE_LEVELS = '2147483647'
  OMP_CANCELLATION = 'FALSE'
  OMP_DEFAULT_DEVICE = '0'
  OMP_MAX_TASK_PRIORITY = '0'
  OMP_DISPLAY_AFFINITY = 'FALSE'
  OMP_AFFINITY_FORMAT = 'level %L thread %i affinity %A'
OPENMP DISPLAY ENVIRONMENT END


compute Fatou image 
File 10000_100000_0.pgm saved . Comment = f(z)=z^6+A*z+c A=(-33725751,810162*i)*2^-25 c=(-3096576+8798208*i)*2^-25  Fatou, name = iWidth_IterMax_n 
File 10000_100000_1.pgm saved . Comment = f(z)=z^6+A*z+c A=(-33725751,810162*i)*2^-25 c=(-3096576+8798208*i)*2^-25  Boundaries of Fatou; name = iWidth_IterMax_n 
File 10000_100000_2.pgm saved . Comment = f(z)=z^6+A*z+c A=(-33725751,810162*i)*2^-25 c=(-3096576+8798208*i)*2^-25  Fatou with boundaries; name = iWidth_IterMax_n 
File 10000_100000_4.pgm saved . Comment = f(z)=z^6+A*z+c A=(-33725751,810162*i)*2^-25 c=(-3096576+8798208*i)*2^-25  Fatou with boundaries and traps; name = iWidth_IterMax_n 
Numerical approximation of Julia set for f(z)=z^6+A*z+c A=(-33725751,810162*i)*2^-25 c=(-3096576+8798208*i)*2^-25  
parameter A = ( -1.0051057040691376 ; 0.0241447091102600 ) 
parameter c = ( -0.0922851562500000 ; 0.2622070312500000 ) 
Image Width = 2.400000 in world coordinate
PixelWidth = 0.0002400240024002 
AR = 0.0240024002400240 = 100.000000 *PixelWidth
pixel counters
uUnknown = 0
uExterior = 62464867
uInterior = 30006950
Sum of pixels  = 92471817
all pixels of the array = iSize = 100000000
Maximal number of iterations = iterMax = 100000 
ratio of image  = 1.000000 ; it should be 1.000 ...
gcc version: 9.3.0
__STDC__ = 1
__STDC_VERSION__ = 201710
c dialect = C18

references[edit]

  1. fractalforums.org : julia-sets-true-shape-and-escape-time

File history

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

Date/TimeThumbnailDimensionsUserComment
current11:25, 14 August 2020Thumbnail for version as of 11:25, 14 August 20202,000 × 2,000 (637 KB)Soul windsurfer (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

Metadata