I want to know is there any fast way to draw a graph of a "non-function" curve. For example
x^2+3x = y^3-4y+1
I know for normal function, like y=x^2, we can iterate x and calculate y, then draw the points. But for non-function curve, it will take a lot of times to iterate x, then solve function of y (using Newton method or alike). So please suggest me the correct way to draw them.
Thanks & Regards.
I am afraid there is no "generic" way except for the method you describe yourself: iterate over one variable and solve for the other.
Note that you have to be careful to find all solutions, not just a solution. This is a major stumbling block in creating a working general algorithm.
Another stumbling block is the singularity points: when f'(x)=0
, you will want to solve for y
and, vice versa, when g'(y)=0
, you will want to solve for x
. What if both are 0 at the same time? You will need to do some paper-and-pencil analysis.
There are some problem-specific simplifications though.
In your specific case the equation for x
is quadratic, so a well known simple closed formula exists. This means that iterating over y
and solving for x
is easier. (The equation for y
is cubic, so a less well known and much more complicated formula exist too).
Another way is to find a parametric representation of your curve (e.g., x^2+y^2=1
is equivalent to x=cos(t); y=sin(t); 0<=t<2*pi
).