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 and save it as PNG.

[edit] Licensing


I, the author of this work, hereby publish it under the following licenses:
GFDL

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.
Subject to disclaimers.

Some rights reserved
Creative Commons Attribution iconCreative Commons Share Alike icon
This file is licensed under the Creative Commons
Attribution ShareAlike license versions 2.5, 2.0, and 1.0.
You may select the license of your choice.

File history

Legend: (cur) = this is the current file, (del) = delete this old version, (rev) = revert to this old version.
Click on date to download the file or see the image uploaded on that date.

  • (del) (cur) 14:21, 9 February 2007 . . Army1987 (Talk | contribs) . . 4096×4096 (350,924 bytes) (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 )
  • (del) (rev) 11:45, 9 February 2007 . . Army1987 (Talk | contribs) . . 8192×8192 (1,403,818 bytes) (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):