Fundamentals / Numerical mathematics / Nonlinear equations

Continuation and folds

Track a family of equilibria through parameter changes, identify the failure of ordinary parameter continuation at a fold and build a predictor–corrector step.

From first principles

Use the tangent of a solution curve to cross a fold

A parameter-dependent equation \(F(x,\lambda)=0\) defines a curve of equilibria when the gradient in \((x,\lambda)\) is nonzero. Differentiating along any smooth parametrization by \(s\) shows that its tangent \((\dot x,\dot\lambda)\) must be perpendicular to the gradient,

\[F_x\dot x+F_\lambda\dot\lambda=0,\]
\[\dot x^2+\dot\lambda^2=1 .\]

The second equation fixes the length in chosen, consistently scaled coordinates. Choose the sign to match the preceding direction and predict a new state \(z_p=z_0+h t_0\). The predictor generally misses the curved solution set. To correct it, solve the original equation together with a plane condition fixing its position along the tangent,

\[F(z)=0,\]
\[t_0^T(z-z_p)=0 .\]

Near a regular curve these two rows are independent. At a simple fold the parameter component of the tangent vanishes, so using \(\lambda\) alone to parameterize fails locally. The augmented system can remain nonsingular because the state component is still free to progress along the curve.

A sideways parabola shows equilibria u for a parameter lambda. Two branches merge at zero. Each of two positive parameter slices intersects the curve twice.Open full-size diagram
A turning point in the parameter is a regular point on the curve For F(u, λ) = u² − λ, solving for u at prescribed λ gives du/dλ = 1/(2u), which diverges at zero. Taking u as the curve coordinate gives the regular parametrisation (λ, u) = (u², u). This picture explains why an arclength constraint can carry a branch follower through the turn.

Derivation and applications

Predict the size and direction of a continuation correction

A tangent predictor from a known solution is first-order accurate along a smooth branch. Its leading transverse miss can be calculated before running a Newton corrector. Take a scalar equation \(F(z)=0\) for \(z=(x,\lambda)\) in consistently scaled coordinates. At the starting point \(z_0\) assume a nonzero gradient \(g\), a unit tangent \(t\) with \(g^Tt=0\), and sufficiently many bounded derivatives. Write \(H\) for its Hessian. Taylor expansion along the predictor \(z_p=z_0+ht\) yields

\[F(z_p)=\frac{h^2}{2}t^THt+O(h^3).\]

The usual corrector plane is perpendicular to \(t\). In two dimensions the permitted correction therefore lies along the initial unit normal \(n=g/\|g\|\). Try \(z=z_p+\delta n\). Since \(\delta=O(h^2)\), the derivative at the initial point gives the leading normal correction,

\[0=\tfrac12h^2t^THt+\delta\|g\|+O(h^3),\]
\[\delta=-\frac{h^2t^THt}{2\|g\|}+O(h^3).\]

Thus a local curvature estimate \(K=|t^THt|/\|g\|\) suggests a predictor length for a desired transverse error \(\varepsilon\),

\[\frac12Kh^2\lesssim\varepsilon,\qquad h\lesssim\sqrt{2\varepsilon/K}.\]

The absolute curvature is invariant when \(F\) is multiplied by a fixed nonzero scalar. The estimate depends on the coordinate metric and becomes unreliable if the gradient is nearly zero or higher derivatives vary substantially over the step. A measured corrector displacement tests the prediction.

Worked example

Predict the normal correction on a circle

On \(F=x^2+\lambda^2-4=0\), start at \((2,0)\) with tangent \((0,1)\) and choose \(h=0.20\). Then \(t^THt=2,\ \|g\|=4\), and the predicted normal displacement is \(-0.0100\). At fixed \(\lambda=0.20\), the exact correction is

\[\sqrt{4-0.20^2}-2=-0.01003.\]

Its sign points inward, restoring the radius.

Second application

Choose a step near a parabolic turning point

For \(F=\lambda-3x^2\) at the origin, take \(t=(1,0)\), \(n=(0,1)\). Here \(t^THt=-6,\ \|g\|=1\), so the exact corrector at fixed \(x=h\) is \(+3h^2\) in the parameter. To keep it below \(0.0012\), choose \(h\le0.020\). A proposed \(h=0.05\) would require correction \(0.0075\), over six times the target.

