The last lesson ended with two promises. The pendulum’s linearization is a center, and we said energy proves the nonlinear pendulum really is one; and for , where the Jacobian says “center” for every , something other than eigenvalues must decide. This lesson keeps both promises with one idea: find a function and watch how it changes along solutions. We never solve the ODE. And the same idea tells you what a simulation must preserve: an integrator that lets the energy drift is wrong in a way no step-size table shows.
Transcript
- This lesson finds a function V and watches it change along solutions, without ever solving the ODE. For the pendulum, with H equal to y squared over two minus cosine x, the chain rule gives H dot equals grad H dot f, exactly zero. Each orbit stays on one level curve.
- Lotka–Volterra works the same way, with H equal to x minus log x plus y minus log y. H dot cancels to zero. Measured with RK4 from two, one, H is 2.30685 at t equals zero, and still 2.30685 at t equals ten.
- Make H a height and the energy becomes a surface. The pendulum's center is the bottom of a valley, where H plus one is about half x squared plus y squared; the saddle is a pass. An orbit is a loop at constant height. Level curves need not be closed.
- A Hamiltonian system takes x prime equal to H y and y prime equal to minus H x. Its divergence is zero, so a blob of starting points keeps its area. In incompressible two-dimensional flow a stream function plays H, from memory: streamlines are level curves, and psi from one, point five stays 0.40342.
- Lyapunov stability: the origin is stable if for every epsilon there is a delta such that solutions starting within delta stay within epsilon. Take V positive definite, with a level c inside the epsilon disk. If V dot is at most zero, trajectories cross levels only inward, and can never get out.
- The damped oscillator, with V the energy: V dot equals minus y squared, so the origin is stable, though V dot is zero on the x axis. LaSalle, stated not proved: staying on the x axis needs y prime, minus two x, to be zero, so only the origin is invariant. V falls to 6.695 times ten to the minus five.
- Now the wrong yardstick, x squared plus y squared. V dot is plus 0.5 at one, minus 0.5; the largest is 0.44258. V climbs to 1.15812 at t equals 0.55 and rises on 270 of 1000 steps, then decays to 8.7 times ten to the minus five. Inconclusive, not instability.
- For this cubic system, V equals x squared plus y squared gives V dot equals minus two times x to the fourth plus y to the fourth: asymptotically stable, no eigenvalue needed. From one, one, V is 0.06511 at t equals ten. In the borderline family, V dot is two a V squared: at t equals four, V is 0.55556, 1.00000, 5.00000.
- A gradient system, x prime equals minus grad V, has V dot equal to minus grad V squared: no periodic orbits, and minima are sinks. In the double well, seeds at plus and minus point three, one fall to the two minima, V going from 0.70703 to 1.0 times ten to the minus nine; a seed on x equals zero stalls at 0.25000.
- What does an integrator do to a conserved quantity? Pendulum, T equals one thousand, h equals point one: explicit Euler gains 48.56, RK4 drifts minus 4.6 times ten to the minus five one way, and symplectic Euler stays within 0.02262, oscillating without accumulating.
- Why is symplectic Euler bounded? On the oscillator one step conserves Q equals x squared plus y squared minus h x y exactly: an ellipse, a nearby level curve. So H minus H zero is half h x y, bounded by h over four minus two h: 0.026316 at h equals 0.1, and 0.16667 at 0.5.
- Fluids, from memory. Inviscid two-dimensional flow conserves energy and enstrophy; a scheme that breaks that blows up or bleeds its vortices. Euler-type advection adds energy and can explode. Stam's semi-Lagrangian advection is stable but dissipative. Verlet-type steps keep a nearby energy, as in SPH.
- Recap. H is conserved when H dot is zero, and orbits sit on level curves. Hamiltonian flows preserve area. A Lyapunov function traps trajectories in sublevel sets; a failed candidate is inconclusive. Gradient flows go downhill, and a good integrator keeps a nearby energy. Next: limit cycles.
Conserved quantities: orbits live on level curves
Let be a planar system and any differentiable function. Along a solution the chain rule (2.3 Gradient & Directional Derivatives and 2.2 Linearization, the Chain Rule & the Jacobian) gives
If at every point, is conserved: each orbit stays on one level curve . That is a one-line proof that is easy to check by hand and requires no solution. Three examples, each drawn by the lab.
- Oscillator , : . Orbits are circles.
- Pendulum , : . On a level the orbit is the curve .
- Lotka–Volterra , : .
Measured (RK4, , block D, and the sim’s readout): from the Lotka–Volterra is at and still at , with , and over the run. For the pendulum is exactly at every sampled point.
Two cautions. Level curves need not be closed; they are small ovals around a strict minimum of (the pendulum’s center: near , ). And is a pointwise fact about the vector field; it does not depend on how you integrate. That distinction returns in the numerics section.
Hamiltonian systems preserve area
Many conserved quantities have a special shape. Given , the Hamiltonian system is
Then automatically, which is why the pendulum ( = angle, = angular velocity, , ) works. Its velocity field has divergence , so by 2.7 Divergence: Sources & Sinks the flow neither compresses nor expands area: a blob of initial conditions is carried to a blob of the same area. In the linear case this is the statement of 7.5 The Matrix Exponential & Fundamental Matrices: the area scales by , and means area is preserved. A consequence you can see in a phase portrait: a Hamiltonian equilibrium cannot be a sink or a source (these shrink or grow area), only a saddle or a center.
Fluids. In a 2D incompressible flow lets us write for a stream function (existence from memory; the check that this is divergence-free is the same cancellation ). A fluid particle then follows a Hamiltonian system with , so streamlines of a steady flow are level curves of . Take the cellular flow , i.e. . From the particle has , and block D finds after (the sim system “cellular flow”). The particle is trapped in one cell for all time.
Lyapunov stability, honestly
Say the equilibrium is the origin. It is stable if for every there is a such that every solution that starts within of the origin stays within of it for all . It is asymptotically stable if in addition solutions starting near it tend to it. Picture a small disk of radius inside a big disk of radius : stability says that trajectories from the small disk never leave the big one. The undamped oscillator is stable but not asymptotically stable (orbits circle forever), so “stable” is a weaker and more honest notion than “decays”.
Now a function with and elsewhere near (positive definite; its level sets are loops around the origin). Its derivative along solutions is . The picture-proof of stability: given , choose a level below the smallest value of on the circle of radius ; then the sublevel set lies inside the -disk, and pick so that the -disk lies in . If , a trajectory crosses level sets only inward (or runs along one), so it can never get out: it stays in , hence within .
Only semi-definite, then what? For the damped oscillator take the energy :
Energy never rises, so the origin is stable. But whenever , so is not satisfied, and the theorem as stated gives only stability. LaSalle’s invariance principle (stated, not proved) repairs this: if has bounded sublevel sets and , every trajectory approaches the largest set that is itself invariant inside . Here is the -axis. A trajectory can stay on it only if there, but , which vanishes only at . So the invariant set is the origin and every trajectory converges to it. Measured (sim, block A): from , falls from to at and is at the start (where ) and negative afterwards.
A strict Lyapunov function resolves a linearization failure
The previous lesson’s problem: has a center in its linearization. Take :
So the origin is asymptotically stable: a proof with no eigenvalue anywhere. From the sim shows , smallest , and at . The decay is slow because the cubic terms are tiny near : gives , so grows at a rate between and . Block B measures going from to between and , a rate of , inside the band.
The borderline family with the same :
For : , asymptotically stable. For : and everywhere, so grows along every orbit, unstable. Solving gives , which is the previous lesson’s squared. Measured from at (sim, block C): for (formula ), for (here , a true center), and for (formula ); these are the squares of the radii and in the last lesson.
When the candidate fails. Try on the damped oscillator of the previous section:
At this is , so rises. This is an inconclusive test, not a proof of instability: the oscillator is stable, we just picked the wrong yardstick. The sim (candidate “wrong guess”, seed ) flags it: the largest is , the flag fires at , climbs from to at , and it rises on 270 of the 1000 steps before decaying to . Lyapunov’s theorem only goes one way: finding a proves stability, failing to find one proves nothing. The energy of the system is the first candidate to try, and the one that fixes this case.
Gradient systems: pure downhill flow
Definition. A gradient system is . Then
with equality only at critical points of . Consequences, each with a mechanism:
- No periodic orbits. Around a closed orbit would return to its starting value, but it strictly decreases off equilibria. (The one-variable case, 3.8 Autonomous Equations, Equilibria & Stability, is always a gradient system with , which is why can never oscillate.)
- Equilibria are critical points of . The Jacobian is (minus the matrix of second derivatives). The Hessian is symmetric, so it has real eigenvalues (from memory) and a gradient system has no spirals; a minimum of has positive Hessian eigenvalues, hence has negative ones: a sink. A saddle of is a saddle of the flow.
Double well : , . The Hessian is . At it is , so : two stable nodes. At it is , so : a saddle with the -axis as stable direction, which separates the basins. In the sim, seeds and end at and , with falling from to and never once rising. A seed on the line , , stays on it and slides into the saddle, with , the saddle’s height. Start at instead and you end at .
Numerics: what an integrator does to a conserved quantity
Take the pendulum from , so , run to (the swing has period , so about periods; block E prints both), and record and over the run (sim: pendulum, set the integrator and ; block E):
| method | : end | max | : end | max |
|---|---|---|---|---|
| explicit Euler | ||||
| RK4 | ||||
| symplectic Euler |
Euler gains energy until the pendulum is spinning over the top (the orbit leaves the oscillation region ). RK4 has a tiny but one-directional drift, and its error would keep growing with . Symplectic Euler (kick , then drift ; defined in 4.7 Energy & Symplectic Integrators) has a larger error at a given time but it oscillates and does not accumulate. Recall that is at every point whatever the method; the drift lives in the numerical state, which the integrator moves off the true level curve a little each step.
Why symplectic Euler is bounded, on the oscillator . One step is , . Substitute and expand: satisfies exactly. So the method conserves exactly, though not : it follows an ellipse, a nearby level curve. And on that ellipse, bounded by (maximum of on the ellipse, at ). Measured over from (block E and the sim’s readout for “oscillator” + “symplectic Euler”): gives (formula ) and ; gives and . For a general Hamiltonian the same statement is a nearby conserved (backward error analysis; from memory), which is why the pendulum column stays bounded.
What to try. (1) Damped oscillator, candidate energy, seed : falls and no flag; switch to the guess and the flag fires. (2) Borderline system: and read . (3) Pendulum: Euler, RK4, symplectic Euler, and , comparing . (4) Gradient system: click on both sides of .
Computing it
Now implement the numerical Lyapunov test: integrate, evaluate along the path, and decide.
Concept checks
Problems
For with , write it as . Show that gives and use LaSalle to conclude asymptotic stability.
Show worked solution
, so the origin is stable. only on . A solution that stays on for all time needs , so . The largest invariant set in is the origin, and has bounded sublevel sets (ellipses), so every trajectory tends to (LaSalle, stated). For this is the oscillator of the lab. (By hand; the lab computes the case.)
For with and start , solve for and find when the solution blows up.
Show worked solution
is separable: , and gives . With this is , which becomes infinite at : finite-time blow-up, not just growth. At it is , matching the sim (which stops at ). For the blow-up time is before , and the sim says so. For the same formula decays like , algebraically and not exponentially.
Take , i.e. . Find and classify the equilibria and the separatrix.
Show worked solution
Equilibria: and , so and . has . At : , a saddle. At : , eigenvalues , non-hyperbolic, but has a strict minimum there (), so the levels are closed ovals: true centers. The saddle has , so the separatrix is , a figure eight around the two centers. (By hand; not in the sim.)
Key Takeaways
- is conserved when ; orbits lie on level curves of (oscillator, pendulum , Lotka–Volterra: measured at and ).
- Hamiltonian systems have zero divergence: area is preserved, equilibria are saddles or centers. A 2D incompressible flow is Hamiltonian with , so streamlines are level curves of .
- Stable means “start within , stay within ”. positive definite with traps trajectories in sublevel sets (stability); gives asymptotic stability (stated); plus LaSalle (stated) handles the damped oscillator, .
- gives for , and for the borderline family: stable for , unstable for ( and at ).
- An indefinite is inconclusive, not instability: on the damped oscillator has largest , while the energy works.
- Gradient systems have : no periodic orbits, minima of are sinks, saddles of are saddles.
- Pendulum to at : Euler gains , RK4 drifts one way, symplectic Euler stays within because it conserves exactly on the oscillator. Next: 7.9 Limit Cycles & Hopf Bifurcations.