This program allows you to graph functions that have both a complex number input and output. (link at the bottom).
How It works
The input is on a regular 2d plane, where the vertical axis is the imaginary part of the input and the horizontal axis the real part, so the input 1+2i would be here:
Each input point is colored to represent the output. The hue of the color is determined by the angle of the complex output (in radians) on a scale like this:
For example, the point 1+1i would be colored orange, since it has an angle of :
The the magnitude of the output is colored, where the smaller the value, the darker it is, and the larger it is the lighter it is.
This actually produces some really beautiful results. For example, here is a graph of , where z is the complex number used as input:
You can see the zero on the left, where the outputs become very small, and the pole on the right, where they spike towards infinity.
or this :
You can also graph Binet's Formula, which gives the Fibonacci numbers (discussed here), which produces these repeating spikes:
All of these were drawn at full resolution, which takes around 30 seconds to draw. At a lower resolution, you get almost *real time* results, with about 3 seconds a frame. You can pan by clicking and dragging, and zoom by scrolling or using +/-, and there is an auto-updating axis and an output tooltip:
Check it out here, and see what cool functions you can find. Press o to hide and show the overlay, r to reset the program, and h to render render a high quality version.
Look inside and see! ;) (The link is at the bottom of my first post, if you missed it).
(It uses the bignums library for the complex numbers, then just runs the function for each block on the screen and colors it accordingly.)
I assume you mean how it decides what color each point should be. It does that by finding the angle of the complex number using , which gives the angle in radians, which are just another way to represent angles. Then it just uses that in the block.
There are tons of comments in the project that (I think) do a pretty good job of explaining what's going on.
("Brightness" is from the unpleasant HSV color space; lightness, from the better HSL space, ranges from 0 for black through 50 for full intensity color to 100 for white. So you can just stick the complex magnitude right into the block.)
The problem with using any of the library blocks is this:
Built in = 6 ms
Library = 2013 ms
So they are much to slow to use per-pixel, like they are in my project.
Well, yes, and also, the code is long and complicated. Honestly, I didn't think at all about efficiency as I was writing it, in accord with the principle that it's easier to speed up correct code than to debug fast code.
That's 20 IF blocks in addition to the actual work of setting the lightness. I'll have to invent a better way of dispatching on the dimension you're setting.
The alternative, of course, would be to have separate blocks for each possibility: SET PEN LIGHTNESS TO..., SET PEN BLUE TO..., and so on. And some of those blocks are in the library as helpers, but the design goal was not to intimidate users with a zillion different blocks. As it is, there are nine blocks for users in the library.
to replace most of the IF blocks. But we have an upload coming, so I'm not going to start mucking with the library until it's clear that it works for people at all.