Solution (source code)

= Solution

For scalar minimization, apply Newton's root-finding method to the stationarity equation $f'(x)=0$. Linearize $f'$ at the current point to obtain
$$
\boxed{x_{k+1}=x_k-\frac{f'(x_k)}{f''(x_k)}.}
$$
The iteration requires $f''(x_k)\ne0$. Near a nondegenerate <local minimum>, where $f'(x_*)=0$, $f''(x_*)>0$, suitable smoothness and a sufficiently close starting value give local convergence. A stationary limit must still be checked to be a <local minimum>[minimum]. This undamped method is not globally convergent and need not decrease $f$ at every step.