### Test functions

The idea to detect singularities is to define smooth scalar functions which have regular zeros at the singularity points. These functions are called test functions. Suppose we have a singularity which is detectable by a test function . Also assume we have found two consecutive points and on the curve

| (23)

The singularity will then be detected if

| (24)

Having found two points and one may want to locate the point where vanishes. A logical solution is to solve the following system

|  |  | (25)
|  |  | (26)

using Newton iterations starting at . However, to use this method, one should be able to compute the derivatives of with respect to , which is not always easy. To avoid this difficulty we implemented by default a one-dimensional secant method to locate along the curve. Notice that this involves Newton corrections at each intermediate point.