Image:Amoeba2.png

From Wikipedia, the free encyclopedia

Wikimedia Commons logo This is a file from the Wikimedia Commons. The description on its description page there is shown below.
Commons is a freely licensed media file repository. You can help.

Contents

[edit] Summary

Made by myself with C++ and matlab.

[edit] Licensing

Public domain I, the copyright holder of this work, hereby release it into the public domain. This applies worldwide.

In case this is not legally possible:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.


Afrikaans | Alemannisch | Aragonés | العربية | Asturianu | Български | Català | Česky | Cymraeg | Dansk | Deutsch | Eʋegbe | Ελληνικά | English | Español | Esperanto | Euskara | Estremeñu | فارسی | Français | Galego | 한국어 | हिन्दी | Hrvatski | Ido | Bahasa Indonesia | Íslenska | Italiano | עברית | Kurdî / كوردی | Latina | Lietuvių | Latviešu | Magyar | Македонски | Bahasa Melayu | Nederlands | ‪Norsk (bokmål)‬ | ‪Norsk (nynorsk)‬ | 日本語 | Polski | Português | Ripoarisch | Română | Русский | Shqip | Slovenčina | Slovenščina | Српски / Srpski | Svenska | ไทย | Tagalog | Türkçe | Українська | Tiếng Việt | Walon | ‪中文(简体)‬ | ‪中文(繁體)‬ | zh-yue-hant | +/-

[edit] C++ code


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

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

  complex<double> z2, root, z11, z12;
  double A=-5, B=5, x, y, h, a1, a2, b;
  double R, pi, r, theta0, theta;
  int N=1000, i, j;

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

  ofstream mfile ("data.txt");

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

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

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

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

      mfile << a1  << ' ' << b << endl;
      mfile << a2  << ' ' << b << endl;
    }
  }
  mfile.close();
}
double mylog (double x){

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

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

  return log (x);

}


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


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/TimeDimensionsUserComment
current04:22, 9 March 20071,504×1,446 (13 KB)Oleg Alexandrov
04:42, 28 February 20071,078×1,092 (28 KB)Oleg Alexandrov
04:17, 28 February 20071,078×1,081 (40 KB)Oleg Alexandrov (Made by myself with matlab. )
The following pages on the English Wikipedia link to this file (pages on other projects are not listed):