Play with gradient descent

An explorable post: pick a step size and watch what happens.
Published

August 6, 2026

This post demonstrates the kind of interactivity your site can have. The math is real LaTeX, and the figure below responds live to the sliders — no backend, no server, just a static page on GitHub Pages.

The setup

Gradient descent on a simple quadratic f(x) = \tfrac{a}{2}\,x^2 iterates

x_{t+1} \;=\; x_t - \eta \, \nabla f(x_t) \;=\; (1 - \eta a)\, x_t .

The behavior depends entirely on the product \eta a: convergence when 0 < \eta a < 2, oscillation as it approaches 2, and divergence beyond it. Don’t take my word for it — try it:

The orange dot is the starting point; blue dots are the iterates. Push \eta past 2/a and watch it blow up.

Why this matters for your site

Everything above — the sliders, the live plot, the reactive text — is written directly in the blog post’s source file in ~40 lines of Observable JS. Quarto compiles it to a static page. Visitors get the ncase.me feeling of playing with an idea, and you never touch a web framework.