A1338 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

A13 · Lesson 38 · Optimization in one and several variables

Finding the lowest point, with and without derivatives

Choose resistor values to bring a filter's response closest to a template. Adjust a solar charger's operating voltage for maximum power. Tune a controller's gains to minimize overshoot, or a network's weights to minimize prediction error. Each is a minimization, and the methods mirror the root finders: a bracketing method that can't fail (golden-section search), derivative-based methods that are fast near the answer (gradient descent, Newton), and derivative-free ones for noisy measurements. The one new idea is the step size: too small and progress crawls, too large and the iteration oscillates or blows up.

  • Gradient descent on the bowl f=12(x2+κy2) from (1, 1), with a fixed step size η. The path joins the iterates xk+1=xk−η∇f(xk).
  • With a small η the path creeps down the gentle x direction. Raise η: the steep y direction starts to overshoot and zigzag, and past η=2/κ it diverges.
  • The best fixed step, η=21+κ, balances the two directions; the error then shrinks by κ−1κ+1 per step, the same as steepest descent's worst case.

Predict

A function's curvature (second derivative) along its steepest direction is 50. Above what fixed step size does gradient descent diverge?

Name it

One variable

  • Golden-section search: with a bracket a<c<b where f(c) is below both ends, evaluate at a point in the larger part and keep the sub-bracket that still has a low interior point. Placing points at the golden ratio shrinks the bracket by φ−1=0.618 per evaluation, guaranteed for a unimodal f.
  • Parabolic interpolation: fit a parabola through three points and jump to its vertex; superlinear near a smooth minimum. Brent's minimizer combines the two, as Brent's root finder does.
  • Newton: find a zero of f′: x←x−f′(x)f′′(x).

A minimum's location can only be found to about ε relative accuracy (about 8 digits in double), because near it f changes only quadratically: f(x*+δ)−f(x*)≈12f′′δ2 falls below rounding when δ is about ε.

Several variables

  • Gradient descent: x←x−η∇f. On a quadratic with Hessian eigenvalues from λmin to λmax, it's stable for η<2/λmax, and the best fixed step η=2λmin+λmax gives the factor κ−1κ+1.
  • Newton: solve HΔ=−∇f with the Hessian H; quadratic convergence near a minimum, but each step needs second derivatives and a linear solve.
  • Quasi-Newton (BFGS): build up an approximate Hessian from successive gradients; the usual choice for smooth problems of modest size.
  • Derivative-free (Nelder–Mead, perturb-and-observe): compare function values only; slow but robust to noise, as when the "function" is a measurement.

If f is convex, any local minimum is the global one. Otherwise, start from several points.

Worked example

How many golden-section evaluations shrink a bracket of width 5 to 10−6?

Show the solution
  1. Count the shrink factors. ln⁡(10−6/5)ln⁡0.618=32.05 so 33 evaluations.
  2. Compare with bisection. That's slower than bisection for roots (0.5 per step), but it needs no derivatives and can't be fooled by a unimodal function.

Answer 33 evaluations.

Worked example

Minimize f(x)=x4−3x by Newton's method from x = 1.

Show the solution
  1. The derivatives. f′=4x3−3f′′=12x2
  2. Newton's iterates. They are 1, 0.91667, 0.90863, 0.9085603, 0.908560296.
  3. The exact minimum. (3/4)1/3=0.9085603 reached quadratically.

Answer the minimum is at x=(3/4)1/3=0.9085603.

Worked example

Minimize f=x2+10y2 by gradient descent with the best fixed step. How fast does it converge?

Show the solution
  1. The Hessian. It is diag(2, 20).
  2. The best fixed step. η=2λmin⁡+λmax⁡=222=0.091
  3. The rate. The error then shrinks per step by κ−1κ+1=10−110+1=0.818
  4. Steps for six digits. ln⁡10−6ln⁡0.818=69 and the path zigzags across the long, narrow valley.
  5. Better methods. Newton's method, which uses the Hessian, would finish this quadratic in one step; conjugate gradients in two.

Answer with the best fixed step, 0.091, the error shrinks by 0.818 per step, so six digits take 69 steps.

Check

How many golden-section evaluations shrink a bracket of width 5 below 0.001?

Check

A quadratic's largest Hessian eigenvalue is 50. Above what fixed step size does gradient descent diverge?

Check

A quadratic's Hessian eigenvalues run from 1 to 10. What's the best fixed gradient-descent step?

Check

One Newton step toward the minimum of x4−3x from 1: what's the new x?

Check

To about what relative accuracy can a minimum's location be found in a 24-bit format?

Check

A solar charger must find its panel's maximum-power voltage from noisy power readings, with no formula for the panel. Which approach fits?

Check

Gradient descent with the best fixed step minimizes x2+10y2.

(a)

By what factor does the error shrink per step?

(b)

About how many steps gain 6 digits?

Check

A parabola goes through (−h,a), (0,b), (h,c), with a,c>b.

Step 1

Where is its minimum?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Explain why

Why does gradient descent with a fixed step converge slowly on an ill-conditioned problem?

Practice

Keep practicing

9 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.