The Newton-Raphson Method

Contents

The Newton-Raphson Method#

An alternative method for finding the minimum of a function is the Newton-Raphson Method (also called Newton’s Method).

The central idea here is that if we zoom in on any function, then we can approximate the local shape of that function as quadratic, i.e.

\[f(x) \approx ax^2 + bx + c\]

over some small range of \(x\).

If \(f(x)\) has a minimum, then at that point

\[f^{\prime\prime}(x) = 0\]

and, if we know the coefficients \(a\) and \(b\), then we can directly calculate the value of \(x\) that minimises our function.

\[f^{\prime\prime}(x) = 2ax + b = 0\]
\[x = \frac{-b}{2a}\]

To find the value of the coefficients \(a\) and \(b\), we use the property that any function can be expanded as a Taylor series (see, e.g., Chapter 6 in Foundations of Science Mathematics).

If we are at some point \(x_0\), then we can approximate our function locally as a polynomial in \((x-x_0)\):

\[f(x) = f(x_0) + f^\prime(x_0)(x-x_0) + \frac{1}{2}f^{\prime\prime}(x_0)(x-x_0)^2 + \ldots\]

And, if we remain close to \(x_0\), where the higher order terms in \((x-x_0)\) are small, we have the approximation that

\[f(x) \approx f(x_0) + f^\prime(x_0)(x-x_0) + \frac{1}{2}f^{\prime\prime}(x_0)(x-x_0)^2\]

i.e., we approximate \(f(x)\) as quadratic.

Differentiating this approximate expression with respect to \(x\)gives:

\[f^\prime(x) = f^\prime + f^{\prime\prime}(x - x_0) = 0\]

and setting this to zero allows us to solve for \(x\):

\[x = x_0 - \frac{f^\prime(x_0)}{f^{\prime\prime}(x_0)}\]

In the context of finding the minimum of a potential energy surface, this looks like:

  1. Starting at an initial guess, \(r_n\), calculate the first and second derivatives of \(U(r_n)\) at that point.

  2. Use the Newton-Raphson equation \(r_{n+1} = r_n - U^\prime(r_n) / U^{\prime\prime}(r_n)\) to predict the position of the minimum.

In reality, our potential energy surface is never exactly quadratic (except for the special case of a harmonic potential), so step 2. only gives us an approximate guess for the minimum position. We then repeat steps 1. and 2. as an iterative process, until we (hopefully) converge on the energy minimum.

Exercise#

  1. Write a function to calculate the second derivative of a harmonic potential:

\[U^{\prime\prime} = 2k\]
  1. Show that the Newton-Raphson method finds the optimal bond length for your harmonic potential in one step, irrespective of your starting point.