File talk:Herman-ring-1.png
compiling with g++
[edit]I have slightly changed one line from :
const complex<double> rot=polar(1, 2*M_PI*t);//e^{2 \pi i t}
to :
const complex<double> rot=polar(1.0, 2.0*M_PI*t);//e^{2 \pi i t}
Compile with simple :
g++ h.cpp
and run
./a.out >h.pgm
It creates pgm file in program directory --Adam majewski (talk) 20:23, 8 July 2011 (UTC)
- When I use all warnings :
g++ -Wall t.cpp
it gives :
t.cpp:26: warning: ISO C++ forbids declaration of ‘main’ with no type
so I have added type to main function :
int main()
Now there are no warnings. --Adam majewski (talk) 13:28, 10 July 2011 (UTC)
Hi,
Thx for image and program. I try to run it.
I have saved the code as h.cpp and use : g++ -Wall -llibcomplex h.cpp
and get error : h.cpp:22: error: no matching function for call to ‘polar(int, double)’
How should I do it ?
Regards --Adam majewski 18:00, 8 июля 2011 (UTC)
- Hi, Adam. I'm not sure I understand the situation right. It seems that source code was changed, and originally there is another line 22, which does not contain the
polar
function, but uses simplyexp
instead. Your comment above on this page suggests that new line 22 is yours (if I get it right). My original code works for me with g++ (GCC) 4.3.2. (I compile it simply withg++ h.C
.) So you can just try my original code. Let me know, if it works for you, or gives any error messages. Thanks! Ilya Voyager (talk) 21:43, 8 July 2011 (UTC)- You are right, src code was changed ( it is anonymus edition, not my). Your code is compiling without problems. I've changed my comment above. Is it good now ? Thx. --Adam majewski (talk) 05:31, 9 July 2011 (UTC)
- OK, it's clear now. Your version with
polar(1.0, 2.0*M_PI*t)
also seem to compile fine, so I've merged it. Thanks! Ilya Voyager (talk) 06:49, 9 July 2011 (UTC)
- OK, it's clear now. Your version with
- You are right, src code was changed ( it is anonymus edition, not my). Your code is compiling without problems. I've changed my comment above. Is it good now ? Thx. --Adam majewski (talk) 05:31, 9 July 2011 (UTC)
Orientation
[edit]Hi. I have checked the orientation of the plane by adding one line :
if (x>0 && y>0) color=15-color; /* check the orientation of Z-plane by marking first quadrant of Cartesian plane */
before :
cout << color << " ";
It seems that image is upside down. I have changed the line :
y=ymin+k*deltay;
to :
y=ymax-k*deltay;
Now it seems to be OK ( marked quadrant is in right upper position) --Adam majewski (talk) 13:32, 10 July 2011 (UTC)
- Sounds plausible. Feel free to fix the source code and upload fixed version of the image, if you wish. Thanks! Ilya Voyager (talk) 00:18, 14 July 2011 (UTC)