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$.

Map of zero lines of function

  • $\begingroup$ Can't you use Newton's method using a vector and the Jacobian? $\endgroup$ Aug 21 '19 at 18:16
  • $\begingroup$ Isn't this equivalent to find contours for a 2D function? $\endgroup$
    – nicoguaro
    Aug 21 '19 at 22:40
  • 1
    $\begingroup$ You might be interested in chebfun's 2D root finding capability. $\endgroup$
    – 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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.