A solution curve contains more than one isolated solve

A physical model often depends on a parameter \(\lambda\), such as heat input, end displacement or applied load. Solving \(F(x,\lambda)=0\) independently at each parameter value discards information about how neighbouring states are related. On a smooth branch where \(F_x\) is invertible, differentiation gives

\[F_x\,dx/d\lambda=-F_\lambda.\]

This linear solve predicts how the state moves under a small parameter change. Re-evaluating the full residual at the prediction and correcting it by Newton accounts for the curvature omitted by the tangent.

For a scalar illustration take \(F=x^2+\lambda-1\). The admissible solution set is a parabola in the \((x,\lambda)\) plane, with branches \(x=\pm\sqrt{1-\lambda}\) for \(\lambda<1\). Its derivative \(dx/d\lambda=-1/(2x)\) grows without bound as \(x\) approaches zero. Starting at \(x=0.5,\lambda=0.75\), a change \(\Delta\lambda=0.1\) predicts \(x=0.4\). The positive exact value is

\[\sqrt{0.15}=0.38730.\]

The predictor is close enough for a local correction here. Increasing the load beyond one would ask for a real equilibrium that this model cannot supply.

Change the parameter used to follow the curve

The curve itself is smooth at \((0,1)\) although \(\lambda\) is a poor local coordinate there. Introduce an arclength-like parameter and a normalised tangent \(t=(t_x,t_\lambda)\) satisfying \(F_x t_x+F_\lambda t_\lambda=0\). At a known point \(z_k=(x_k,\lambda_k)\) predict \(z_p=z_k+\Delta s\,t\). Correct by solving the physical equation together with a hyperplane constraint \(t^T(z-z_p)=0\). This pseudo-arclength condition selects a nearby point on the branch while allowing the load parameter itself to reverse direction.

At the fold of the example \(F_x=0,\ F_\lambda=1\), and the tangent can be \(t=(-1,0)\). The augmented Jacobian has rows \((0,1)\) and \((-1,0)\), with determinant one. A Newton correction in the two unknowns is well posed even though the original scalar Jacobian for fixed \(\lambda\) was singular. The construction depends on a simple fold and the correct tangent. A more complicated branch intersection can require additional information to choose which path to follow.

Two root branches turn at lambda equal to one and join at x equal to zero.
The solution curve can be followed through the fold even though increasing the parameter beyond one would leave this particular equation with no real root.
OneSimulation · Follow an equilibrium through two load reversals

The dimensionless restoring law \(F(x,\lambda)=x^3-x+\lambda\) crosses two folds. At a prescribed load, Newton's scalar displacement update needs \(1/(3x^2-1)\); the denominator vanishes at the turns. In the displacement–load plane the tangent \(t\) remains defined. Starting from \((1.2,-0.528)\), the code orients that tangent toward decreasing displacement, makes a prediction \(p\), and requires the corrected point \(z\) to satisfy

\[F(z)=0,\]
\[t^T(z-p)=0.\]

The OneSimulation linear solver computes each two-component Newton correction. At a fold the tangent points entirely in the displacement direction, so the second equation fixes the displacement component locally and the first equation determines the load component. Try halving the step to sample the turns more densely. Load parametrisation visits the same load at up to three equilibria; the path history identifies which one has been followed.

"""Follow both folds of a scalar equilibrium with a two-variable Newton correction."""
import matplotlib.pyplot as plt
import numpy as np
from onesim.numerics.linear.matrices.dense_linear_algebra import solve_dense

step = 0.12  # arclength in dimensionless displacement-load coordinates
point = np.array([1.2, 1.2 - 1.2**3])
path = [point.copy()]
for _ in range(100):
    x, load = point
    tangent = np.array([-1.0, 3*x*x - 1])
    tangent /= np.linalg.norm(tangent)
    predicted = point + step * tangent
    point = predicted.copy()
    for _ in range(10):
        x, load = point
        residual = np.array([x**3 - x + load, tangent @ (point - predicted)])
        if np.linalg.norm(residual, np.inf) < 1e-12:
            break
        jacobian = np.array([[3*x*x - 1, 1], tangent])
        point -= solve_dense(jacobian, residual)
    else:
        raise RuntimeError("Reduce the continuation step")
    path.append(point.copy())
    if point[0] < -1.2:
        break

x, load = np.array(path).T
fold_x = np.array([-1, 1]) / np.sqrt(3)
assert x[-1] < -1.2 and np.max(np.abs(x**3 - x + load)) < 1e-11
assert np.count_nonzero(np.diff(np.sign(np.diff(load)))) == 2
print("Fold loads from the derivative:", fold_x - fold_x**3)
fig, ax = plt.subplots(figsize=(6.8, 3.8), constrained_layout=True)
ax.plot(load, x, ".-", color="#176879", label="Corrected continuation steps")
ax.scatter(fold_x-fold_x**3, fold_x, color="#a4492b", label="Analytic folds", zorder=3)
ax.set(xlabel="Load parameter (dimensionless)", ylabel="Displacement (dimensionless)")
ax.grid(alpha=0.2)
ax.legend()
fig.savefig("nonlinear-equations.png", dpi=160)
An S-shaped displacement versus load curve with computed equilibria and both analytic folds marked.
The markers follow the middle branch through both folds. The isolated highlighted points use the exact criterion \(3x^2-1=0\), giving load magnitudes \(2/(3\sqrt{3})\).

Download the Python example

Take one step past a turning point

Start exactly at the fold, choose the negative-\(x\) tangent and take \(\Delta s=0.1\). The predictor gives \((-0.1,1)\). Its physical residual is \(0.01\). The transverse plane now fixes \(x=-0.1\). Correcting the physical balance therefore gives

\[\lambda=1-0.1^2=0.99.\]

The parameter has decreased while the curve coordinate has advanced. This simple calculation illustrates why choosing fixed increments of \(\lambda\) alone cannot traverse both sides of the same load maximum.

A solver can report an accurate branch even if a physical system would not settle on that branch. To test stability one needs a dynamical law. For instance, if \(\dot x=1-\lambda-x^2=-F\), then perturbing an equilibrium gives

\[\dot e=-2x_\star e.\]

The positive branch is locally attracting and the negative branch repelling. The algebraic root residual vanishes on both. For a different specified dynamics the interpretation must be rederived. Keep separate records of equilibrium balance, tangent orientation, correction size and dynamical stability when interpreting a continuation diagram.

Check the prediction error against the step length

For the example, predict away from \((0.5,0.75)\) with the slope \(dx/d\lambda=-1\). A change of only 0.05 predicts \(x=0.45\), while the exact positive branch gives \(\sqrt{0.20}=0.447214\), an error about 0.00279. The larger change 0.10 gave error about 0.01270. Near this starting point halving the parameter step reduces the tangent prediction error by roughly a factor of four, consistent with the second-order remainder of a first-order predictor.

Approaching the fold makes that comparison deteriorate because the second derivative with respect to the load becomes unbounded. Monitoring the ratio of correction length to predictor length provides one way to shorten steps before Newton loses the branch. At a successful step, orient the new tangent to have positive dot product with its predecessor in the scaled coordinates. Without that convention, an arbitrary sign change in a computed tangent could send the next predictor back along the path already followed.

Distinguish a fold from a genuine branching point

The scalar equilibrium equation \(F(x,\mu)=x^3-\mu x=0\) describes a symmetry-breaking pitchfork. There is a trivial branch \(x=0\) for every \(\mu\) and two additional real branches \(x=\pm\sqrt\mu\) when \(\mu>0\). Ordinary parameter continuation along the trivial branch encounters no difficulty evaluating the solution on either side of zero. Yet the collection of real equilibria changes there. An algorithm that accurately follows one branch can therefore entirely miss the existence of the other two.

A fold often has \(F_x=0\) while \(F_\mu\ne0\), so the full derivative with respect to state and parameter retains rank one. At the pitchfork origin both derivatives vanish:

\[F_x=3x^2-\mu=0,\ F_\mu=-x=0.\]

Adding one arclength condition to the original scalar equation cannot restore full rank there because the equilibrium row itself is zero. Arclength continuation avoids a poor choice of independent coordinate at a regular fold; it does not automatically select a tangent at an actual branch crossing. Higher-order terms or an independent symmetry condition carry the missing information.

Follow the stable state through a loss of stability

To distinguish algebraic solutions from dynamically attracting equilibria, embed the example in \(x'=\mu x-x^3=-F(x,\mu)\). Linearising near an equilibrium gives perturbation growth rate \(\mu-3x^2\). At \(x=0,\mu=-0.04\), the rate is \(-0.04\) and small perturbations decay. At \(x=0,\mu=+0.04\), it becomes \(+0.04\) and perturbations grow. The additional equilibria are \(x=\pm0.2\), both with linear rate \(0.04-3(0.04)=-0.08\). A static Newton solve initialised at zero on the positive side returns zero residual immediately, even though that solution is now dynamically unstable.

To switch branches deliberately, use the state amplitude as the small parameter. Cancelling the known factor \(x\) on a nontrivial branch gives

\[\mu=x^2.\]

At \(x=0.1\) the predicted parameter is 0.01; at \(x=-0.1\) the same parameter gives the mirror branch. This cancellation is valid only because the branch sought has nonzero amplitude. Dividing the original equilibrium equation by \(x\) everywhere would have silently deleted the entire trivial branch.

The potential \(V=x^4/4-\mu x^2/2\) provides an independent physical check. At \(\mu=0.04\), the trivial state has energy zero, whereas either nontrivial state has energy \((0.2)^4/4-0.04(0.2)^2/2=-0.0004\). Its lower energy and positive second derivative agree with the negative linear growth rate. Near a bifurcation, record branch existence, stability and which branch a continuation procedure actually followed as three separately testable facts.

If small external imperfections break the symmetry, replacing the equation by \(x^3-\mu x-\epsilon=0\) eliminates the exact \(x=0\) branch whenever \(\epsilon\ne0\). At \(\mu=0\) the remaining equilibrium then has amplitude \(\epsilon^{1/3}\). A forcing imperfection of \(10^{-6}\) produces displacement 0.01, much larger than a linear response of the same size. This calculation identifies why branch diagrams near an ideal symmetry-breaking point are sensitive to tiny unmodelled loads.

A careful numerical continuation can map the resulting changes in the number of equilibria before interpreting any single sweep from one initial condition.

Locate the fold created by an imperfect pitchfork

An imperfect pitchfork can be analysed by solving the equilibrium and fold conditions together. With \(F=x^3-\mu x-\epsilon\), a fold requires \(F_x=3x^2-\mu=0\), hence \(\mu=3x^2\). Substitution into \(F=0\) gives \(-2x^3-\epsilon=0\), therefore \(x_f=-(\epsilon/2)^{1/3}\) and \(\mu_f=3(\epsilon/2)^{2/3}\) for positive imperfection. This is a nonanalytic dependence on the forcing perturbation. Halving the perturbation multiplies the fold displacement by \(2^{-1/3}\), rather than by one half as a linear sensitivity would predict.

For \(\epsilon=0.002\), the fold occurs at \(x_f=-0.1,\mu_f=0.03\). Indeed \(x^3-0.03x-0.002=(x+0.1)^2(x-0.2)\), showing the merging pair and the separate simple positive equilibrium. At this point \(F_\mu=0.1\ne0\) and \(F_{xx}=-0.6\ne0\), restoring the usual regular-fold conditions away from the perfect pitchfork. At \(\mu=0\) there is only the positive cube root of 0.002. Above 0.03 the negative pair splits into two simple real roots, so the number of equilibria becomes three. This count follows also by inspecting the local maximum at negative \(x\) and local minimum at positive \(x\). An observed delayed change in the number of equilibrium branches can therefore measure an imperfection that a symmetric idealisation omits.

Change parameters · Continuation and folds

Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.

Study the full derivation

Finding another equilibrium after one root is known · Nonlinear systems and iterative methods

Newton iteration repeatedly finds the same structural equilibrium. Derive how deflation changes its basins while preserving other solutions, use a rank-one Jacobian update, and distinguish a list of discovered equilibria from a completeness certificate.