Flow Lab

Syllabus / Module 7: Systems of ODEs & Dynamical Systems

Lesson 7.8

Conservative Systems & Lyapunov Functions

Energy methods: conserved quantities, level curves as trajectories, Lyapunov functions to prove stability without solving.

Written byClaude Sonnet

🌊
Why this matters for simulation: Inviscid 2D flow conserves energy and enstrophy — conserved quantities constrain the dynamics.

By the end of this lesson you can…

  • Show that a function $H(x,y)$ is conserved by $\mathbf x' = \mathbf f$ by checking $\dot H = \nabla H\cdot\mathbf f = 0$, and read the orbits as level curves of $H$.
  • Write a planar Hamiltonian system $x' = H_y,\ y' = -H_x$, show that its flow preserves area (divergence $0$), and connect this to the stream function of a 2D incompressible flow.
  • State Lyapunov stability and asymptotic stability with the $\varepsilon$–$\delta$ picture, and explain why $\dot V \le 0$ keeps trajectories inside level sets of $V$.
  • Prove stability of $x' = -y - x^3,\ y' = x - y^3$ and decide the borderline system $x' = -y + ax(x^2+y^2)$ with $V = x^2 + y^2$; say what a failed candidate $V$ does and does not tell you.
  • Recognize a gradient system $\mathbf x' = -\nabla V$ and explain why it has no periodic orbits and how its equilibria are classified.
  • Measure the energy drift of explicit Euler, RK4 and symplectic Euler on the pendulum, and check $\dot V \le 0$ numerically along trajectories in code.
On this page
·
  1. Conserved quantities: orbits live on level curves
  2. Hamiltonian systems preserve area
  3. Lyapunov stability, honestly
  4. A strict Lyapunov function resolves a linearization failure
  5. Gradient systems: pure downhill flow
  6. Numerics: what an integrator does to a conserved quantity
  7. Computing it
  8. Concept checks
  9. Problems
  10. Key Takeaways

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 x′=−y+ax(x2+y2)x' = -y + a x(x^2+y^2), where the Jacobian says “center” for every aa, something other than eigenvalues must decide. This lesson keeps both promises with one idea: find a function V(x,y)V(x,y) 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.

▶ Video Energy surfaces and level curves: orbits that stay on a level, trajectories that cross levels inward, and gradient flows downhillcaptions only
Transcript
  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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.
  11. 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.
  12. 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.
  13. 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 x′=f(x)\mathbf x' = \mathbf f(\mathbf x) be a planar system and H(x,y)H(x,y) any differentiable function. Along a solution the chain rule (2.3 Gradient & Directional Derivatives and 2.2 Linearization, the Chain Rule & the Jacobian) gives

ddtH(x(t),y(t))=Hxx′+Hyy′=∇H⋅f=:H˙.\frac{d}{dt}H(x(t),y(t)) = H_x x' + H_y y' = \nabla H\cdot\mathbf f =: \dot H.

If H˙=0\dot H = 0 at every point, HH is conserved: each orbit stays on one level curve H=cH = c. 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 x′=y, y′=−xx' = y,\ y' = -x, H=12(x2+y2)H = \tfrac12(x^2+y^2): H˙=xy−yx=0\dot H = xy - yx = 0. Orbits are circles.
  • Pendulum x′=y, y′=−sin⁡xx' = y,\ y' = -\sin x, H=12y2−cos⁡xH = \tfrac12y^2 - \cos x: H˙=(sin⁡x)y+y(−sin⁡x)=0\dot H = (\sin x)y + y(-\sin x) = 0. On a level H=cH = c the orbit is the curve y=±2(c+cos⁡x)y = \pm\sqrt{2(c + \cos x)}.
  • Lotka–Volterra x′=x(1−y), y′=y(x−1)x' = x(1-y),\ y' = y(x-1), H=x−ln⁡x+y−ln⁡yH = x - \ln x + y - \ln y: H˙=(1−1x)x(1−y)+(1−1y)y(x−1)=(x−1)(1−y)+(y−1)(x−1)=0\dot H = (1 - \tfrac1x)x(1-y) + (1-\tfrac1y)y(x-1) = (x-1)(1-y) + (y-1)(x-1) = 0.

