I'm trying to develop a level surface visualizer using this method (don't know if this is the standard method or if there's something better):
-
1. Take any function
f(x,y,z)=k
(where k is constant), and bounds for x, y, and z. Also take in two grid parameters stepX and stepZ.
-
2. to reduce to a level curve problem, iterate from zMin to zMax with stepZ intervals. So
f(x,y,z)=k => f(x,y,fixedZ)=k
-
3. Do the same procedure with stepX, reducing the problem to
f(fixedX, y, fixedZ)=k
-
4. Solve
f(fixedX, y, fixedZ) - k = 0
for all values of y which will satisfy that equation (using some kind of a root finding algorithm).
-
5. For all points generated, plot those as a level curve (the inner loop generates level curves at a given z, then for different z values there are just stacks of level curves)
-
6 (optional). Generate a mesh from these level curves/points which belong to the level set.
The problem I'm running into is with step 4. I have no way of knowing before-hand how many possible values of y will satisfy that equation (more specifically, how many unique and real values of y).
Also, I'm trying to keep the program as general as possible so I'm trying to not limit the original function f(x,y,z)=k
to any constraints such as smoothness or polynomial other than k must be constant as required for a level surface.
Is there an algorithm (without using a CAS/symbolic solving) which can identify the root(s) of a function even if it has multiple roots? I know that bisection methods have a hard time with this because of the possibility of no sign changes over the region, but how does the secant/newtons method fare? What set of functions can the secant/newtons method be used on, and can it detect and find all unique real roots within two given bounds? Or is there a better method for generating/visualizing level surfaces?