File:Cpmj.png
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Size of this preview: 600 × 600 pixels. Other resolutions: 240 × 240 pixels | 480 × 480 pixels | 1,000 × 1,000 pixels.
Original file (1,000 × 1,000 pixels, file size: 44 KB, MIME type: image/png)
File information
Structured data
Captions
Summary
[edit]DescriptionCpmj.png |
English: Potential of filled-in Julia set
Polski: Potencjał zbioru Julia |
Date | |
Source | Own work |
Author | Adam majewski |
Long description
[edit]Method of drawing :
- escape time (function GiveLastIteration)
- potential (function jlogphi)
Code is formatted with Emacs
Compare with
[edit]-
Fat rabbit , components, C=-0.12565651+0.65720*i
-
c=-0,123+0.745i
-
c=-0.12256116687665 +0.74486176661974*i; (center of period 3 component) and external rays
-
C=-0.12256 +0.74486*i; eLCM/J
-
c=-0.11+0.65569999*i ; Twisted rabbit, MIIM
-
c=-0.11+0.65569999*i; mIIM/J
-
c = −0,123 + 0.745i; Quaternion julia set. The "Douady Rabbit" julia set is visible in the cross section
-
Douady rabbit in an exponential family
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following licenses:
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.
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 |
You may select the license of your choice.
C src code
[edit]See also:
/*
c console program
Adam Majewski
fraktal.republika.pl
1. draws for Fc(z)=z*z +c
-------------------------------
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 8 bit color ( gray scale ) graphic file , portable pixmap file = PGM (P5)
see http://en.wikipedia.org/wiki/Portable_pixmap
to see the file use external application ( graphic viewer)
---------------------------------
http://fraktal.republika.pl/cpp_argphi.html
*/
#include <stdio.h>
// this function is based on cpp function
// in the file mandelXXsrc.zip .
// from program mandel by Wolf Jung
// http://www.mndynamics.com/indexp.html
int GiveLastIteration(double Zx, double Zy,double Cx ,double Cy , int iter_max, double bailout2)
{
// z= x+ y*i
long double x ,y ;
//
long double u, v;
int iter; // iteration
iter=0;//there was no iteration
y =Zy;
x =Zx;
u = x*x ;
v = y*y;
if ( u + v > bailout2 ) return iter; // point is in target set =no need to iterate
//
do
{
// Fc(z)= z*z +c
y = 2 * x * y + Cy;
x = u - v + Cx;
u = x*x;
v = y*y;
iter+=1;
}
while (( u + v <= bailout2 ) && iter<iter_max) ;
return iter;
}
/* this function is based on function by W Jung */
double jlogphi(double zx0, double zy0, double cx, double cy)
{
int j;
double
zx=zx0,
zy=zy0,
s = 0.5,
zx2=zx*zx,
zy2=zy*zy,
t;
//
for (j = 1; j < 400; j++)
{ s *= 0.5;
zy = 2 * zx * zy + cy;
zx = zx2 - zy2 + cx;
zx2 = zx*zx;
zy2 = zy*zy;
t = fabs(zx2 + zy2); // abs(z)
if ( t > 1e24) break;
}
return s*log2(t); // log(zn)* 2^(-n)
}//jlogphi
int main()
{
const double Cx=-0.12,Cy=0.665;
/* screen ( integer) coordinate */
int iX,iY;
const int iXmax = 1000, iXmin=0;
const int iYmax = 1000, iYmin=0;
int iWidth=iXmax-iXmin+1,
iHeight=iYmax-iYmin+1,
/* number of bytes = number of pixels of image * number of bytes of color */
iLength=iWidth*iHeight*1,/* 1 bytes of color */
index; /* of array */
/* world ( double) coordinate = parameter plane*/
const double length=2.0;
const double ZxMin=-length;
const double ZxMax=length;
const double ZyMin=-length;
const double ZyMax=length;
/* */
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 8 bit color RGB file */
const int MaxColorComponentValue=255;
FILE * fp;
char *filename="p__10.pgm";
char *comment="# Cx=-0.12, Cy=0.665; EscapeRadius=3 IterationMax=4000;";/* comment should start with # */
/* Z=Zx+Zy*i ; Z0 = 0 */
double Zx, Zy;
double Zx2, Zy2; /* Zx2=Zx*Zx; Zy2=Zy*Zy */
/* */
double potential,temp;
int Level, PreviousLevel;
int LastIteration;
const int IterationMax=4000;
/* bail-out value , radius of circle ; */
const double EscapeRadius=3;
double ER2=EscapeRadius*EscapeRadius;
/* dynamic 1D array for 8-bit color values */
unsigned char *array;
unsigned char color;
/*-------------------------------------------------------------------*/
array = malloc( iLength * sizeof(unsigned char) );
if (array == NULL)
{
fprintf(stderr,"Could not allocate memory");
getchar();
return 1;
}
else
{ fprintf(stderr,"I'm working. Please wait (:-))\n ");
/* fill the data array with white points */
for(index=0;index<iLength-1;++index) array[index]=255;
}
/* ---------------------------------------------------------------*/
for(iY=0;iY<iYmax;iY++)
{
for(iX=0;iX<iXmax;iX++)
{ /* compute Zx and Zy for each point */
Zy=ZyMin + iY*PixelHeight;
if (fabs(Zy)< PixelHeight/2) Zy=0.0; /* */
Zx=ZxMin + iX*PixelWidth;
//
LastIteration=GiveLastIteration(Zx, Zy, Cx , Cy , IterationMax, ER2);
if (LastIteration!=IterationMax)
/* */
{ potential=jlogphi(Zx, Zy,Cx,Cy);// GivePotential(Zx, Zy,Cx,Cy,ER2,IterationMax );
// printf(" potential= %f\n",potential);
temp=255*potential;
if (temp>255)
color=255;
else color= temp;
array[((iYmax-iY-1)*iXmax+iX)]= color ;
}
}
}
/* write the whole data array to ppm file in one step */
/*create new file,give it a name and open it in binary mode */
fp= fopen(filename,"wb"); /* b - binary mode */
if (fp == NULL){ fprintf(stderr,"file error"); }
else
{
/*write ASCII header to the file*/
fprintf(fp,"P5\n %s\n %d\n %d\n %d\n",comment,iXmax,iYmax,MaxColorComponentValue);
/*write image data bytes to the file*/
fwrite(array,iLength ,1,fp);
fclose(fp);
fprintf(stderr,"OK : file "); fprintf(stderr,filename); fprintf(stderr," saved.\nDone !!!");
getchar();
}
free(array);
getchar();
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 | 17:54, 3 August 2023 | 1,000 × 1,000 (44 KB) | Obscure2020 (talk | contribs) | Optimized with OxiPNG and ZopfliPNG. | |
15:46, 24 October 2009 | 1,000 × 1,000 (70 KB) | Soul windsurfer (talk | contribs) | {{Information |Description={{en|1=Potential of filled-in Julia set }} {{pl|1=Potencjał zbioru Julia}} |Source={{own}} |Author=Adam majewski |Date=24.10.2009 |Permission= |other_versions= }} |
You cannot overwrite this file.
File usage on Commons
The following 6 pages use this file:
File usage on other wikis
The following other wikis use this file:
- Usage on ar.wikipedia.org
- Usage on en.wikibooks.org