function is an equation containing both x and y variable, and every solution
(for x and y) of this equation is a part of the graph.
For instance, the equation of a simple circle would be: x^2+y^2=1. All (x;y) points satisfying this equation are on the graph of this function, which is a circle centered at (0;0) and of radius one.
Putting the whole equation in the left part of the equation (at the left of the "=") makes a function f(x,y)=0.
You can very easily turn an explicit ( y=f(x) ) equation into implicit form: f(x)-y=0.
picFX lets you "enlight" the graph of any implicit equation. Look at the steps below:
1) First adapt
your equation so that it suits your project (remember that x goes from zero to
the width of the project, usually 255; y does the same)
Once you have your equation f(x,y)=0, we will work on the left expression and forget about the "=0".
2) Since f(x,y)
can be either negative or positive, raise it to square (unnecessary if you're
sure that it will never happen). You will then have f(x,y)^2.
[You can try rendering your function here. It is usually some chaothic stuff, but you will sometimes get some interesting results]
3) Now add a
constant [We'll name it k]. Depending how "steep" your function is
near its zeros, that constant may have to be quite big (upto one million
You will anyway have to change this constant once it is finished, so that the result suits your needs.
Now we are sure that the function is always equal to or bigger than this constant.
4) Let's do now the inverse of this function (It will be very small, except near the places where the original function is near zero, where it will get near 1/k).
5) To use the full [0-255] range, multiply by k*255
Ok. Now you know how to do it, you may either try it at once (If you can't wait ;-) or do what I suggest step by step.
Let's try a some conics for a start
1) A simple
equation would be:
Substracting one thousand makes:
2) Take care here: We know that x^2+y^2/4 is always positive. However now we substracted the squared radius (1000), it may go upto -1000, so we will have to raise to square:
You can try rendering it now. It will look completely random trash. However if you divide it by e.g. 100, you will see the implicit graph in black.
3) Since we do not know yet how many give to k, let's try e.g. ten:
4 and 5)
Render this and you will see that there are only some lonesome pixels. This means that we will have to make k quite bigger:
Now it is quite nicer.
"+" by a "-" [between the two squared x and y] makes an
Write it in the green field and let the red like before.
And if you try the opposite (y^2-x^2 instead of x^2-y^2), you will get the other one:
[I removed here the "/2" to have a more regular picture]
Second example, Descartes' folium:
1) The generic equation is: x3+y3-3axy=0, with a a real number bigger than zero.
As usual, to have our center at (128;128), we shall replace x by (x-128) and y by (y-128):
As it require some fine tuning, I give you directely my solution (-:
You can have fun putting different k values for each colour component:
Last example, Bernouilli's Lemniscate:
The generic equation is (x2+y2)2=a2(x2-y2)
Once adapted to our needs (I have set a=100 and k=1000000 and then divided the f(x,y) expression by 1000 to keep small enough numbers), this equation gets:
3.2: Implicit functions
3.3: Playing with hyperbolic tangents