File:Amoeba2.png

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(1,504 × 1,446 pixels, file size: 13 KB, MIME type: image/png)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description The amoeba of P(z, w)=3z2+5zw+w3+1
Date 28 February 2007 (original upload date)
Source Own work
Author Oleg Alexandrov
File:Amoeba2.svg is a vector version of this file. It should be used in place of this PNG file when not inferior.

File:Amoeba2.png → File:Amoeba2.svg

For more information, see Help:SVG.

In other languages
Alemannisch  Bahasa Indonesia  Bahasa Melayu  British English  català  čeština  dansk  Deutsch  eesti  English  español  Esperanto  euskara  français  Frysk  galego  hrvatski  Ido  italiano  lietuvių  magyar  Nederlands  norsk bokmål  norsk nynorsk  occitan  Plattdüütsch  polski  português  português do Brasil  română  Scots  sicilianu  slovenčina  slovenščina  suomi  svenska  Tiếng Việt  Türkçe  vèneto  Ελληνικά  беларуская (тарашкевіца)  български  македонски  нохчийн  русский  српски / srpski  татарча/tatarça  українська  ქართული  հայերեն  বাংলা  தமிழ்  മലയാളം  ไทย  한국어  日本語  简体中文  繁體中文  עברית  العربية  فارسی  +/−
New SVG image

Licensing[edit]

Public domain I, the copyright holder of this work, release this work into the public domain. This applies worldwide.
In some countries this may not be legally possible; if so:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.

C++ code[edit]

#include <iostream>
#include <fstream>
#include <cmath>
#include <complex>
using namespace std;

double small = 1e-14;
double mylog (double);
int main(){

  double A=-5, B=5;
  int N=1000;

  double h= (B-A)/(N-1);
  double theta0 = 2*M_PI/(N-1.0);

  ofstream mfile ("data.txt");

  for (int i=0 ; i < N ; i++){
    double r = exp(A+i*h);

    for (int j=0 ; j < N ; j++){
      double theta = j*theta0;

      complex<double> z2 = polar(r, theta);
      complex<double> root = sqrt(25.0*z2*z2-12.0*(z2*z2*z2+1.0));
      complex<double> z11 = (-5.0*z2+root)/6.0;
      complex<double> z12 = (-5.0*z2-root)/6.0;

      double a1 = mylog(abs(z11));
      double a2 = mylog(abs(z12));
      double b  = mylog(abs(z2));

      mfile << a1  << ' ' << b << endl;
      mfile << a2  << ' ' << b << endl;
    }
  }
  mfile.close();

  return 0;
}
double mylog (double x){

  if (x< 0){
    cerr << "Error in log, negative x!" << endl;
    exit(0);
  }

  if (x < small){
    return log (small);
  }

  return log (x);

}

Matlab code which reads the data output by the C++ code and graphs it[edit]

A=load('data.txt');

plot(A(:, 1), A(:, 2), '.');
axis equal; axis off;

axis([-4 6 -5 5])
saveas(gcf, 'amoeba2.eps', 'psc2');

File history

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

Date/TimeThumbnailDimensionsUserComment
current04:22, 9 March 2007Thumbnail for version as of 04:22, 9 March 20071,504 × 1,446 (13 KB)Oleg Alexandrov (talk | contribs)
04:42, 28 February 2007Thumbnail for version as of 04:42, 28 February 20071,078 × 1,092 (28 KB)Oleg Alexandrov (talk | contribs)
04:17, 28 February 2007Thumbnail for version as of 04:17, 28 February 20071,078 × 1,081 (40 KB)Oleg Alexandrov (talk | contribs)Made by myself with matlab.

The following page uses this file:

File usage on other wikis

The following other wikis use this file: