Nonlinear Systems - Newton's Method: An Example
Nonlinear Systems - Newton's Method: An Example
An Example
The LORAN (LOng RAnge Navigation) system calculates the position of a boat at sea using signals
from fixed transmitters. From the time differences of the incoming signals, the boat obtains dif-
ferences of distances to the transmitters. This leads to two equations each representing hyperbolas
defined by the differences of distance of two points (foci). An example of such equations from [2]
are:
x2 y2
− = 1 and
1862 3002 − 1862
(13.1)
(y − 500)2 (x − 300)2
2
− = 1.
279 5002 − 2792
Solving two quadratic equations with two unknowns, would require solving a 4 degree polynomial
equation. We could do this by hand, but for a navigational system to work well, it must do the
calculations automatically and numerically. We note that the Global Positioning System (GPS)
works on similar principles and must do similar computations.
Vector Notation
In general, we can usually find solutions to a system of equations when the number of unknowns
matches the number of equations. Thus, we wish to find solutions to systems that have the form:
f1 (x1 , x2 , x3 , . . . , xn ) = 0
f2 (x1 , x2 , x3 , . . . , xn ) = 0
f3 (x1 , x2 , x3 , . . . , xn ) = 0 (13.2)
..
.
fn (x1 , x2 , x3 , . . . , xn ) = 0.
As in Newton’s method for one variable, we need to start with an initial guess x0 . In theory, the more
variables one has, the harder it is to find a good initial guess. In practice, this must be overcome by
46
47
using physically reasonable assumptions about the possible values of a solution, i.e. take advantage
of engineering knowledge of the problem. Once x0 is chosen, let
∆x = x1 − x0 .
In the single variable case, Newton’s method was derived by considering the linear approximation
of the function f at the initial guess x0 . From Calculus, the following is the linear approximation
of f at x0 , for vectors and vector-valued functions:
Here Df (x0 ) is an n × n matrix whose entries are the various partial derivative of the components
of f . Specifically:
∂f ∂f1 ∂f1 ∂f1
1
(x0 ) ∂x (x0 ) ∂x (x0 ) ... ∂xn (x0 )
∂x1 2 3
∂f2 ∂f2 ∂f2 ∂f2
∂x1 (x0 ) ∂x2 (x0 ) ∂x3 (x0 ) ... ∂xn (x0 )
Df (x0 ) = . (13.3)
.. .. .. .. ..
.
. . . .
∂fn ∂fn ∂fn ∂fn
∂x1 (x0 ) ∂x2 (x0 ) ∂x3 (x0 ) ... ∂xn (x0 )
Newton’s Method
We wish to find x that makes f equal to the zero vectors, so let’s choose x1 so that
provided that the inverse exists. The formula is the vector equivalent of the Newton’s method for-
mula we learned before. However, in practice we never use the inverse of a matrix for computations,
so we cannot use this formula directly. Rather, we can do the following. First solve the equation
Since Df (x0 ) is a known matrix and −f (x0 ) is a known vector, this equation is just a system of
linear equations, which can be solved efficiently and accurately. Once we have the solution vector
∆x, we can obtain our improved estimate x1 by:
x1 = x0 + ∆x.
x3+y=1,
3
y −x=−1
4
0
y
−1
−2
−3
−4
−4 −3 −2 −1 0 1 2 3 4
x
Figure 13.1: Graphs of the equations x3 + y = 1 and y 3 − x = −1. There is one and only
one intersection; at (x, y) = (1, 0).
An Experiment
x3 + y = 1
(13.5)
y 3 − x = −1.
You can easily check that (x, y) = (1, 0) is a solution of this system. By graphing both of the
equations you can also see that (1, 0) is the only solution (Figure 13.1).
f1 (x1 , x2 ) = x31 + x2 − 1
(13.6)
f2 (x1 , x2 ) = x32 − x1 + 1.
or
x31 + x2 − 1
f (x) = . (13.7)
x32 − x1 + 1
Now that we have the equation in the vector form, write the following script program:
format long
f = inline(’[ x(1)^3+x(2)-1 ; x(2)^3-x(1)+1 ]’);
x = [.5;.5]
x = fsolve(f,x)
Save this program as myfsolve.m and run it. You will see that the internal Matlab solving
command fsolve approximates the solution, but only to about 7 demimal places. While that
would be close enough for most applications, one would expect that we could do better on such a
simple problem.
49
Next we will implement Newton’s method for this problem. Modify your myfsolve program to:
% mymultnewton
format long
n=8 % set some number of iterations, may need adjusting
f = inline(’[x(1)^3+x(2)-1 ; x(2)^3-x(1)+1]’); % the vector function
Df = inline(’[3*x(1)^2, 1 ; -1, 3*x(2)^2]’); % the matrix of partial derivatives
x = [.5;.5] % starting guess
for i = 1:n
Dx = -Df(x)\f(x); % solve for increment
x = x + Dx % add on to get new guess
f(x) % see if f(x) is really zero
end
Save and run this program (as mymultnewton) and you will see that it finds the root exactly (to
machine precision) in only 6 iterations. Why is this simple program able to do better than Matlab’s
built-in program?
Exercises
13.1 (a) Put the LORAN equations (13.1) into the function form (13.2).
(b) Construct the matrix of partial derivatives Df in (13.3).
(c) Adapt the mymultnewton program to find a solution for these equations. By trying
different starting vectors, find at least three different solutions. (There are actually four
solutions.) Think of at least one way that the navigational system could determine
which solution is correct.