This demo attempts to find the minimum and maximum value of a (differentiable) function constrained to a closed interval.
Specifically, given $f(x)$ (entered in a text box) and an interval $a \leq x \leq b$, this demo computes $f'(x)$ and then attemps to solve $f'(x)=0$. Once the critical points are determined, "irrelevant" points (outside our interval) are discarded. The list of relevant points as well as the interval's endpoints are then plugged into $f(x)$ to determine the maximum and minimum values of $f(x)$ on that interval. If desired, a plot is displayed with the critical points and endpoints highlighted.
You may either select a built-in demo or enter an example of your own. A check box at the bottom of the demo determines whether a plot is displayed or not. The plot's domain defaults to the optimization intereval, but it can be adjusted in the box provided at the bottom of the demo. If you change an entry, simply click outside the box to have Sage recompute the plots and displayed values.
WARNING: Sage's numerical solver is finicky. It will occasionally miss solutions of $f'(x)=0$. In other words, be skeptical of the computed results.
The computation above is powered by SageMath. The Sage code is embedded in this webpage's html file. To view the code instruct your browser to show you this page's source. For example, in Chrome, right-click and choose "View page source".