c main program to minimize a function defined by the routine CUMCMOM c double precision x(11), g(11), f, work(1000), eta, accrcy, c xtol, stepmx, dsqrt integer maxit, maxfun, msglvl external cumcmom c open(unit=11,file='tn.out') c c specify initial estimate of the solution c alpha = 4.9561412799481265E-02 gamma = 0.2221164113492287 pa = 0.5396557499838393 pb = 1.031165681675045 psi = 0.8099445797823645 sig = 2.6569890153331652E-02 theta = 0.2502798171262564 zeta = 0.2000800745551513 gi2 = -2.5320094821180507E-03 gi3 = -1.2926712886312550E-02 gi4 = -2.8197961671036271E-03 gi5 = 1.6003727639777758E-02 gc2 = 0.1154912900568540 gc3 = -1.0544008612704105E-02 gc4 = 4.0115800599287050E-02 c alpha = 4.983032031413407D-02 gamma = 2.224548899999971D-01 pa = 5.397770643932662D-01 pb = 1.031156440231105D+00 psi = 8.097575815152796D-01 sig = 2.438187430701751D-02 theta = 2.529772551472444D-01 zeta = 1.998992633173677D-01 gi2 = -1.842975299302145D-03 gi3 = -1.314245274198073D-02 gi4 = -2.243419725450815D-03 gi5 = 1.612904822548889D-02 gc2 = 1.147163569809006D-01 gc3 =-2.025190190693869D-03 gc3 = 2.025190190693869D-02 gc4 = 4.044663176722788D-02 c alpha = 4.961114362048992D-02 gamma = 2.227190166116107D-01 pa = 5.398288568762987D-01 pb = 1.031153128413442D+00 psi = 8.097790059681671D-01 sig = 2.587902303019673D-02 theta = 2.658098610736511D-01 zeta = 1.999962836947860D-01 gc2 = 1.147654075732363D-01 gc3 = 2.102257877861642D-02 gc4 = 4.001053616373000D-02 c x(1) = alpha x(2) = gamma x(3) = pa x(4) = pb x(5) = psi x(6) = sig x(7) = theta x(8) = zeta x(9) = gc2 x(10) = gc3 x(11) = gc4 n = 11 f = 1.d0 c c specify inputs for optimization routine c maxit = 500 maxfun = 500 eta = .25D0 stepmx = 0.03 accrcy = 1.D-15 xtol = dsqrt(accrcy) msglvl = 1 c c minimize function c call lmqn (ierror, n, x, f, g, work, 1000, cumcmom, c msglvl,maxit,maxfun,eta,stepmx,accrcy,xtol) c c print results c write(*,*) 'TN RESULTS' if (ierror.ne.0) write(*,800) ierror if (msglvl.ge.1) write(*,810) if (msglvl.ge.1) write(*,820) (i,x(i),i=1,n) if (msglvl.ge.1) write(*,830) if (msglvl.ge.1) write(*,820) (i,g(i),i=1,n) write(11,*) 'TN RESULTS' if (ierror.ne.0) write(11,800) ierror if (msglvl.ge.1) write(11,810) if (msglvl.ge.1) write(11,820) (i,x(i),i=1,n) if (msglvl.ge.1) write(11,830) if (msglvl.ge.1) write(11,820) (i,g(i),i=1,n) stop 800 format(//,' ERROR CODE =', I3,/) 810 format(10X, 'CURRENT SOLUTION IS ',/14X, 'I', 11X, 'X(I)') 820 format(10X, I5, 2X, 1PD22.15) 830 format(10X, 'CURRENT GRADIENT IS ',/14X, 'I', 11X, 'G(I)') end cParameters and gradients (and standard errors): c 4.9951270222663879E-02 -9.5390295996107905E-04 4.9957086898335099E-03 c 0.2223773896694183 -2.1488153607634394E-02 7.4381690318550059E-02 c 0.5397412776947021 5.5253587689822483E-04 1.2479595699545238E-03 c 1.031158328056335 -3.5336275194257131E-05 5.1813998144361050E-05 c 0.8097020983695984 8.4452261587990538E-04 2.0510755609950801E-03 c 2.3286703974008560E-02 1.9531207125810826E-02 6.4811195158992838E-02 c 0.2482689470052719 7.5684131538553351E-02 0.2000266960149261 c 0.1998593807220459 6.3575788747784711E-04 2.1740751532849880E-03 c 7.7905873768031597E-03 -1.9164295911983684E-02 5.6724856005503561E-02 c -1.5627656131982803E-02 -0.2772085608391138 0.7853043096592626 c -4.0062991902232170E-03 -5.9708590067486548E-02 0.1734966865156796 c 0.1145600005984306 4.8836598800213826E-04 5.0189159339392475E-03 c 3.7918263114988803E-04 -8.6171433660506284E-03 0.1631884458780548 c 4.0397074073553085E-02 -3.9945134076020160E-03 9.8689955935899043E-03