The BROYDEN function solves a system of n nonlinear equations (where n 2) in n dimensions using a globally-convergent Broyden's method. The result is an n -element vector containing the solution.
BROYDEN is based on the routine
broydn
described in section 9.7 of
Numerical Recipes in C: The Art of Scientific Computing
(Second Edition), published by Cambridge University Press, and is used by permission.
A scalar string specifying the name of a user-supplied IDL function that defines the system of non-linear equations. This function must accept a vector argument X and return a vector result.
For example, suppose we wish to solve the following system:
To represent this system, we define an IDL function named BROYFUNC:
RETURN, [3.0 * X[0] - COS(X[1]*X[2]) - 0.5,$
X[0]^2 - 81.0*(X[1] + 0.1)^2 + SIN(X[2]) + 1.06,$
BROYDEN calls an internal function named
fmin()
to determine whether the routine has converged to a local rather than a global minimum (see
Numerical Recipes
, section 9.7). Use the CHECK keyword to specify a named variable which will be set to 1 if the routine has converged to a local minimum or to 0 if not. If the routine does converge to a local minimum, try restarting from a different initial guess to obtain the global minimum.
Use this keyword to specify the scaled maximum step length allowed in line searches. The default value is 100.0.
We can use BROYDEN to solve the non-linear system of equations defined by the BROYFUNC function above:
X = [-1.0, 1.0, 2.0] ; Provide an initial guess as the algorithm's starting point.
result = BROYDEN(X, 'BROYFUNC') ; Compute the solution.
PRINT, result ; Print the result.
0.500000 -1.10731e-07 -0.523599
The exact solution (to eight-decimal accuracy) is [0.5, 0.0, -0.52359877].