Solution (source code)

= Solution

Here $f'(x)=4x^3-12x^2+4x+12$ and $f''(x)=12x^2-24x+4$. This implementation uses the undamped Newton step, checks a <stationary point>'s <second derivative>[curvature], and reports failure on a <two-cycle> or exhausted iteration limit:

``
R
newton_min <- function(x0, tol = 1e-10, maxit = 100L) {
  fp <- function(x) 4*x^3 - 12*x^2 + 4*x + 12
  fpp <- function(x) 12*x^2 - 24*x + 4
  x <- x0
  trace <- x
  for (k in seq_len(maxit)) {
    g <- fp(x)
    h <- fpp(x)
    if (abs(g) <= tol) {
      return(list(x = x, converged = h > 0,
                  reason = if (h > 0) "minimum" else "not a strict minimum",
                  trace = trace))
    }
    if (!is.finite(h) || abs(h) <= .Machine$double.eps)
      stop("Newton step has zero or invalid curvature")
    next_x <- x - g/h
    if (!is.finite(next_x)) stop("Nonfinite Newton iterate")
    trace <- c(trace, next_x)
    n <- length(trace)
    if (n >= 3L && abs(trace[n] - trace[n - 2L]) <= tol*(1 + abs(next_x)))
      return(list(x = next_x, converged = FALSE,
                  reason = "two-cycle", trace = trace))
    x <- next_x
  }
  list(x = x, converged = FALSE, reason = "iteration limit", trace = trace)
}
``

A sufficiently close start near $-0.7692923542$ converges to the <local minimum>[minimum]. The <derivative> cubic has exactly one real root: after $x=1+t$ it is proportional to $t^3-2t+2$, whose local <maximum> and <local minimum>[minimum] are both positive, so it crosses zero only once, on the left. Since the quartic tends to $+\infty$ in both directions and its <second derivative>[curvature] at that <stationary point> is positive, this is the unique <global minimum>. The function reports convergence rather than assuming that every starting point must reach it.