convex-functions

← ~/visualizations

convex-functions #

Shows convexity two ways on a 1D slice: (top) the chord between (x,f(x)) and (y,f(y)) stays above the graph, so f(tx+(1-t)y) <= t f(x)+(1-t) f(y). (bottom) a moving tangent line at x0 supports the function from below, illustrating f(y) >= f(x0) + f'(x0)(y-x0). Animated points and vertical gaps make both inequalities visually explicit, highlighting their equivalence under differentiability.

canvasclick to interact

⏮◀◀▶▶STEP0.25x1xZOOM

t=0s

practical uses #

technical notes #

Pure Canvas2D, green-on-black blocky rendering via grid snapping and pixel-stamped lines. Time-based animation cycles endpoints (x,y) and interpolation parameter t (0..1) over ~4s; a second sweep animates the supporting-line test point. Uses a smooth strongly convex polynomial f(x)=0.28x^2+0.10x^4 with analytic derivative for the tangent.

← what-is-an-algorithmprincipal-component-analysis →