Measured (RK4, h=0.01h = 0.01, block D, and the sim’s readout): from (2,1)(2,1) the Lotka–Volterra HH is 2.306852.30685 at t=0t = 0 and still 2.306852.30685 at t=10t = 10, with max⁡∣H−H0∣=1.2×10−10\max|H - H_0| = 1.2\times10^{-10}, and max⁡∣H˙∣=1.1×10−16\max|\dot H| = 1.1\times10^{-16} over the run. For the pendulum H˙\dot H is exactly 00 at every sampled point.

Two cautions. Level curves need not be closed; they are small ovals around a strict minimum of HH (the pendulum’s center: near (0,0)(0,0), H+1≈12(x2+y2)H + 1 \approx \tfrac12(x^2+y^2)). And H˙=∇H⋅f\dot H = \nabla H\cdot\mathbf f 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 H(x,y)H(x,y), the Hamiltonian system is

x′=∂H∂y,y′=−∂H∂x.x' = \frac{\partial H}{\partial y}, \qquad y' = -\frac{\partial H}{\partial x}.

Then H˙=HxHy−HyHx=0\dot H = H_xH_y - H_yH_x = 0 automatically, which is why the pendulum (xx = angle, yy = angular velocity, Hy=yH_y = y, −Hx=−sin⁡x-H_x = -\sin x) works. Its velocity field has divergence ∂x(Hy)+∂y(−Hx)=Hyx−Hxy=0\partial_x(H_y) + \partial_y(-H_x) = H_{yx} - H_{xy} = 0, 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 det⁡eAt=eTt\det e^{At} = e^{Tt}, and T=0T = 0 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 ∇⋅u=0\nabla\cdot\mathbf u = 0 lets us write u=ψy, v=−ψxu = \psi_y,\ v = -\psi_x for a stream function ψ(x,y)\psi(x,y) (existence from memory; the check that this u\mathbf u is divergence-free is the same cancellation ψyx=ψxy\psi_{yx} = \psi_{xy}). A fluid particle then follows a Hamiltonian system with H=ψH = \psi, so streamlines of a steady flow are level curves of ψ\psi. Take the cellular flow ψ=sin⁡xsin⁡y\psi = \sin x\sin y, i.e. u=sin⁡xcos⁡y, v=−cos⁡xsin⁡yu = \sin x\cos y,\ v = -\cos x\sin y. From (1,0.5)(1, 0.5) the particle has ψ=0.40342\psi = 0.40342, and block D finds max⁡∣ψ−ψ0∣=1.1×10−11\max|\psi - \psi_0| = 1.1\times10^{-11} after t=10t = 10 (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 ε>0\varepsilon \gt 0 there is a δ>0\delta \gt 0 such that every solution that starts within δ\delta of the origin stays within ε\varepsilon of it for all t≥0t \ge 0. It is asymptotically stable if in addition solutions starting near it tend to it. Picture a small disk of radius δ\delta inside a big disk of radius ε\varepsilon: 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 VV with V(0)=0V(0) = 0 and V>0V \gt 0 elsewhere near 00 (positive definite; its level sets are loops around the origin). Its derivative along solutions is V˙=∇V⋅f\dot V = \nabla V\cdot\mathbf f. The picture-proof of stability: given ε\varepsilon, choose a level cc below the smallest value of VV on the circle of radius ε\varepsilon; then the sublevel set {V<c}\{V \lt c\} lies inside the ε\varepsilon-disk, and pick δ\delta so that the δ\delta-disk lies in {V<c}\{V \lt c\}. If V˙≤0\dot V \le 0, a trajectory crosses level sets only inward (or runs along one), so it can never get out: it stays in {V<c}\{V \lt c\}, hence within ε\varepsilon.

Only semi-definite, then what? For the damped oscillator x′=y, y′=−2x−yx' = y,\ y' = -2x - y take the energy V=x2+12y2V = x^2 + \tfrac12y^2:

V˙=2xy+y(−2x−y)=−y2≤0.\dot V = 2xy + y(-2x - y) = -y^2 \le 0.

Energy never rises, so the origin is stable. But V˙=0\dot V = 0 whenever y=0y = 0, so V˙<0\dot V \lt 0 is not satisfied, and the theorem as stated gives only stability. LaSalle’s invariance principle (stated, not proved) repairs this: if VV has bounded sublevel sets and V˙≤0\dot V \le 0, every trajectory approaches the largest set that is itself invariant inside {V˙=0}\{\dot V = 0\}. Here {V˙=0}\{\dot V = 0\} is the xx-axis. A trajectory can stay on it only if y′=0y' = 0 there, but y′=−2xy' = -2x, which vanishes only at x=0x = 0. So the invariant set is the origin and every trajectory converges to it. Measured (sim, block A): from (1,0)(1,0), VV falls from 11 to 6.695×10−56.695\times10^{-5} at t=10t = 10 and V˙\dot V is 00 at the start (where y=0y = 0) and negative afterwards.

A strict Lyapunov function resolves a linearization failure

The previous lesson’s problem: x′=−y−x3, y′=x−y3x' = -y - x^3,\ y' = x - y^3 has a center in its linearization. Take V=x2+y2V = x^2 + y^2:

V˙=2x(−y−x3)+2y(x−y3)=−2(x4+y4)<0(x≠0).\dot V = 2x(-y - x^3) + 2y(x - y^3) = -2(x^4 + y^4) \lt 0 \quad (\mathbf x \neq 0).

So the origin is asymptotically stable: a proof with no eigenvalue anywhere. From (1,1)(1,1) the sim shows V(0)=2V(0) = 2, smallest V˙=−4=−2(1+1)\dot V = -4 = -2(1+1), and V=0.06511V = 0.06511 at t=10t = 10. The decay is slow because the cubic terms are tiny near 00: 12V2≤x4+y4≤V2\tfrac12V^2 \le x^4 + y^4 \le V^2 gives −2V2≤V˙≤−V2-2V^2 \le \dot V \le -V^2, so 1/V1/V grows at a rate between 11 and 22. Block B measures 1/V1/V going from 7.9077.907 to 15.35815.358 between t=5t = 5 and 1010, a rate of 1.491.49, inside the band.

The borderline family x′=−y+ax(x2+y2), y′=x+ay(x2+y2)x' = -y + ax(x^2 + y^2),\ y' = x + ay(x^2+y^2) with the same V=r2V = r^2:

V˙=2xx′+2yy′=2a(x2+y2)2=2ar4=2aV2.\dot V = 2x x' + 2y y' = 2a(x^2+y^2)^2 = 2a r^4 = 2aV^2.

For a<0a \lt 0: V˙<0\dot V \lt 0, asymptotically stable. For a>0a \gt 0: V>0V \gt 0 and V˙>0\dot V \gt 0 everywhere, so VV grows along every orbit, unstable. Solving V′=2aV2V' = 2aV^2 gives V(t)=V0/(1−2aV0t)V(t) = V_0/(1 - 2aV_0t), which is the previous lesson’s r′=ar3r' = ar^3 squared. Measured from (1,0)(1,0) at t=4t = 4 (sim, block C): V=0.55556V = 0.55556 for a=−0.1a = -0.1 (formula 1/1.81/1.8), 1.000001.00000 for a=0a = 0 (here V˙≡0\dot V \equiv 0, a true center), and 5.000005.00000 for a=+0.1a = +0.1 (formula 1/0.21/0.2); these are the squares of the radii 0.745360.74536 and 2.236072.23607 in the last lesson.

When the candidate fails. Try V=x2+y2V = x^2 + y^2 on the damped oscillator of the previous section:

V˙=2xy+2y(−2x−y)=−2xy−2y2.\dot V = 2xy + 2y(-2x - y) = -2xy - 2y^2.

At (1,−0.5)(1,-0.5) this is +0.5+0.5, so VV 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 (1,0)(1,0)) flags it: the largest V˙\dot V is 0.442580.44258, the flag fires at t=0.01t = 0.01, VV climbs from 11 to 1.158121.15812 at t=0.55t = 0.55, and it rises on 270 of the 1000 steps before decaying to 8.7×10−58.7\times10^{-5}. Lyapunov’s theorem only goes one way: finding a VV 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 x′=−∇V(x)\mathbf x' = -\nabla V(\mathbf x). Then

