File:Parabolic Julia set from period 2 thru internal angle 1 over 2.png
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
![File:Parabolic Julia set from period 2 thru internal angle 1 over 2.png](https://upload.wikimedia.org/wikipedia/commons/thumb/1/19/Parabolic_Julia_set_from_period_2_thru_internal_angle_1_over_2.png/800px-Parabolic_Julia_set_from_period_2_thru_internal_angle_1_over_2.png?20121010185738)
Size of this preview: 800 × 400 pixels. Other resolutions: 320 × 160 pixels | 640 × 320 pixels | 1,024 × 512 pixels | 2,000 × 1,000 pixels.
Original file (2,000 × 1,000 pixels, file size: 16 KB, MIME type: image/png)
File information
Structured data
Captions
Captions
Add a one-line explanation of what this file represents
Contents
Summary
[edit]DescriptionParabolic Julia set from period 2 thru internal angle 1 over 2.png |
English: Dynamic plane for |
Date | |
Source | Own work |
Author | Adam majewski |
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following licenses:
![]() |
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
![w:en:Creative Commons](https://upload.wikimedia.org/wikipedia/commons/thumb/7/79/CC_some_rights_reserved.svg/90px-CC_some_rights_reserved.svg.png)
![attribution](https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Cc-by_new_white.svg/24px-Cc-by_new_white.svg.png)
![share alike](https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Cc-sa_white.svg/24px-Cc-sa_white.svg.png)
This file is licensed under the Creative Commons Attribution-Share Alike Attribution-Share Alike 4.0 International, 3.0 Unported, 2.5 Generic, 2.0 Generic and 1.0 Generic 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.
You may select the license of your choice.
Compare with
[edit]-
with zero algorithm and parabolic checkerboard
C src code
[edit]/*
c console program
-----------------------------------------
1.ppm file code is based on the code of Claudio Rocchini
http://en.wikipedia.org/wiki/Image:Color_complex_plot.jpg
create 8 bit color graphic file , portable graymap file = PGM
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
---------------------------
2. first it creates data array which is used to store 1 byte color values of pixels,
fills tha array with data and after that writes the data (array) to binary pgm file in one step.
It alows free ( non sequential) acces to "pixels"
-------------------------------------------
Adam Majewski fraktal.republika.pl
Sobel filter
Gh = sum of six values ( 3 values of matrix are equal to 0 ). Each value is = pixel_color * filter_coefficients
gcc e.c -lm -Wall -march=native -fopenmp
time ./a.out
----------------------------------
File ar0.000600000.pgm saved. real 5m30.416s witout OpenMP
File oar0.000600000.pgm saved. real 3m10.286s with OpenMP
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <complex.h>
#include <string.h>
#include <omp.h> // OpenMP; needs also -fopenmp
/* iXmax/iYmax = */
int iXmax = 2000; /* height of image in pixels */
int iYmax = 1000;
/* fc(z) = z*z + c */
int denominator =2; /* denominator of internal angle */
int period = 4; // period of child component , not parent
double AR; // PixelWidth /* radius of circle around attractor ZA = target set for attracting points , for parabolic it is a circle with parabolic point on it */
double AR2; // (AR*AR)
//#define alfa (1-sqrt(1-4*Cx))/2 /* attracting or parabolic fixed point z = alfa */
//#define beta (1+sqrt(1-4*Cx))/2 /* repelling or parabolic fixed point z = beta */
/* escape time to infinity */
int GiveExtLastIteration(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;
}
/* find attractor ZA using forward iteration of critical point Z = 0 */
/* if period is >1 gives one point from attracting cycle */
double complex GiveAttractor(double complex C , double ER2, int _IterationMax)
{
int Iteration;
double Cx,Cy; /* C = Cx+Cy*I */
double Zx, Zy; /* z = zx+zy*i */
double Zx2, Zy2; /* Zx2=Zx*Zx; Zy2=Zy*Zy */
Cx = creal(C);
Cy = cimag(C);
/* -- find attractor ZA using forward iteration of critical point Z = 0 */
Zx=0.0;
Zy=0.0;
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;
};
return Zx+Zy*I;
}
/* attracting time to finite attractor ZA */
int GiveIntLastIteration(double _Zx0, double _Zy0,double C_x, double C_y, int iMax, double _AR2, double _ZAx, double _ZAy )
{
int i;
double Zx, Zy; /* z = zx+zy*i */
double Zx2, Zy2; /* Zx2=Zx*Zx; Zy2=Zy*Zy */
double d, dX, dY; /* distance from z to Alpha */
Zx=_Zx0; /* initial value of orbit */
Zy=_Zy0;
Zx2=Zx*Zx;
Zy2=Zy*Zy;
dX=Zx-_ZAx;
dY=Zy-_ZAy;
d=dX*dX+dY*dY;
for (i=0;i<iMax && (d>_AR2);i++)
{
Zy=2*Zx*Zy + C_y;
Zx=Zx2-Zy2 +C_x;
Zx2=Zx*Zx;
Zy2=Zy*Zy;
dX=Zx-_ZAx;
dY=Zy-_ZAy;
d=dX*dX+dY*dY;
};
return i;
}
// gives c in hyperbolic component of Mandelbrot set
// #include <complex.h>
// turn is an internal angle in turns
// 0.0 <= radius <=1.0
double complex GiveC(int period, double radius, double turn)
{
double Cx, Cy; /* C = Cx + Cy*i */
double a = turn*(2*M_PI); // angle, from turns to radians
switch( period )
{
case 1 : Cx = radius*(0.5*cos(a) - 0.25*cos(2*a));
Cy = radius*(0.5*sin(a) - 0.25*sin(2*a));
break;
case 2 : Cx = radius*0.25*cos(a) - 1;
Cy = radius*0.25*sin(a) ;
break;
default : Cx=0; Cy=0; //
break;
}
return Cx+Cy*I;
}
/* gives position of point (iX,iY) in 1D array ; uses also global variables */
unsigned int f(unsigned int _iX, unsigned int _iY)
{return (_iX + (iYmax-_iY-1)*iXmax );}
/* --------------------------------------------------------------------------------------------------------- */
int main(){
unsigned int iX,iY, /* indices of 2D virtual array (image) = integer coordinate */
i, /* index of 1D array */
iLength = iXmax*iYmax;/* length of array in bytes = number of bytes = number of pixels of image * number of bytes of color */
/* world ( double) coordinate = parameter plane*/
const double ZxMin=-1.8;
const double ZxMax=1.8;
const double ZyMin=-0.9;
const double ZyMax=0.9;
double PixelWidth=(ZxMax-ZxMin)/iXmax;
double PixelHeight=(ZyMax-ZyMin)/iYmax;
/* */
double Zx, Zy; /* Z=Zx+Zy*i */
double complex ZA; /* atractor ZA = ZAx + ZAy*i */
double complex C; /* atractor C = Cx + Cy*i */
/* */
const double EscapeRadius=2.0; /* radius of circle around origin; its complement is a target set for escaping points */
double ER2=EscapeRadius*EscapeRadius;
const int IterationMax=60,
IterationMaxBig= 100000001;
int eLastIteration, iLastIteration;
/* sobel filter */
unsigned char G, Gh, Gv;
/* color */
unsigned char color[]={255,230,200,180,150}; /* shades of gray used in image */
const unsigned int MaxColorComponentValue=255; /* color component is coded from 0 to 255 ; it is 8 bit color file */
/* dynamic 1D arrays for colors ( shades of gray ) */
unsigned char *data, *edge;
data = malloc( iLength * sizeof(unsigned char) );
edge = malloc( iLength * sizeof(unsigned char) );
if (data == NULL || edge==NULL)
{
fprintf(stderr," Could not allocate memory. End of the program. ");
getchar();
return 1;
}
else printf(" memory is OK\n");
//period, radius, turn)
C = GiveC(2, 1.0, 1.0/2.0);
printf(" Cx = %f \n", creal(C));
printf(" Cy = %f \n", cimag(C));
ZA = GiveAttractor( C, ER2, IterationMaxBig); /* find attractor ZA using forward iteration of critical point Z = 0 */
printf(" ZAx = %f \n", creal(ZA));
printf(" ZAy = %f \n", cimag(ZA));
AR = PixelWidth/3.0;
AR2=AR*AR;
printf(" fill the data array \n");
#pragma omp parallel for schedule(dynamic) private(i,iX,iY,Zy, Zx, eLastIteration,iLastIteration) shared(iYmax,iXmax, ER2)
for(iY=0;iY<iYmax;++iY){
Zy=ZyMin + iY*PixelHeight; /* */
if (fabs(Zy)<PixelHeight/2) Zy=0.0; /* */
printf(" row %u from %u \n",iY, iYmax);
for(iX=0;iX<iXmax;++iX){
Zx=ZxMin + iX*PixelWidth;
eLastIteration = GiveExtLastIteration(Zx, Zy, creal(C), cimag(C), IterationMax, ER2 );
i= f(iX,iY); /* compute index of 1D array from indices of 2D array */
if ( IterationMax != eLastIteration )
{data[i]=245;} /* exterior */
else /* interior */
{ iLastIteration = GiveIntLastIteration(Zx, Zy, creal(C), cimag(C), IterationMaxBig, AR2, creal(ZA), cimag(ZA));
data[i]=color[iLastIteration % period];} /* level sets of attraction time */
/* if (Zx>0 && Zy>0) data[i]=255-data[i]; check the orientation of Z-plane by marking first quadrant */
}
}
printf(" find boundaries in data array using Sobel filter\n");
#pragma omp parallel for schedule(dynamic) private(i,iX,iY,Gv,Gh,G) shared(iYmax,iXmax, ER2)
for(iY=1;iY<iYmax-1;++iY){
for(iX=1;iX<iXmax-1;++iX){
Gv= data[f(iX-1,iY+1)] + 2*data[f(iX,iY+1)] + data[f(iX-1,iY+1)] - data[f(iX-1,iY-1)] - 2*data[f(iX-1,iY)] - data[f(iX+1,iY-1)];
Gh= data[f(iX+1,iY+1)] + 2*data[f(iX+1,iY)] + data[f(iX-1,iY-1)] - data[f(iX+1,iY-1)] - 2*data[f(iX-1,iY)] - data[f(iX-1,iY-1)];
G = sqrt(Gh*Gh + Gv*Gv);
i= f(iX,iY); /* compute index of 1D array from indices of 2D array */
if (G==0) {edge[i]=255;} /* background */
else {edge[i]=0;} /* boundary */
}
}
// printf(" copy boundaries from edge to data array \n");
// for(iY=1;iY<iYmax-1;++iY){
// for(iX=1;iX<iXmax-1;++iX)
// {i= f(iX,iY); /* compute index of 1D array from indices of 2D array */
// if (edge[i]==0) data[i]=0;}}
/* ---------- file -------------------------------------*/
printf(" save data array to the file \n");
FILE * fp;
char name [10]; /* name of file */
i = sprintf(name,"oar%2.9f",AR); /* result (is saved in i) but is not used */
char *filename =strcat(name,".pgm");
char *comment="# C=0.2";/* comment should start with # */
/* save image 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\n %u\n %u\n",comment,iXmax,iYmax,MaxColorComponentValue); /*write header to the file*/
fwrite(edge,iLength,1,fp); /*write image data bytes to the file in one step */
printf("File %s saved. \n", filename);
fclose(fp);
/* --------------free memory ---------------------*/
free(data);
free(edge);
return 0;
}
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 18:57, 10 October 2012 | ![]() | 2,000 × 1,000 (16 KB) | Soul windsurfer (talk | contribs) | {{Information |Description ={{en|1=Parabolic Julia set from period 2 tru internal angle 1 over 2}} |Source ={{own}} |Author =Adam majewski |Date =2012-10-10 |Permission = |other_versions = }} |
You cannot overwrite this file.
File usage on Commons
The following 2 pages use this file:
File usage on other wikis
The following other wikis use this file:
- Usage on en.wikibooks.org
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
PNG file comment |
|
---|