File:Amoeba2.png

From testwiki
Jump to navigation Jump to search
Original file (1,504 × 1,446 pixels, file size: 13 KB, MIME type: image/png)

This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

Summary

Description
English: The amoeba of
Date
Source Own work
Author Oleg Alexandrov
Other versions
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  العربية  беларуская (тарашкевіца)  български  বাংলা  català  нохчийн  čeština  dansk  Deutsch  Ελληνικά  English  British English  Esperanto  español  eesti  euskara  فارسی  suomi  français  Frysk  galego  Alemannisch  עברית  हिन्दी  hrvatski  magyar  հայերեն  Bahasa Indonesia  Ido  italiano  日本語  ქართული  한국어  lietuvių  македонски  മലയാളം  Bahasa Melayu  မြန်မာဘာသာ  norsk bokmål  Plattdüütsch  Nederlands  norsk nynorsk  norsk  occitan  polski  prūsiskan  português  português do Brasil  română  русский  sicilianu  Scots  slovenčina  slovenščina  српски / srpski  svenska  தமிழ்  ไทย  Türkçe  татарча / tatarça  українська  vèneto  Tiếng Việt  中文  中文(中国大陆)  中文(简体)  中文(繁體)  中文(马来西亚)  中文(新加坡)  中文(臺灣)  +/−
New SVG image

Licensing

Public domain This work has been released into the public domain by its author, Oleg Alexandrov. This applies worldwide.
In some countries this may not be legally possible; if so:
Oleg Alexandrov grants anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.

Source code

The logo of C++ – general-purpose programming language
The logo of C++ – general-purpose programming language
This media was created with C++ (general-purpose programming language)
Here is a listing of the source used to create this file.

Deutsch  English  +/−

#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

A=load('data.txt');

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

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

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

28 February 2007

image/png

a3c5be123725d2e6dfb29eba46ec56cf5d615037

13,103 byte

1,446 pixel

1,504 pixel

File history

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

Date/TimeThumbnailDimensionsUserComment
current05:22, 9 March 2007Thumbnail for version as of 05:22, 9 March 20071,504 × 1,446 (13 KB)wikimediacommons>Oleg Alexandrov

There are no pages that use this file.