Skip to main content
ScienceVerse

Gradient Descent

Explore gradient descent optimisation interactively on a real quadratic loss landscape — adjust the starting point, learning rate and step count and watch the descent path converge or diverge live.

Gradient descent minimises a function by repeatedly stepping in the direction that reduces it fastest: xt+1 = xt − learning rate × f′(xt). This simulation runs it on a simple, known convex loss function, f(x) = x², whose minimum is at x = 0 and whose exact gradient is f′(x) = 2x — both hand-verifiable with a calculator, the standard toy example for teaching learning-rate behaviour (e.g. Boyd, S. & Vandenberghe, L., Convex Optimization, Cambridge University Press, 2004, §9.3). Substituting the gradient gives the update xt+1 = xt × (1 − 2 × learning rate) — a geometric sequence that provably converges to 0 when the learning rate is strictly between 0 and 1, and diverges (grows without bound) above 1. Computed by `@scienceverse/simulations-core`’s real, tested `gradient-descent` model, not an approximation invented for this page.

Three parameters — starting point, learning rate, and step count — are each adjustable within a scientifically valid range. The learning-rate slider deliberately spans well above the real instability threshold of 1 (up to 5), so you can watch both convergence and divergence directly rather than the range being clamped to only the “safe” values — PRD §12.1’s own learning outcome for this simulation is exactly “convergence/instability”. Every recomputation runs in a dedicated Web Worker, off the page’s main thread — genuinely necessary here, since step count can go up to 100,000 real iterations. A shareable link captures the exact current parameters. Readers whose browser cannot run canvas/SVG rendering, who prefer reduced motion, or who have JavaScript disabled see the real computed loss landscape and values below instead, in an accessible diagram and data table.

This interactive simulation is part of ScienceVerse Plus.

Everything you need to understand the idea is on this page. Plus and Family plans add the hands-on explorer, along with higher tutor limits, full guided learning paths and progress exports.

Sign in or create a free account to subscribe · Compare plans

Gradient Descent — ScienceVerse