Crackpot Photographs Truman Again
![](http://photos1.blogger.com/blogger/6686/2189/400/julia4.jpg)
(The title of this post is a line from the emmy award winning futurama episode "Roswell that Ends Well," and it is the headline of a newspaper article that contains a photograph that a conspiracy nut took of president truman. The picture looks like a few lights in the sky, similar to some of the fake ufo pictures of the 20th century.)
ok, so as per the instructions from professor Taylor, I tried to get some renderings of the julia set. I used the formula f(z, c)=+-sqrt(z-c), which actually got a little complicated when i realized that i had to program some complex arithmatic and square roots also! Luckily, Wikipedia exists, and i was able to get a formula for taking the square root of a complex number. Here it is: http://en.wikipedia.org/wiki/Square_root#Square_roots_of_negative_and_complex_numbers
also, the magnitude of a complex number |x+iy| is simply sqrt(x^2 + y^2).
In this way, we get another complex number when the square root is taken. Actually, we get two of them, which is how the points are collected.
You start at a point (which i initially did as (0, 0) but that didnt go anywhere) and send it through this process until you have a million points (literally). Then we draw and it looks like the above picture.
The point that i started with for the title rendering was (1+0i) and the c was (1-1.5i).
The point that i started with for the first rendering below was 1+1i, and the c that i used was 0.2+2i.
![](http://photos1.blogger.com/blogger/6686/2189/400/julia1.jpg)
![](http://photos1.blogger.com/blogger/6686/2189/400/julia3.jpg)
The last rendering here was with c as 0+0i. I was under the impression that I should get a circle of sorts. I am not sure why it is this squiggly line instead.
![](http://photos1.blogger.com/blogger/6686/2189/400/julia2.jpg)
2 Comments:
It turns out that you didn't need Wikipedia anyhow, since the STL already implements a very good complex number class.
ok then. I should probably learn what does and does not exist in the standard library, so i dont reinvent the wheel in the future. Oh well. At least i learned something.
sigh... Thanks Luke.
Post a Comment
<< Home