You are on page 1of 4

METHODS FOR SOLVING NONLINEAR EQUATIONS

Yingwei Wang
Department of Mathematics, Purdue University, West Lafayette, IN

wywshtj@gmail.com

1 Newton’s method
1.1 Single equation
Find the positive minimum point of the function f (x) = x−2 tan x by computing the zeros of
f ′ using Newton’s method.

1 + (tan x)2 2 tan x


f ′ (x) = − , (1.1)
x2 x3
1 + (tan x)2 1 + (tan x)2 tan x
f ′′ (x) = 2 tan x 2
− 4 3
+6 4 . (1.2)
x x x

Newton’s method is used to find the solution of f ′ (x) = 0 as follows:

f ′ (xk )
xk+1 = xk − . (1.3)
f ′′ (xk )

The stopping criteria for the iteration (1.3) is that the iterates change by at most tol, i.e.
if δ(xk ) = |f ′ (xk )/f ′′ (xk )| < tol then the iteration should be stopped.
Setting the initial guess as x0 = 1 and the tolerance as tol = 1e − 16, we can get Table 1.
The final result of computation is x = 0.9477471335169905.

Table 1: Result v.s. iteration step (x0 = 1, tol = 1e − 16)


Step Results δ(xk−1 )
1 0.9507775586393128 4.9222e-002
2 0.9477544406219145 3.0231e-003
3 0.9477471335583871 7.3071e-006
4 0.9477471335169905 4.1397e-011
5 0.9477471335169905 0.0000e-000

I
Yingwei Wang Computer Project #1

1.2 System of equations


Find the roots of the following system:

x + e−x + y 3 = 0

(1.4)
x2 + 2xy − y 2 + tan x = 0.

Let F (X) = 0 denote the system of equation (2.1).


Taking partial derivative, we get the Jacobian matrix:

3y 2
 
1 − e−x
J= .
2x + 2y + 1 + (tan x)2 2x − 2y

Newton’s method is used to find the solution of F (X) = 0 as follows:

Xk+1 = Xk − J −1 F (Xk ). (1.5)

The stopping criteria for the iteration (1.5) is that the iterates change by at most tol in
the sense of 2-norm, i.e. if δ(Xk ) = kJ −1 F (Xk )k2 < tol then the iteration should be stopped.
Setting the initial guess as X0 = [3, −1.5] and the tolerance as tol = 1e − 14, we can get
Table 2. The final result of computation is x = 3.13244796038883, y = −1.46992840120343.

2 Secant method
Use the secant method to solve the problem in Section 1.1.
The algorithm is:
xk − xk−1
xk+1 = xk − ′ . (2.1)
f (xk ) − f ′ (xk−1 )
The stopping criteria for the iteration (2.1) is that the residue is less than tol, i.e. if
f ′ (xk ) < tol then the iteration should be stopped.
Setting the initial guess as x0 = 2, x1 = 1 and the tolerance as tol = 1e − 16, we can get
Table 1. The final result of computation is x = 0.9477471335169905.

3 Newton’s method and Horner’s algorithm for polynomials


Find the two roots of the following polynomial near x = 0.1:

p(x) = 2x4 + 24x3 + 61x2 − 16x + 1. (3.1)

The Newton’s method for equation p(x) = 0 is that


p(zk )
zk+1 = zk − , (3.2)
p′ (zk )

II
Yingwei Wang Computer Project #1

Table 2: Result v.s. iteration step (X0 = [3, −1.5], tol = 1e − 14)
Step xk yk δ(Xk−1 )
1 3.09405751233401 -1.46506099746738 1.0034e-001
2 3.11962295212265 -1.46803802432041 2.5738e-002
3 3.12813825392599 -1.46929314301517 8.6073e-003
4 3.13099681903632 -1.46971436328342 2.8894e-003
5 3.13195900191164 -1.46985626625034 9.7259e-004
6 3.13228316839025 -1.46990408805527 3.2767e-004
7 3.13239241670524 -1.46992020617795 1.1043e-004
8 3.13242923870766 -1.46992563894675 3.7221e-005
9 3.13244164995924 -1.46992747013991 1.2546e-005
10 3.13244583335535 -1.46992808737295 4.2287e-006
11 3.13244724343669 -1.46992829542159 1.4253e-006
12 3.13244771872806 -1.46992836554788 4.8044e-007
13 3.13244787893300 -1.46992838918512 1.6194e-007
14 3.13244793293277 -1.46992839715246 5.4584e-008
15 3.13244795113431 -1.46992839983798 1.8399e-008
16 3.13244795726944 -1.46992840074318 6.2016e-009
17 3.13244795933739 -1.46992840104830 2.0903e-009
18 3.13244796003443 -1.46992840115114 7.0458e-010
19 3.13244796026938 -1.46992840118580 2.3749e-010
20 3.13244796034857 -1.46992840119749 8.0050e-011
21 3.13244796037526 -1.46992840120143 2.6982e-011
22 3.13244796038426 -1.46992840120275 9.0949e-012
23 3.13244796038729 -1.46992840120320 3.0658e-012
24 3.13244796038832 -1.46992840120335 1.0330e-012
25 3.13244796038866 -1.46992840120340 3.4821e-013
26 3.13244796038878 -1.46992840120342 1.1696e-013
27 3.13244796038882 -1.46992840120343 3.9410e-014
28 3.13244796038883 -1.46992840120343 1.3462e-014
29 3.13244796038883 -1.46992840120343 4.3104e-015

Table 3: Result v.s. iteration step (x0 = 2, x1 = 1, tol = 1e − 16)


Step Results f ′ (xk )
1 0.8149646022426774 7.1978e-001
2 0.9442098076297187 1.9937e-002
3 0.9475737788916827 9.7954e-004
4 0.9477476012222865 2.6431e-006
5 0.9477471334541808 3.5495e-010
6 0.9477471335169905 0.0000e-000

III
Yingwei Wang Computer Project #1

Table 4: Result v.s. iteration step (x10 = 0.1, tol = 1e − 15)


Step Results δ(x1k−1 )
1 0.111132812500000 1.1133e-002
2 0.116647800537879 5.5150e-003
3 0.119361432635544 2.7136e-003
4 0.120648084769187 1.2867e-003
5 0.121176046638742 5.2796e-004
6 0.121310310049290 1.3426e-004
7 0.121320287832379 9.9778e-006
8 0.121320343557905 5.5726e-008
9 0.121320343559642 1.7379e-012
10 0.121320343559643 8.8895e-016

Table 5: Result v.s. iteration step (x20 = x1 + 1e − 3, tol = 1e − 15)


Step Results δ(x2k−1 )
1 0.125982396571963 3.6621e-003
2 0.124204512620500 1.7779e-003
3 0.123409023856408 7.9549e-004
4 0.123144132042746 2.6489e-004
5 0.123106422317392 3.7710e-005
6 0.123105625973105 7.9634e-007
7 0.123105625617660 3.5544e-010
8 0.123105625617660 0.0000e-000

where the p(z) and p′ (z) are computed by the Horner’s algorithm:

βk−1 = αk + zβk ,
(3.3)
αk−1 = ak−1 + zαk ,

where k = n : −1 : 1, (ak )nk=0 is the coefficients of polynomial p(z) = an z n + · · · + a1 x + a0


and the initial value is αn = an , βn = 0.
The stopping criteria and tolerance here are the same as Section 1.1. The final results is
z 1 = 0.121320343559643, z 2 = 0.123105625617660. The detailed results are in Table 4 and
Table 5. Note that the initial guess for z 1 is z01 = 0.1; after we get the smaller root z 1 , we
will set z02 = z1 + 1e − 3 as the initial guess of z 2 .

IV

You might also like