# Finding curves where function goes to zero in two dimensions

Suppose $$f(x,y)$$ is a complex function of two real arguments with roots* that are not discrete points but lie in curves. (Is there are term for this characteristic?) An example is shown below: the black curves show all the points in the $$(x, y)$$ plane where $$f(x, y) = 0$$. What is the best way to find these curves numerically, within a rectangular region?

The obvious solution is to consider 1-D slices along the $$x$$- or $$y$$-axis, and use standard 1-D root-finding algorithms to find the discrete roots along these slices. These points can then be joined up appropriately to form the curves. However I wonder if there is a more efficient strategy, taking into account 2-D information.

Answers can assume some of the properties shown in the example plot. The curves do not terminate within the rectangular region, they do not intersect, and they always have a negative gradient.

*Definition of root: a point $$(x_r, y_r)$$ such that $$f(x_r, y_r) = 0$$. • Can't you use Newton's method using a vector and the Jacobian? Aug 21 '19 at 18:16
• Isn't this equivalent to find contours for a 2D function? Aug 21 '19 at 22:40
• You might be interested in chebfun's 2D root finding capability.
– Bort
Aug 22 '19 at 9:31

This is a technique called continuation. It typically works by using Newton's method to find one root, then you take steps along the root curve by picking a nearby point as the initial guess for the next Newton step. This is usually done to solve problems of the form $$F_\lambda(x_ \lambda)=0$$ where $$\lambda$$ is some parameter, but your problem can be recast into this form.
If done correctly, this should get what you need provided that 2 root curves don't intersect each other and the root curves don't suddenly stop. An easy method to code yourself provided you have a good Newton solver is pseudo-arclength continuation that essentially tries to progress along the root curve via an estimation of the arclength along the curve, and enforces this condition by adding an extra equation to the Newton problem. In this formulation, the derivatives can be approximated by a forward difference and the "forward" values of $$u$$ and $$\lambda$$ are the unknowns for the new system.