V˙=∇V⋅(−∇V)=−∣∇V∣2≤0,\dot V = \nabla V\cdot(-\nabla V) = -|\nabla V|^2 \le 0,

with equality only at critical points of VV. Consequences, each with a mechanism:

  • No periodic orbits. Around a closed orbit VV 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 V=−∫fV = -\int f, which is why x′=f(x)x' = f(x) can never oscillate.)
  • Equilibria are critical points of VV. The Jacobian is −∇2V-\nabla^2V (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 VV has positive Hessian eigenvalues, hence JJ has negative ones: a sink. A saddle of VV is a saddle of the flow.

Double well V=14(x2−1)2+12y2V = \tfrac14(x^2-1)^2 + \tfrac12y^2: x′=x−x3x' = x - x^3, y′=−yy' = -y. The Hessian is diag(3x2−1, 1)\mathrm{diag}(3x^2 - 1,\,1). At (±1,0)(\pm1, 0) it is diag(2,1)\mathrm{diag}(2, 1), so J=diag(−2,−1)J = \mathrm{diag}(-2,-1): two stable nodes. At (0,0)(0,0) it is diag(−1,1)\mathrm{diag}(-1, 1), so J=diag(1,−1)J = \mathrm{diag}(1,-1): a saddle with the yy-axis as stable direction, which separates the basins. In the sim, seeds (0.3,1)(0.3, 1) and (−0.3,1)(-0.3, 1) end at (+1,0)(+1, 0) and (−1,0)(-1, 0), with VV falling from 0.707030.70703 to 1.0×10−91.0\times10^{-9} and never once rising. A seed on the line x=0x = 0, (0,1)(0,1), stays on it and slides into the saddle, with V(10)=0.25000V(10) = 0.25000, the saddle’s height. Start at (0.05,1)(0.05, 1) instead and you end at (1,0)(1,0).

Numerics: what an integrator does to a conserved quantity

Take the pendulum x′=y, y′=−sin⁡xx' = y,\ y' = -\sin x from (1,0)(1, 0), so H0=−cos⁡1H_0 = -\cos 1, run to T=1000T = 1000 (the swing has period 6.7006.700, so about 149149 periods; block E prints both), and record H(T)−H0H(T) - H_0 and max⁡∣H−H0∣\max|H - H_0| over the run (sim: pendulum, set the integrator and hh; block E):

methodh=0.5h = 0.5: endmaxh=0.1h = 0.1: endmax
explicit Euler+19.280+19.28023.67923.679+48.560+48.56048.59148.591
RK4−0.12292-0.122920.122920.12292−4.578×10−5-4.578\times10^{-5}4.587×10−54.587\times10^{-5}
symplectic Euler−0.08439-0.084390.137450.13745+0.01301+0.013010.022620.02262

Euler gains energy until the pendulum is spinning over the top (the orbit leaves the oscillation region H<1H \lt 1). RK4 has a tiny but one-directional drift, and its error would keep growing with TT. Symplectic Euler (kick yn+1=yn+hF(xn)y_{n+1} = y_n + hF(x_n), then drift xn+1=xn+hyn+1x_{n+1} = x_n + hy_{n+1}; defined in 4.7 Energy & Symplectic Integrators) has a larger error at a given time but it oscillates and does not accumulate. Recall that H˙=∇H⋅f\dot H = \nabla H\cdot\mathbf f is 00 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 x′=y, y′=−xx' = y,\ y' = -x. One step is y1=y−hxy_1 = y - hx, x1=x+hy1x_1 = x + hy_1. Substitute and expand: Q=x2+y2−hxyQ = x^2 + y^2 - hxy satisfies x12+y12−hx1y1=x2+y2−hxyx_1^2 + y_1^2 - hx_1y_1 = x^2 + y^2 - hxy exactly. So the method conserves QQ exactly, though not H=12(x2+y2)H = \tfrac12(x^2+y^2): it follows an ellipse, a nearby level curve. And H−H0=12hxyH - H_0 = \tfrac12hxy on that ellipse, bounded by h/(4−2h)h/(4 - 2h) (maximum of xyxy on the ellipse, at x=yx = y). Measured over T=1000T = 1000 from (1,0)(1,0) (block E and the sim’s readout for “oscillator” + “symplectic Euler”): h=0.1h = 0.1 gives max⁡∣H−H0∣=0.026316\max|H - H_0| = 0.026316 (formula 0.1/3.8=0.0263160.1/3.8 = 0.026316) and max⁡∣Q−Q0∣=6.9×10−15\max|Q - Q_0| = 6.9\times10^{-15}; h=0.5h = 0.5 gives 0.166670.16667 and 4.1×10−154.1\times10^{-15}. For a general Hamiltonian the same statement is a nearby conserved H~=H+hH1+…\tilde H = H + h H_1 + \dots (backward error analysis; from memory), which is why the pendulum column stays bounded.

◆ Interactive Level curves of V, trajectories crossing them, and V(t), dV/dt along the active trajectory

Loading simulation…

What to try. (1) Damped oscillator, candidate energy, seed (1,0)(1,0): VV falls 1→6.7×10−51 \to 6.7\times10^{-5} and no flag; switch to the guess x2+y2x^2+y^2 and the flag fires. (2) Borderline system: a=−0.1,0,+0.1a = -0.1, 0, +0.1 and read V(4)V(4). (3) Pendulum: Euler, RK4, symplectic Euler, and h=0.5,0.1h = 0.5, 0.1, comparing V(t)−V(0)V(t) - V(0). (4) Gradient system: click on both sides of x=0x = 0.

Computing it

🐍 PythonLab: Hamiltonian checks, Lyapunov values, the failing candidate, drift of three integrators (blocks A to F)
⌘/Ctrl + Enter

Now implement the numerical Lyapunov test: integrate, evaluate V˙\dot V along the path, and decide.

🧪 Coding exerciseExercise: is V a Lyapunov function? Check dV/dt along RK4 trajectories
⌘/Ctrl + Enter

Concept checks

✅ Concept check

For $x' = -y - x^3,\ y' = x - y^3$ and $V = x^2 + y^2$, what is $\dot V$ at the point $(1,1)$ (compare the sim's smallest $\dot V$ for seed $(1,1)$)?

✅ Concept check

On the damped oscillator, $V = x^2 + y^2$ gives $\dot V = -2xy - 2y^2$, which is positive at $(1,-0.5)$. What can you conclude?

✅ Concept check

Why can a gradient system $\mathbf x' = -\nabla V$ have no periodic orbit?

✅ Concept check

Symplectic Euler on $x' = y,\ y' = -x$ with step $h = 0.5$: the bound on $\max|H - H_0|$ is $h/(4 - 2h)$. What is it?

Problems

✏️ Pen & paperDamped spring, in general●○○

For x′′+cx′+kx=0x'' + cx' + kx = 0 with c,k>0c, k \gt 0, write it as x′=y, y′=−kx−cyx' = y,\ y' = -kx - cy. Show that V=12y2+12kx2V = \tfrac12y^2 + \tfrac12kx^2 gives V˙=−cy2\dot V = -cy^2 and use LaSalle to conclude asymptotic stability.

Show worked solution

V˙=y(−kx−cy)+kxy=−cy2≤0\dot V = y(-kx - cy) + kxy = -cy^2 \le 0, so the origin is stable. V˙=0\dot V = 0 only on y=0y = 0. A solution that stays on y=0y = 0 for all time needs y′=−kx=0y' = -kx = 0, so x=0x = 0. The largest invariant set in {V˙=0}\{\dot V = 0\} is the origin, and VV has bounded sublevel sets (ellipses), so every trajectory tends to 00 (LaSalle, stated). For k=2, c=1k = 2,\ c = 1 this is the oscillator of the lab. (By hand; the lab computes the k=2, c=1k = 2,\ c = 1 case.)

✏️ Pen & paperBlow-up of the unstable borderline case●●○

For x′=−y+ax(x2+y2), y′=x+ay(x2+y2)x' = -y + ax(x^2+y^2),\ y' = x + ay(x^2+y^2) with a=0.1a = 0.1 and start (1,0)(1, 0), solve V′=2aV2V' = 2aV^2 for V=r2V = r^2 and find when the solution blows up.

Show worked solution

V′=2aV2V' = 2aV^2 is separable: −1/V=2at+C-1/V = 2at + C, and V(0)=1V(0) = 1 gives V(t)=1/(1−2at)V(t) = 1/(1 - 2at). With a=0.1a = 0.1 this is 1/(1−0.2t)1/(1 - 0.2t), which becomes infinite at t=5t = 5: finite-time blow-up, not just growth. At t=4t = 4 it is 1/0.2=51/0.2 = 5, matching the sim (which stops at t=4t = 4). For a=0.3a = 0.3 the blow-up time 1/0.6≈1.671/0.6 \approx 1.67 is before 44, and the sim says so. For a<0a \lt 0 the same formula decays like 1/(2∣a∣t)1/(2|a|t), algebraically and not exponentially.

✏️ Pen & paperThe double-well Hamiltonian●●●

Take H=12y2+14x4−12x2H = \tfrac12y^2 + \tfrac14x^4 - \tfrac12x^2, i.e. x′=y, y′=x−x3x' = y,\ y' = x - x^3. Find and classify the equilibria and the separatrix.

Show worked solution

Equilibria: y=0y = 0 and x−x3=0x - x^3 = 0, so (0,0)(0,0) and (±1,0)(\pm1, 0). J=(011−3x20)J = \begin{pmatrix}0&1\\1 - 3x^2&0\end{pmatrix} has T=0T = 0. At (0,0)(0,0): D=−1D = -1, a saddle. At (±1,0)(\pm1, 0): D=2D = 2, eigenvalues ±i2\pm i\sqrt2, non-hyperbolic, but HH has a strict minimum there (Hxx=2>0H_{xx} = 2 \gt 0), so the levels are closed ovals: true centers. The saddle has H=0H = 0, so the separatrix is y=±x1−x2/2y = \pm x\sqrt{1 - x^2/2}, a figure eight around the two centers. (By hand; not in the sim.)

Key Takeaways

  • HH is conserved when H˙=∇H⋅f=0\dot H = \nabla H\cdot\mathbf f = 0; orbits lie on level curves of HH (oscillator, pendulum H=12y2−cos⁡xH = \tfrac12y^2 - \cos x, Lotka–Volterra: measured H=2.30685H = 2.30685 at t=0t = 0 and 1010).
  • Hamiltonian systems x′=Hy, y′=−Hxx' = H_y,\ y' = -H_x have zero divergence: area is preserved, equilibria are saddles or centers. A 2D incompressible flow is Hamiltonian with H=ψH = \psi, so streamlines are level curves of ψ\psi.
  • Stable means “start within δ\delta, stay within ε\varepsilon”. VV positive definite with V˙≤0\dot V \le 0 traps trajectories in sublevel sets (stability); V˙<0\dot V \lt 0 gives asymptotic stability (stated); V˙≤0\dot V \le 0 plus LaSalle (stated) handles the damped oscillator, V˙=−y2\dot V = -y^2.
  • V=x2+y2V = x^2 + y^2 gives V˙=−2(x4+y4)\dot V = -2(x^4 + y^4) for x′=−y−x3, y′=x−y3x' = -y - x^3,\ y' = x - y^3, and V˙=2aV2\dot V = 2aV^2 for the borderline family: stable for a<0a \lt 0, unstable for a>0a \gt 0 (V(4)=0.55556V(4) = 0.55556 and 5.000005.00000 at a=∓0.1a = \mp0.1).
  • An indefinite V˙\dot V is inconclusive, not instability: x2+y2x^2 + y^2 on the damped oscillator has largest V˙=0.44258\dot V = 0.44258, while the energy works.
  • Gradient systems x′=−∇V\mathbf x' = -\nabla V have V˙=−∣∇V∣2\dot V = -|\nabla V|^2: no periodic orbits, minima of VV are sinks, saddles of VV are saddles.
  • Pendulum to T=1000T = 1000 at h=0.1h = 0.1: Euler gains +48.56+48.56, RK4 drifts −4.6×10−5-4.6\times10^{-5} one way, symplectic Euler stays within 0.02260.0226 because it conserves Q=x2+y2−hxyQ = x^2 + y^2 - hxy exactly on the oscillator. Next: 7.9 Limit Cycles & Hopf Bifurcations.
Finished this lesson?

Mark it complete to track your progress (saved in this browser). Reading every section does this for you.

Where this leads

These later lessons build directly on this one: