program FIT_VT c Author: Glen Cowan c Date: June 2004 c Program to fit positions and radii of sun and venus at transit. c Fitting done with the method of least squares. The chi^2 minimization c is carried out with the MINUIT routines from the CERN program library. implicit NONE c local variables integer n_dof double precision chi2 c variables for MINUIT integer ierr integer ird integer isav integer istat integer ivarbl integer iwr integer npari, nparx double precision arglis (10) double precision fmin, fedm, errdef external FCN integer device_type c common block for HBOOK integer hbook_common_size parameter (hbook_common_size = 100000) integer hmemor (hbook_common_size) common /pawc/ hmemor integer nwords_kuip parameter (nwords_kuip=20000) c begin call HLIMIT (hbook_common_size) call KUINIT (nwords_kuip) device_type = 1 call HPLINT (device_type) c Initialize MINUIT ird = 5 ! unit number for input to Minuit (keyboard) iwr = 6 ! unit number for output from Minuit (screen) isav = 7 ! unit number for use of the SAVE command call MNINIT (ird, iwr, isav) c Set print level to -1 (no output except SHOW commands) arglis(1) = -1.d0 call MNEXCM (FCN, 'SET PRIN', arglis, 1, ierr, 0) c Get input data by calling FCN with iflag=1 arglis(1) = 1.d0 call MNEXCM (FCN, 'CALL', arglis, 1, ierr, 0) c Minimize chi2 using SIMPLEX and MIGRAD call MNEXCM (FCN, 'SIMPLEX', arglis, 0, ierr, 0) call MNEXCM (FCN, 'MIGRAD', arglis, 0, ierr, 0) c Compute covariance matrix with HESSE call MNEXCM (FCN, 'HESSE', arglis, 0, ierr, 0) c Finish up by calling FCN with iflag=3 arglis(1) = 3.d0 call MNEXCM (FCN, 'CALL', arglis, 1, ierr, 0) call HPLEND stop END