⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 minpack-documentation.txt

📁 该程序实现了非线性最小二乘问题和非线性方程组的解法
💻 TXT
📖 第 1 页 / 共 5 页
字号:
       *        5X,27H FINAL APPROXIMATE SOLUTION // (5X,3D15.7))  C  C     LAST CARD OF DRIVER FOR HYBRD EXAMPLE.  C        END        SUBROUTINE FCN(N,X,FVEC,IFLAG)        INTEGER N,IFLAG        DOUBLE PRECISION X(N),FVEC(N)  C  C     SUBROUTINE FCN FOR HYBRD EXAMPLE.  C        INTEGER K        DOUBLE PRECISION ONE,TEMP,TEMP1,TEMP2,THREE,TWO,ZERO        DATA ZERO,ONE,TWO,THREE /0.D0,1.D0,2.D0,3.D0/  C        IF (IFLAG .NE. 0) GO TO 5  C  C     INSERT PRINT STATEMENTS HERE WHEN NPRINT IS POSITIVE.  C        RETURN      5 CONTINUE        DO 10 K = 1, N           TEMP = (THREE - TWO*X(K))*X(K)           TEMP1 = ZERO           IF (K .NE. 1) TEMP1 = X(K-1)           TEMP2 = ZERO           IF (K .NE. N) TEMP2 = X(K+1)           FVEC(K) = TEMP - TEMP1 - TWO*TEMP2 + ONE     10    CONTINUE        RETURN  C  C     LAST CARD OF SUBROUTINE FCN.  C        END        Results obtained with different compilers or machines        may be slightly different.        FINAL L2 NORM OF THE RESIDUALS  0.1192636D-07        NUMBER OF FUNCTION EVALUATIONS        14                                                                   Page        EXIT PARAMETER                         1        FINAL APPROXIMATE SOLUTION        -0.5706545D+00 -0.6816283D+00 -0.7017325D+00        -0.7042129D+00 -0.7013690D+00 -0.6918656D+00        -0.6657920D+00 -0.5960342D+00 -0.4164121D+00                                                                     Page               Documentation for MINPACK subroutine HYBRJ1                         Double precision version                       Argonne National Laboratory          Burton S. Garbow, Kenneth E. Hillstrom, Jorge J. More                                March 1980   1. Purpose.        The purpose of HYBRJ1 is to find a zero of a system of N non-        linear functions in N variables by a modification of the Powell        hybrid method.  This is done by using the more general nonlinear        equation solver HYBRJ.  The user must provide a subroutine which        calculates the functions and the Jacobian.   2. Subroutine and type statements.        SUBROUTINE HYBRJ1(FCN,N,X,FVEC,FJAC,LDFJAC,TOL,INFO,WA,LWA)        INTEGER N,LDFJAC,INFO,LWA        DOUBLE PRECISION TOL        DOUBLE PRECISION X(N),FVEC(N),FJAC(LDFJAC,N),WA(LWA)        EXTERNAL FCN   3. Parameters.        Parameters designated as input parameters must be specified on        entry to HYBRJ1 and are not changed on exit, while parameters        designated as output parameters need not be specified on entry        and are set to appropriate values on exit from HYBRJ1.        FCN is the name of the user-supplied subroutine which calculate          the functions and the Jacobian.  FCN must be declared in an          EXTERNAL statement in the user calling program, and should be          written as follows.          SUBROUTINE FCN(N,X,FVEC,FJAC,LDFJAC,IFLAG)          INTEGER N,LDFJAC,IFLAG          DOUBLE PRECISION X(N),FVEC(N),FJAC(LDFJAC,N)          ----------          IF IFLAG = 1 CALCULATE THE FUNCTIONS AT X AND          RETURN THIS VECTOR IN FVEC.  DO NOT ALTER FJAC.          IF IFLAG = 2 CALCULATE THE JACOBIAN AT X AND          RETURN THIS MATRIX IN FJAC.  DO NOT ALTER FVEC.          ----------          RETURN          END          The value of IFLAG should not be changed by FCN unless the                                                                   Page          user wants to terminate execution of HYBRJ1.  In this case set          IFLAG to a negative integer.        N is a positive integer input variable set to the number of          functions and variables.        X is an array of length N.  On input X must contain an initial          estimate of the solution vector.  On output X contains the          final estimate of the solution vector.        FVEC is an output array of length N which contains the function          evaluated at the output X.        FJAC is an output N by N array which contains the orthogonal          matrix Q produced by the QR factorization of the final approx-          imate Jacobian.  Section 6 contains more details about the          approximation to the Jacobian.        LDFJAC is a positive integer input variable not less than N          which specifies the leading dimension of the array FJAC.        TOL is a nonnegative input variable.  Termination occurs when          the algorithm estimates that the relative error between X and          the solution is at most TOL.  Section 4 contains more details          about TOL.        INFO is an integer output variable.  If the user has terminated          execution, INFO is set to the (negative) value of IFLAG.  See          description of FCN.  Otherwise, INFO is set as follows.          INFO = 0  Improper input parameters.          INFO = 1  Algorithm estimates that the relative error between                    X and the solution is at most TOL.          INFO = 2  Number of calls to FCN with IFLAG = 1 has reached                    100*(N+1).          INFO = 3  TOL is too small.  No further improvement in the                    approximate solution X is possible.          INFO = 4  Iteration is not making good progress.          Sections 4 and 5 contain more details about INFO.        WA is a work array of length LWA.        LWA is a positive integer input variable not less than          (N*(N+13))/2.   4. Successful completion.        The accuracy of HYBRJ1 is controlled by the convergence                                                                   Page        parameter TOL.  This parameter is used in a test which makes a        comparison between the approximation X and a solution XSOL.        HYBRJ1 terminates when the test is satisfied.  If TOL is less        than the machine precision (as defined by the MINPACK function        DPMPAR(1)), then HYBRJ1 only attempts to satisfy the test        defined by the machine precision.  Further progress is not usu-        ally possible.  Unless high precision solutions are required,        the recommended value for TOL is the square root of the machine        precision.        The test assumes that the functions and the Jacobian are coded        consistently, and that the functions are reasonably well        behaved.  If these conditions are not satisfied, then HYBRJ1 ma        incorrectly indicate convergence.  The coding of the Jacobian        can be checked by the MINPACK subroutine CHKDER.  If the Jaco-        bian is coded correctly, then the validity of the answer can be        checked, for example, by rerunning HYBRJ1 with a tighter toler-        ance.        Convergence test.  If ENORM(Z) denotes the Euclidean norm of a          vector Z, then this test attempts to guarantee that                ENORM(X-XSOL) .LE. TOL*ENORM(XSOL).          If this condition is satisfied with TOL = 10**(-K), then the          larger components of X have K significant decimal digits and          INFO is set to 1.  There is a danger that the smaller compo-          nents of X may have large relative errors, but the fast rate          of convergence of HYBRJ1 usually avoids this possibility.   5. Unsuccessful completion.        Unsuccessful termination of HYBRJ1 can be due to improper input        parameters, arithmetic interrupts, an excessive number of func-        tion evaluations, or lack of good progress.        Improper input parameters.  INFO is set to 0 if N .LE. 0, or          LDFJAC .LT. N, or TOL .LT. 0.D0, or LWA .LT. (N*(N+13))/2.        Arithmetic interrupts.  If these interrupts occur in the FCN          subroutine during an early stage of the computation, they may          be caused by an unacceptable choice of X by HYBRJ1.  In this          case, it may be possible to remedy the situation by not evalu          ating the functions here, but instead setting the components          of FVEC to numbers that exceed those in the initial FVEC,          thereby indirectly reducing the step length.  The step length          can be more directly controlled by using instead HYBRJ, which          includes in its calling sequence the step-length- governing          parameter FACTOR.        Excessive number of function evaluations.  If the number of          calls to FCN with IFLAG = 1 reaches 100*(N+1), then this indi-          cates that the routine is converging very slowly as measured                                                                   Page          by the progress of FVEC, and INFO is set to 2.  This situation          should be unusual because, as indicated below, lack of good          progress is usually diagnosed earlier by HYBRJ1, causing ter-          mination with INFO = 4.        Lack of good progress.  HYBRJ1 searches for a zero of the system          by minimizing the sum of the squares of the functions.  In so          doing, it can become trapped in a region where the minimum          does not correspond to a zero of the system and, in this situ-          ation, the iteration eventually fails to make good progress.          In particular, this will happen if the system does not have a          zero.  If the system has a zero, rerunning HYBRJ1 from a dif-          ferent starting point may be helpful.   6. Characteristics of the algorithm.        HYBRJ1 is a modification of the Powell hybrid method.  Two of        its main characteristics involve the choice of the correction a        a convex combination of the Newton and scaled gradient direc-        tions, and the updating of the Jacobian by the rank-1 method of        Broyden.  The choice of the correction guarantees (under reason        able conditions) global convergence for starting points far fro        the solution and a fast rate of convergence.  The Jacobian is        calculated at the starting point, but it is not recalculated        until the rank-1 method fails to produce satisfactory progress.        Timing.  The time required by HYBRJ1 to solve a given problem          depends on N, the behavior of the functions, the accuracy          requested, and the starting point.  The number of arithmetic          operations needed by HYBRJ1 is about 11.5*(N**2) to process          each evaluation of the functions (call to FCN with IFLAG = 1)          and 1.3*(N**3) to process each evaluation of the Jacobian          (call to FCN with IFLAG = 2).  Unless FCN can be evaluated          quickly, the timing of HYBRJ1 will be strongly influenced by          the time spent in FCN.        Storage.  HYBRJ1 requires (3*N**2 + 17*N)/2 double precision          storage locations, in addition to the storage required by the          program.  There are no internally declared storage arrays.   7. Subprograms required.        USER-supplied ...... FCN        MINPACK-supplied ... DOGLEG,DPMPAR,ENORM,HYBRJ,                             QFORM,QRFAC,R1MPYQ,R1UPDT        FORTRAN-supplied ... DABS,DMAX1,DMIN1,DSQRT,MIN0,MOD   8. References.                                                                   Page        M. J. D. Powell, A Hybrid Method for Nonlinear Equations.        Numerical Methods for Nonlinear Algebraic Equations,        P. Rabinowitz, editor. Gordon and Breach, 1970.   9. Example.        The problem is to determine the values of x(1), x(2), ..., x(9)        which solve the system of tridiagonal equations        (3-2*x(1))*x(1)           -2*x(2)                   = -1                -x(i-1) + (3-2*x(i))*x(i)         -2*x(i+1) = -1, i=2-8                                    -x(8) + (3-2*x(9))*x(9) = -1  C     **********  C  C     DRIVER FOR HYBRJ1 EXAMPLE.  C     DOUBLE PRECISION VERSION  C  C     **********        INTEGER J,N,LDFJAC,INFO,LWA,NWRITE        DOUBLE PRECISION TOL,FNORM        DOUBLE PRECISION X(9),FVEC(9),FJAC(9,9),WA(99)        DOUBLE PRECISION ENORM,DPMPAR        EXTERNAL FCN  C  C     LOGICAL OUTPUT UNIT IS ASSUMED TO BE NUMBER 6.  C        DATA NWRITE /6/  C        N = 9  C  C     THE FOLLOWING STARTING VALUES PROVIDE A ROUGH SOLUTION.  C        DO 10 J = 1, 9           X(J) = -1.D0     10    CONTINUE  C        LDFJAC = 9        LWA = 99  C  C     SET TOL TO THE SQUARE ROOT OF THE MACHINE PRECISION.  C     UNLESS HIGH PRECISION SOLUTIONS ARE REQUIRED,  C     THIS IS THE RECOMMENDED SETTING.  C        TOL = DSQRT(DPMPAR(1))  C        CALL HYBRJ1(FCN,N,X,FVEC,FJAC,LDFJAC,TOL,INFO,WA,LWA)        FNORM = ENORM(N,FVEC)        WRITE (NWRITE,1000) FNORM,INFO,(X(J),J=1,N)        STOP   1000 FORMAT (5X,31H FINAL L2 NORM OF THE RESIDUALS,D15.7 //       *        5X,15H EXIT PARAMETER,16X,I10 //       *        5X,27H FINAL APPROXIMATE SOLUTION // (5X,3D15.7))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -