A Byte of PhysicsLogo

Stability and equilibrium points

An equilibrium is a state that can remain unchanged under the model. Stability asks what happens after a small disturbance. The two ideas are related but not identical: a ball at the top of a hill is in equilibrium in the ideal model, yet an arbitrarily small displacement makes it move away.

Equilibrium in one dimension

For a particle governed by

\[m\ddot x=F(x)\]

an equilibrium position \(x_*\) satisfies

\[F(x_*)=0\]

The complete stationary state also has \(v=0\). Passing through a zero-force point with nonzero velocity is not equilibrium; inertia carries the particle onward.

If force derives from potential energy, \(F=-dU/dx\), then equilibria occur at stationary points:

\[U'(x_*)=0\]

Root candidates must lie in the physical domain and satisfy the original equation.

Stable, unstable, and neutral behavior

At a smooth isolated stationary point, potential curvature gives the local classification:

\[U''(x_*)>0\Rightarrow\text{stable},\qquad U''(x_*)<0\Rightarrow\text{unstable}\]

A strict local minimum raises potential for nearby displacement, producing a restoring force. A local maximum lowers potential on either side, so force pushes away. If \(U''(x_*)=0\), the test is inconclusive.

For a perfectly flat potential over an interval, any stationary point is neutrally stable in position: a small displacement can remain at the new point rather than return. With nonzero perturbed velocity, the particle drifts because no restoring force acts. Stability must specify which state variables are perturbed.

Linearization near equilibrium

Let \(x=x_*+\eta\) with small \(\eta\). Expanding force gives

\[F(x_*+\eta)\approx F(x_*)+F'(x_*)\eta=F'(x_*)\eta\]

Since \(F'=-U''\),

\[m\ddot\eta+U''(x_*)\eta=0\]

For positive curvature, this is a harmonic oscillator with

\[\omega=\sqrt{\frac{U''(x_*)}{m}}\]

For negative curvature, solutions contain exponential growth rather than oscillation. The linear approximation is local; higher-order terms matter after perturbations become large.

import sympy as sp

x = sp.Symbol("x", real=True)
potential = (x**2 - 1) ** 2
for root in sp.solve(sp.diff(potential, x), x):
    curvature = sp.diff(potential, x, 2).subs(x, root)
    kind = (
        "stable" if curvature > 0 else "unstable" if curvature < 0 else "inconclusive"
    )
    print(root, curvature, kind)

Numerical derivative tolerances need units: slope has force dimensions and curvature has force per length.

When the second derivative vanishes

Consider \(U(x)=ax^4\) with \(a>0\). At the origin, both first and second derivatives vanish, yet the potential has a stable minimum. Higher-order behavior classifies it.

For \(U(x)=ax^3\), first and second derivatives vanish at the origin, but the potential decreases on one side and increases on the other; it is not a stable minimum. Treating every zero curvature as neutral would misclassify both examples.

Damping changes asymptotic behavior

With linear damping near a stable minimum,

\[m\ddot\eta+b\dot\eta+k_{\mathrm{eff}}\eta=0\]

where \(k_{\mathrm{eff}}=U''(x_*)\). Positive damping causes perturbations to decay toward equilibrium. Without damping, an ideal conservative system near a minimum usually oscillates rather than asymptotically settling.

Negative damping adds energy and can destabilize an otherwise restoring potential. Potential shape alone therefore cannot classify systems with velocity-dependent or active forces.

General dynamical-system stability

Write a first-order autonomous system as

\[\dot{\mathbf y}=\mathbf f(\mathbf y)\]

An equilibrium state satisfies

\[\mathbf f(\mathbf y_*)=\mathbf 0\]

For a small perturbation \(\boldsymbol\eta=\mathbf y-\mathbf y_*\), linearization gives

\[\dot{\boldsymbol\eta}=\mathbf J(\mathbf y_*)\boldsymbol\eta\]

where \(J_{ij}=\partial f_i/\partial y_j\). Eigenvalues of the Jacobian determine local linear behavior. Any eigenvalue with positive real part gives an unstable direction. All eigenvalues with negative real parts give an asymptotically stable equilibrium. Purely imaginary or zero real parts make linearization inconclusive about some nonlinear cases.

Example: damped oscillator state matrix

For \(m\ddot x+b\dot x+kx=0\), choose state \(\mathbf y=(x,v)\). Then

\[\dot{\mathbf y}=\begin{bmatrix}0&1\\-k/m&-b/m\end{bmatrix}\mathbf y\]

The characteristic equation is

\[\lambda^2+\frac bm\lambda+\frac km=0\]

For positive mass, stiffness, and damping, both eigenvalues have negative real parts, so the origin is asymptotically stable. With zero damping they are purely imaginary and the ideal motion is bounded but does not decay.

Multiple-dimensional potential

For generalized coordinates \(\mathbf q\), conservative equilibria satisfy \(\nabla U(\mathbf q_*)=\mathbf0\). The Hessian is

\[H_{ij}=\left.\frac{\partial^2U}{\partial q_i\partial q_j}\right|_{\mathbf q_*}\]

A positive-definite Hessian indicates a strict local minimum for unconstrained coordinates. A negative eigenvalue gives a downhill unstable direction. Mixed signs indicate a saddle. Zero eigenvalues require symmetry, constraint, or higher-order analysis.

import numpy as np

x, y = sp.symbols("x y", real=True)
potential_2d = x**2 - y**2
hessian = sp.hessian(potential_2d, (x, y))
eigenvalues = np.linalg.eigvalsh(np.array(hessian, dtype=float))
print("Curvatures:", eigenvalues)
print("A negative curvature identifies an unstable direction.")

The Hessian should be symmetric for a sufficiently smooth scalar potential; substantial asymmetry in a numerical estimate is a diagnostic.

Constraints restrict perturbations

A bead on a wire may be stable along the wire even if the ambient potential decreases in a direction the bead cannot move. Stability must be tested on the constraint manifold, using tangent perturbations that satisfy the linearized constraint.

Reaction forces can also change the linearized dynamics. Simply checking the full-space Hessian without projecting into allowed coordinates may invent an unstable forbidden direction or miss a constraint-induced mode.

Driven and time-dependent systems

A periodically driven system may have no time-independent equilibrium. It can instead have a periodic steady response whose stability is tested by perturbing the whole time-dependent solution. Floquet multipliers or a stroboscopic map can classify such orbits. Calling one instantaneous zero-acceleration point an equilibrium ignores the drive phase and velocity state.

Numerical equilibrium finding

Root solvers can find \(F(x)=0\) or \(\nabla U=0\). Their success flag is not classification. Verify the residual, domain, and nearby behavior.

Newton's root method can converge to different roots depending on the initial guess and can fail where derivatives are small. Bracketing is safer in one dimension for sign- changing roots, but it can miss a force that only touches zero. Scan, bracket, refine, deduplicate, and compare with analytic structure where possible.

Perturbation experiments

for perturbation in [0.1, 0.01, 0.001]:
    for sign in [-1, 1]:
        position = 1.0 + sign * perturbation
        force = -4 * position * (position**2 - 1)
        print(f"Offset {sign*perturbation:+.3f} m: force {force:+.6f} N")
        assert force * (position - 1.0) < 0

A finite-time bounded trace is evidence, not proof of global stability. Numerical damping can make an unstable or neutral system look attracting, while numerical instability can make a stable system appear to diverge.

Energy barriers and local versus global stability

A local minimum may be surrounded by a finite barrier. Perturbations with energy below the barrier remain in the well under ideal conservative dynamics; larger disturbances can escape. Local linear stability says nothing about every finite perturbation.

Report the perturbation size or energy range over which the conclusion is intended. Parameter uncertainty can shift equilibria and barrier heights, so a stability margin may be more useful than a single nominal label.

Validation checks

Equilibrium is a zero of the complete dynamics. Stability is a statement about nearby trajectories, and it becomes reliable only after the appropriate local model, constraints, and numerical convergence are all checked.

A worked Python notebook

Inspect how the local curvature changes across a double-well potential. The question for this calculation is precise: how does double-well curvature change when we change position, while keeping the other choices fixed? The earlier sections explain the physical relationship. Here we turn one part of that relationship into a calculation that you can run, inspect, and change in Google Colab.

Curvature classifies an equilibrium only after the first derivative has been checked to vanish there. Keep that sentence beside the results. A formula can return a number outside its useful range, and a plotting library will usually draw that number without asking whether the physical assumptions still hold. The selected interval is from -1.3 to 1.3 m. It gives us a specific domain to discuss instead of leaving the graph's range to a software default.

Use the notebook link above the lesson, run the setup cell, and then run the cells in order. The code below is also included there. NumPy handles the arrays of numerical values, SymPy keeps the equation symbolic, and Matplotlib draws the results. If these libraries or notebook cells are unfamiliar, start with Your first physics notebook.

State the relationship before choosing a graph

In this small example, q stands for position, expressed in m. The output is double-well curvature, expressed in N/m. The equation below uses the numerical values in those units. Any fixed coefficients therefore carry the units needed to make the relation consistent. A value supplied in another unit must be converted before it enters this expression.

\[f(q) = 12 q^{2} - 4\]

This is a function of one changing input. It is not a statement that the physical system has only one variable. We deliberately hold the other inputs fixed so that one cause of variation is visible. Changing several inputs at once would make it harder to tell which change produced the output difference. Write down the held-fixed choices before trying a different experiment.

At 1 m, the expression gives 8 N/m. This is our reference calculation. It is a prediction of the stated example, not a new measurement. Its displayed digits help us compare implementations. They should not be read as a claim that physical inputs are known to six significant figures.

import numpy as np
import sympy as sp
import matplotlib.pyplot as plt

q = sp.Symbol("q", real=True)
expression = sp.sympify("12*q**2-4", locals={"q": q})
reference_input = 1.0
reference_output = float(expression.subs(q, reference_input))
print("Input:", reference_input, "m")
print("Predicted double-well curvature:", reference_output, "N/m")

sp.Symbol declares a mathematical symbol. It does not assign a numerical measurement to that symbol. subs then replaces the symbol with our chosen input, and float converts the resulting symbolic number into a standard Python numerical value. Keeping these steps separate lets us inspect the equation before numerical substitution. It also prevents a later plot from becoming the only surviving record of the model.

Compare a few cases you can explain

Before drawing hundreds of points, calculate three. The lower endpoint gives 16.28 N/m. The midpoint, at 0 m, gives -4 N/m. The upper endpoint gives 16.28 N/m. Read these together with the assumptions: they describe different choices of position within the same example, with the other inputs held fixed.

These three values are a useful first check, but they do not establish the shape between them. Two endpoints can be equal even when the curve bends or oscillates in between. Likewise, a large change between endpoints does not tell us whether the relationship is linear. We need the equation and intermediate samples to answer those questions.

evaluate = sp.lambdify(q, expression, modules="numpy")
inputs = np.array([-1.3, 0.0, 1.3])
outputs = np.asarray(evaluate(inputs), dtype=float)
outputs = np.broadcast_to(outputs, inputs.shape)
for input_value, output_value in zip(inputs, outputs):
    print(f"{input_value:.6g} m -> {output_value:.6g} N/m")
assert np.all(np.isfinite(outputs))

lambdify turns the symbolic expression into a numerical function. We explicitly select NumPy as its numerical backend so it can accept an array. The same expression now has two useful forms: one for algebra and one for calculating many cases. The assertion checks that the chosen inputs produce finite outputs. It would catch an infinity or an undefined numerical result, but a finite value can still be physically inappropriate.

Make a graph that answers the question

The horizontal axis shows position; the vertical axis shows double-well curvature. Every plotted point is a prediction of the same expression. We mark the reference case separately so that a reader can connect the earlier printed value to its place on the curve. The axis labels include units because a shape without a scale cannot tell us the size of a physical effect.

input_grid = np.linspace(-1.3, 1.3, 301)
output_grid = np.asarray(evaluate(input_grid), dtype=float)
output_grid = np.broadcast_to(output_grid, input_grid.shape)
fig, ax = plt.subplots(figsize=(7, 4))
ax.plot(input_grid, output_grid, label="Stated model")
ax.scatter([reference_input], [reference_output], label="Reference case", zorder=3)
ax.set_xlabel("Position (m)")
ax.set_ylabel("Double-well curvature (N/m)")
ax.legend()
ax.grid(alpha=0.25)
fig.tight_layout()
plt.show()

Look for a sign change, a turning point, or a region where the curve becomes steep. Connect each feature to the expression rather than to the colour of the line. If the curve has a minimum or maximum, changing the input in opposite directions may have similar effects on the output near that point. If it is nearly straight over a short interval, a local linear approximation may be useful even when the complete expression is nonlinear.

Increasing the number of samples makes the line smoother and may reveal features that a coarse grid missed. It does not improve the physical inputs or enlarge the model's validity range. For quantities that can take only discrete values, use the line as a guide to the relationship and interpret only the allowed input values. A plotting function does not enforce such restrictions for you.

Measure the local sensitivity

A derivative asks a more specific question than the whole graph: how quickly does double-well curvature change near the reference input? Its units are the output unit divided by the input unit. For this calculation, the derivative at 1 m is 24 in those ratio units. Locally, the output increases as the input increases. This statement is local; the sign or size of the slope can be different elsewhere on the curve.

\[f'(q) = 24 q\]

For a small input change, multiply the derivative by that change to estimate the output change. Then compare that estimate with a fresh evaluation of the full expression. The distinction between these two calculations matters: the derivative gives a tangent approximation, while substitution evaluates the chosen expression at the new point.

slope_expression = sp.diff(expression, q)
slope_at_reference = float(slope_expression.subs(q, reference_input))
changed_input = 1.013
linear_prediction = reference_output + slope_at_reference * (
    changed_input - reference_input
)
full_prediction = float(evaluate(changed_input))
print("Symbolic derivative:", slope_expression)
print("Tangent prediction:", linear_prediction, "N/m")
print("Full expression:", full_prediction, "N/m")
print("Approximation difference:", full_prediction - linear_prediction, "N/m")

Here the changed input is 1.013 m. The tangent estimate is 8.312 N/m, while the full expression gives 8.31403 N/m. If the two values are close, it means the chosen input change is small enough for this local approximation at this point. It does not mean the entire model is linear. If the slope is zero, a quadratic or higher-order term may supply the leading change instead.

This is also the beginning of uncertainty propagation. If the input has a small stated standard uncertainty, the magnitude of the slope times that uncertainty estimates one contribution to output uncertainty. Do not automatically use the same rule for a wide interval, a discontinuity, a turning point with zero first derivative, or several correlated uncertain inputs. Those situations need more of the model than one slope.

Check the derivative with numerical differences

We can estimate the same slope from values on either side of the reference point. Subtract the lower output from the upper output and divide by twice the input step. Parentheses are essential: the entire output difference must be divided by the entire input interval. Without them, Python can execute a different mathematical expression while still producing a plausible number.

The calculation below uses three decreasing step sizes. Each estimate is compared with the symbolic derivative, so the reference is independent of the numerical difference formula. Near an endpoint, it is acceptable here to evaluate a small extension only because the displayed mathematical expression is smooth there; such a check does not assert that extrapolated values describe additional physical cases.

input_span = 2.6
for fraction in [1e-2, 1e-3, 1e-4]:
    step = input_span * fraction
    upper = float(evaluate(reference_input + step))
    lower = float(evaluate(reference_input - step))
    numerical_slope = (upper - lower) / (2 * step)
    difference = numerical_slope - slope_at_reference
    print(f"step={step:.6g}: slope={numerical_slope:.6g}, difference={difference:.6g}")

For a smooth function, reducing the step often reduces the approximation error at first. Very small steps can eventually make subtraction of nearly equal floating-point values less reliable. Therefore “smaller” is not an unlimited guarantee of “better.” Compare the observed behaviour over a useful range of steps instead of choosing the smallest number the computer can represent.

An absolute slope difference is useful when the expected slope is near zero. A relative difference would divide by a very small reference and could look enormous even when the absolute discrepancy is tiny. Away from zero, a relative difference can help compare quantities with very different scales. The tolerance should reflect the question and the numerical method, rather than a universal decimal threshold copied into every test.

Change the example and preserve the reasoning

Make one copy of the reference calculation before editing it. Choose a second value of position inside the stated interval, predict whether double-well curvature will rise or fall, and then evaluate the expression. Place the prediction and the result in a text cell. If they disagree, identify whether the mistake was in the sign, the unit conversion, the algebra, or the assumption about how the curve behaves.

Next choose a shorter plotting interval around the reference point. Compare the local curve with its tangent approximation. Then widen the interval again. The difference shows why a useful local estimate need not describe the whole range. Keep the axis labels and numerical scale visible when comparing the plots; automatic axis limits can make two different effects appear equally large.

Finally, return to the physical limit stated at the start: Curvature classifies an equilibrium only after the first derivative has been checked to vanish there. Describe one change to the setup that would violate that limit. State what new input, equation, or observation would be needed before trusting an answer in the changed situation. This last step connects the Python experiment to the physics instead of treating successful execution as the only criterion for a useful result.

Before saving, restart the runtime and run all cells in order. A result that depends on an earlier, now-deleted input cell is not reproducible from the saved notebook. Keep unrounded values for later calculations, round only the reported output, and label any new data as measured, assumed, or generated. The graph and printed values should remain traceable to the same expression and the same choices of inputs.

Recover the output change by integrating the slope

There is another way to check that the expression and its derivative describe the same relationship. Add up the small output changes predicted by the slope across the chosen input interval. In the continuous limit, this integral equals the output at the upper endpoint minus the output at the lower endpoint. The result has units of N/m: the input unit in the integration cancels the input unit in the denominator of the slope.

This statement is about the mathematics of this particular relationship. It does not assign a new physical meaning to an arbitrary area under a graph. For example, an area under force versus distance represents work, while an area under a different pair of quantities may represent something else or have no standard name. Always carry the axis units through the calculation before naming an integral.

slope_function = sp.lambdify(q, slope_expression, modules="numpy")
endpoint_change = float(evaluate(1.3) - evaluate(-1.3))
for points in [101, 201, 401]:
    grid = np.linspace(-1.3, 1.3, points)
    slopes = np.asarray(slope_function(grid), dtype=float)
    slopes = np.broadcast_to(slopes, grid.shape)
    integrated_change = np.trapezoid(slopes, grid)
    print(
        points,
        "integrated change:",
        integrated_change,
        "endpoint change:",
        endpoint_change,
    )

The trapezoidal rule joins neighbouring slope samples with straight segments and adds their signed areas. A negative contribution remains negative; replacing every slope by its magnitude would calculate a different quantity. Increasing the sample count provides a practical refinement check. If the values do not settle toward the endpoint difference, first inspect the interval, singularities, and array ordering.

Do not conclude that two agreeing calculations prove the model is physically complete. Both use the same selected relationship, so an omitted effect would be omitted from both. Their agreement is evidence that the numerical tools implement that relationship consistently. Comparing with an independent experiment or a more appropriate physical model is a separate test.

Keep this comparison in the notebook when you change the expression. It is particularly useful after adding a coefficient, changing a sign convention, or converting an input unit. A code cell that produces a smooth graph can conceal these mistakes; a second calculation of the same output change gives you another place to notice them.

Sources


Share to: