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 $S$ which is detectable by a test function $\phi:\ensuremath{\mathbf{R}}^{n+1}\to\ensuremath{\mathbf{R}}$. Also assume we have found two consecutive points $x_i$ and $x_{i+1}$ on the curve

\begin{displaymath}
F(x)=0,\quad F: \ensuremath{\mathbf{R}}^{n+1}\to \ensuremath{\mathbf{R}}^n\ .
\end{displaymath} (23)

The singularity $S$ will then be detected if
\begin{displaymath}
\phi(x_i)\phi(x_{i+1}) < 0\ .
\end{displaymath} (24)

Having found two points $x_i$ and $x_{i+1}$ one may want to locate the point $x^*$ where $\phi(x)$ vanishes. A logical solution is to solve the following system

$\displaystyle F(x)$ $\textstyle =$ $\displaystyle 0$ (25)
$\displaystyle \phi(x)$ $\textstyle =$ $\displaystyle 0$ (26)

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