Image:Tricorn.png
From Wikipedia, the free encyclopedia
Size of this preview: 600 × 600 pixels
Full resolution (1,024 × 1,024 pixels, file size: 43 KB, MIME type: image/png)
[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
|
File history
Click on a date/time to view the file as it appeared at that time.
| Date/Time | Dimensions | User | Comment | |
|---|---|---|---|---|
| current | 18:31, 22 January 2008 | 1,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 2007 | 4,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 2007 | 8,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) |
- Search for duplicate files
- Edit this file using an external application
See the setup instructions for more information.
File links
The following pages on the English Wikipedia link to this file (pages on other projects are not listed):

