Image:Tricorn.png

From Wikipedia, the free encyclopedia

[edit] Summary

The tricorn (a fractal similar to the Mandelbrot set), plotted in the area [−2, 2) × [−2, 2). The value of each pixel equals 255 minus the number of iterations needed before the absolute value of z becomes larger than 2, calculated at the upper left corner of the pixel.

The following C code was used to create a negative PGM image:

#include <stdio.h>
#include <limits.h>
main() {
unsigned int resx = 4096, resy = 4096;  //Resolution;
unsigned char i = 0;                    //Iteration counter;
float xmin = -2, xmax = +2;             //Borders of the area
float ymin = -2, ymax = +2;             //to be plotted;
unsigned int xpix = 0, ypix = 0;        //Column and row counters;
float x, y;                             //Coordinates;
long double Rez, Imz, Rez_new, Imz_new; //Real and imaginary parts.
FILE *f;

f = fopen("tricorn.pgm", "w");
fprintf(f, "P2\n%d %d\n%d\n", resx, resy, UCHAR_MAX); //Portable Greymap file header
for (ypix = 0; ypix < resy; ypix++) {
        for (xpix = 0; xpix < resx; xpix++) {
                x = xmin + xpix * (xmax - xmin)/resx;
                y = ymin + ypix * (ymax - ymin)/resy;
                Rez = x; Imz = y;
                for (i = 0; Rez*Rez + Imz*Imz <= 4; i++) { //z = conj(z^2) + c
                        Rez_new = Rez*Rez - Imz*Imz + x;       //(It'd be z = z^2 +c for Mandelbrot)
                        Imz_new = -2*Rez*Imz + y; //remove minus sign here to obtain the Mandelbrot set
                        Rez = Rez_new;
                        Imz = Imz_new;
                        if (i == UCHAR_MAX) break; }
                fprintf(f, "%d ", i); }
        fprintf(f, "\n"); }
}

Then I used the GIMP to invert colors, reduce to 25% and save it as PNG.

[edit] Licensing


I, the copyright holder of this work, hereby publish it under the following licenses:
You may select the license of your choice.

File history

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

Date/TimeDimensionsUserComment
current18:31, 22 January 20081,024×1,024 (43 KB)Army1987 (Talk | contribs) (Downsized version, as the former was too large for the thumbnail maker (> 12.5M pixels))
14:21, 9 February 20074,096×4,096 (343 KB)Army1987 (Talk | contribs) (The tricorn (a fractal similar to the Mandelbrot set), plotted in the area [−2, 2) × [−2, 2). The value of each pixel equals 255 minus the number of iterations needed before the absolute value of z becomes larger than 2, calculated at the upper left )
11:45, 9 February 20078,192×8,192 (1.34 MB)Army1987 (Talk | contribs) (The tricorn (a fractal similar to the Mandelbrot set), plotted in the area [−2, 2] × [−2, 2]. The value of each pixel equals 255 minus the number of iterations needed before the absolute value of ''z'' becomes larger than 2, calculated at the upper l)

The following pages on the English Wikipedia link to this file (pages on other projects are not listed):