2D Phase Portrait (ODE)

A phase portrait for a planar autonomous ordinary differential equation plots the state (x, y) and shows how it evolves under x′ = f(x, y) and y′ = g(x, y) without displaying time explicitly. This simulator draws a uniform grid of short arrows whose directions match the vector field (f, g), normalized for readability so you can read the flow at a glance. Clicking inside the plot seeds a fourth-order Runge–Kutta integrator that marches both forward and backward in time until the trajectory leaves an expanded viewport, building a single curve through the clicked point. Presets include the undamped harmonic oscillator (elliptic orbits around a center), a damped linear oscillator whose damping ratio ζ controls decay to a stable spiral, a hyperbolic saddle with separatrices, stable and unstable nodes, stable and unstable spirals from fixed 2×2 linearizations, and the ideal pendulum written as θ′ = ω, ω′ = −sin θ so x is angle and y is angular velocity. Equilibrium locations are marked with small dots. The tool is intentionally lightweight: no bifurcation scanning, no nullclines, and no detection of limit cycles—those are natural follow-ons after students grasp orbits in the plane.

Who it's for: Undergraduate ODE or dynamical systems students learning equilibria, linearization, and qualitative behavior before quantitative time-series plots.

Key terms

  • Phase plane
  • Autonomous ODE
  • Vector field
  • Trajectory
  • Equilibrium
  • Saddle
  • Spiral
  • Center
  • Runge–Kutta

How it works

The phase plane plots (x, y) for a planar autonomous system x′ = f(x, y), y′ = g(x, y). A direction field shows the tangent to trajectories; clicking seeds a high-order Runge–Kutta integration forward and backward in time. Presets include the harmonic oscillator (center), damped oscillator (stable spiral when ζ > 0), a saddle, stable and unstable nodes, stable and unstable spirals from a fixed linearization, and the undamped pendulum angle–angular velocity system.

Key equations

x′ = f(x, y), y′ = g(x, y)
Harmonic: x′ = y, y′ = −ω²x
Pendulum: θ′ = ω, ω′ = −sin θ

Frequently asked questions

Why do some trajectories stop at the edge of the window?
Integration halts when the state leaves a slightly expanded box around the visible axes. That keeps the numeric solution from running forever on unbounded orbits (for example along unstable manifolds of a saddle) and keeps the display responsive.
Why does the damped preset look like a center when ζ = 0?
With ζ = 0 the equations reduce to the same undamped harmonic form as the harmonic preset (up to the shared ω scaling). Any tiny ζ > 0 breaks the closed loops and produces a spiral in toward the origin for this linear model.
What do the yellow dots mean?
They mark equilibrium points where f = g = 0 at the resolution of the model. The origin is always shown for the linear presets; the pendulum preset also marks ±π on the angle axis where sin θ = 0.
Is this a substitute for a full ODE solver or bifurcation tool?
No. It is a visual sketchpad: fixed viewing window, fixed step RK4, no error control, no phase or eigenvalue readouts beyond what you infer from the picture. Use a dedicated solver for publication-quality plots or parameter scans.