next up previous index
Next: C202 Zeros of Up: CERNLIB Previous: C200 Zero of

C201 Numerical Solution of Systems of Nonlinear Equations

Routine ID: C201
Author(s): Library: MATHLIB
Submitter: K.S. KölbigSubmitted: 01.06.1989
Language: FortranRevised: 01.12.1994

Subroutine subprograms RSNLEQ and DSNLEQ compute a vector xi,(i=1,2,...,n) , which approximates an exact solution xi* of the system of n nonlinear equations with n unknowns

Fi(x1,...,xn)=0,&quad;(i=1,2,...,n).

These subroutines incorporate two convergence test, making use of arguments FTOL and XTOL respectively. If xi,(i=1,2,...,n) , denotes the result of the current iteration, and xi' the result of the previous iteration, the calculation is terminated if either of the following tests is successful:

Test 1 : &quad;max|Fi(x1,...,xn)|≤FTOL,

Test 2 : &quad;max|xi-xi'| ≤XTOL*max|xi|,

where the maxima are taken over 1≤i≤n.

On computers other than CDC and Cray, only the double-precision version DSNLEQ is available. On CDC and Cray computers, only the single-precision version RSNLEQ is available.

Structure:

SUBROUTINE subprograms
User Entry Names : RSNLEQ, DSNLEQ
Obsolete User Entry Names : SNLEQ RSNLEQ
Files Referenced : Unit 6
External References: User-supplied SUBROUTINE subprogram

Usage:

For t=R (type REAL), t=D (type DOUBLE PRECISION),

    CALL tSNLEQ(N,X,F,FTOL,XTOL,MAXF,IPRT,INFO,SUB,W)
N
( INTEGER) Number n of equations and variables.
X
(type according to t) One-dimensional array of length N. On entry, X(i),(i=1,...,N) , must contain an estimate to a solution xi* of the system of equations. On exit, X(i) contains the final estimate to xi* .
F
(type according to t) One-dimensional array of length N. On exit, F(i),(i=1,...,N) , contains the final value of the residual Fi(X(1),...,X(N)) .
FTOL
(type according to t) Accuracy parameter for Test 1.
XTOL
(type according to t) Accuracy parameter for Test 2.
MAXF
( INTEGER) Maximum permitted number of iterations, where each iteration involves N calls to the user-supplied subroutine SUB. The recommended value for MAXF is 50*(N+3).
IPRT
( INTEGER) If IPRT=0 no intermediate results are printed. If IPRT=1 the values of i and X(i),(i=1,2,...,n) , are printed after each iteration.
INFO
( INTEGER) On exit, the value of INFO shows the reason why execution was terminated as follows:
0
Unacceptable input arguments (N < 1

or FTOL ≤0 or XTOL ≤0) .

1
Test 1 is successful.
2
Test 2 is successful.
3
Test 1 and Test 2 are both successful.
4
Number of iterations is MAXF .
5
Approximate (finite difference) Jacobian matrix is singular
6
Iterations are not making good progress.
7
Iterations are diverging.
8
Iterations are converging, but either (i) XTOL is too small, or (ii) convergence is very slow because the Jacobian is nearly singular near xi* or because the variables xi are badly scaled.
SUB
Name of a user-supplied SUBROUTINE subprogram, declared EXTERNAL in the calling program.
W
(type according to t) Array containing at least N*(N+3) elements required as working-space.

The user-supplied subroutine SUB should be of the form

SUBROUTINE SUB(N,X,F,K)
DIMENSION X(*),F(*)
...
Statements which set F(K) equal to the value of FK(X(1),...,X(N)) without changing any other element of array F.
...
RETURN
END
where X and F should be of type according to t.

Subroutine SUB should not change the value of the argument K unless the user wants to terminate the execution of tSNLEQ, in which case K should be set equal to a negative integer, whose value will be copied into argument INFO of tSNLEQ before exit.

Method:

A modification of Brent's method as described in Ref. 1.

Error handling:

See description of argument INFO.

Notes:

  1. Whenever possible the equations Fi=0 should be numbered in order of increasing nonlinearity.
  2. These subroutines do not use any techniques which attempt to obtain global convergence. Convergence may therefore fail to occur if the initial estimate is too far from an exact solution.

This subroutine has been adapted from the Fortran program published in Ref. 2.

References:

  1. J.J. Moré and M.Y. Cosnard, Numerical solution of nonlinear equations, ACM Trans. Math. Software 5 (1979) 64--85.
  2. J.J. Moré and M.Y. Cosnard, Algorithm 554 BRENTM, A FORTRAN subroutine for the numerical solution of systems of nonlinear equations, Collected Algorithms from CACM (1980).

C202



next up previous index
Next: C202 Zeros of Up: CERNLIB Previous: C200 Zero of


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995