Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

 Open In Colab

The efficiency and generalizability of the Newton-Raphson method makes it the go-to root finder for nonlinear system solvers.

NB: many people abbreviate ‘The Newton-Raphson method’ to simply ‘The Newton method’, but this causes confusion with Newton’s method for optimization which is related, but a different algorithm.

The Newton-Raphson method has quadratic convergence (k=2k=2) near the root which is a great result! It does so, however at the cost of calculating the Jacobian and solving a linear system.

As we saw in the previous lecture, Newton’s method amounts to using the current position and the (true) tangent to estimate the next guess:

f′(x)Δx=−f(x)f'(x) \Delta x = - f(x)

Graphically:

newton.png

Near the root, it converges quadratically, but there are some not-uncommon scenarios where it can fail.

Extensions which have greater than quadratic convergence using higher order derivative information do exist, however the additional computational cost is typically on par with another Newton-Raphson step, and therefore they are only used in certain niche applications.

The Newton-Raphson method only finds local roots, not all of them. Efficient and robust root finding requires a good initial guess.

Fortunately, in engineering, this is commonly the case!

Example of an initial guess

If we need to solve for temperature T(x,y,z,t)T(x,y,z,t) as a nonlinear, time dependent, partial differential equation, we will be given an initial value for T(x,y,z,t=0)T(x,y,z, t=0).

When solving a nonlinear equation for T(x,y,z,t=1)T(x,y,z,t=1), what do you suppose the initial guess should be?

Answer: The initial guess should be the solution at the preceding time step!

Example: find the root of x3−2x+2x^3-2x+2

There is a real root at x~-1.769.

Example: Find the root of x\sqrt{x}

Some common failure situations

What went wrong in the previous example? What else could we try?

Untitled.png

Before we talk about mitigation strategies, let’s generalize the Newton-Raphson method to N-D.

The N-D Newton-Raphson method

The Newton-Raphson method thus far has been described for scalar functions or scalar arguments (i.e.: 1-D).

Consider a system of nn unkowns x⃗\vec{x} and a set of nn nonlinear equations that we wish to solve simultaneously:

f1(x⃗)=0f2(x⃗)=0⋮fn(x⃗)=0\begin{align} f_1(\vec{x}) &= 0 \\ f_2(\vec{x}) &= 0 \\ \vdots \\ f_n(\vec{x}) &= 0 \end{align}

which may be summarized as a vector function f⃗(x⃗)=0⃗\vec{f}(\vec{x})=\vec{0} also of dimension nn. Since we have nn equations and nn unkowns, we can (hopefully) find an exact solution of the simultaneous set of equations, i.e.: a root.

The Newton-Raphson method generalizes quite readily except the derivative must be replaced by the vector-derivative of a vector function (called the Jacobian):

J=∂f⃗∂x⃗=[∂f1∂x1∂f1∂x2…∂f1∂xn∂f2∂x1∂f2∂x2…∂f2∂xn⋮⋮⋱⋮∂fn∂x1∂fn∂x2…∂fn∂xn]J = \frac{\partial \vec{f}}{\partial \vec{x}} = \begin{bmatrix} \frac{\partial f_1}{\partial x_1} & \frac{\partial f_1}{\partial x_2} & \dots & \frac{\partial f_1}{\partial x_n} \\ \frac{\partial f_2}{\partial x_1} & \frac{\partial f_2}{\partial x_2} & \dots & \frac{\partial f_2}{\partial x_n} \\ \vdots & \vdots & \ddots & \vdots \\ \frac{\partial f_n}{\partial x_1} & \frac{\partial f_n}{\partial x_2} & \dots & \frac{\partial f_n}{\partial x_n} \end{bmatrix}

where we can see that JJ is a square n×nn \times n matrix. The Newton-Raphson method takes the form:

JΔx⃗=−f⃗J \Delta \vec{x} = - \vec{f}

which is .... (wait for it!)... a linear system solving for the vector of increments, Δx⃗\Delta\vec{x}!

This is an example of computational-thinking: we have broken down a muiltivariable non-linear vector function into a sequence of linear systems!

Example: solve a system of nonlinear equations

x2+y2−z=1x−y2+z2=1xyz=1\begin{align} x^2 + y^2 - z &= 1 \\ x - y^2 + z^2 &= 1 \\ x y z &= 1 \end{align}

Rewrite the equations as a system of nonlinear functions:

f⃗(x⃗)=[f1(x,y,z)f2(x,y,z)f3(x,y,z)]=[x2+y2−z−1x−y2+z2−1xyz−1]=0⃗\vec{f}(\vec{x}) = \begin{bmatrix} f_1(x, y, z) \\ f_2(x, y, z) \\ f_3(x, y, z) \end{bmatrix} = \begin{bmatrix} x^2 + y^2 - z - 1 \\ x - y^2 + z^2 -1 \\ x y z - 1 \end{bmatrix} =\vec{0}

The Jacobian is:

J=∂f⃗∂x⃗=[2x2y−11−2y2zyzxzxy]J = \frac{\partial \vec{f}}{\partial \vec{x}} = \begin{bmatrix} 2x & 2y & -1 \\ 1 & -2y & 2z \\ yz & xz & xy \end{bmatrix}

Now for a given x⃗\vec{x} we can solve for the increment.

Exploring initial guesses

Open methods are more robust and general but compared to closed methods we loose robustness and the obvious progression towards a root (consider bracketting narrowing in).

Open methods are more succeptable to initial guess issues.

A root!

Let’s try a few different initial guesses to see how the method behaves.

Note something is funny with the residual...

Another root

Let’s try another initial guess.

Another?

And another?

Note what’s happening to guesses and the residual... odd behaviour indeed!