subroutine SHOW_PAR (c2, set, frame) c Plot the paramter values to the left of the picture c Glen Cowan, 9-Dec-1998 implicit NONE c constants integer npar_max parameter (npar_max = 100) c arguments integer set integer frame(*) double precision c2(*) c local variables character*10 chnam (npar_max) character*40 line character*80 outfile integer i, j integer ind(6) integer istat integer ivarbl(npar_max) ! = par # if adjustable, 0 if fixed integer npari ! number of adjustable parameters integer nparx ! total number of parameters integer outlun save outlun logical first_call / .true. / save first_call logical top double precision bnd1, bnd2 double precision deriv (npar_max) double precision dpar (npar_max) double precision fmin, fedm, errdef double precision par (npar_max) double precision xs, ys, rs, xv, yv, rv, d double precision covmat(npar_max, npar_max) double precision dvar, sigma_d double precision dderiv c begin if ( first_call ) then first_call = .false. outlun = 50 write (*, *) 'enter file name for output data' read (*, fmt='(a80)') outfile open (unit=outlun, file = outfile, & form = 'formatted', status = 'unknown') endif c Get the parameter values, errors, etc. call MNSTAT (fmin, fedm, errdef, npari, nparx, istat) do i = 1, nparx call MNPOUT (i,chnam(i),par(i),dpar(i),bnd1,bnd2,ivarbl(i)) end do top = .true. call WRITE_LINE (' ', 0, top) top = .false. write (line,1010) call WRITE_LINE (line, 0, top) do i = 1, nparx c write parameter name and value if ( i .eq. 1 .or. i .eq. 2 .or. & (i .ge. 4*set-1 .and. i .le. 4*set + 2) ) then write (line(1:24), fmt = '(24x)') write (line(1:2), fmt = '(i2)') i write (line(3:3), fmt = '('' '')') write (line(4:11), fmt = '(a8)') chnam(i)(1:8) write (line(12:24), fmt= '(1pg13.5)') par(i) call WRITE_LINE (line, 0 , top) c write error unless parameter is fixed if ( ivarbl(i) .gt. 0 ) then write (line (1:24), fmt = '(24x)') write (line (9:11), fmt = '(''"a#'')') write (line (12:24), fmt = '(1pg13.5)') dpar(i) call WRITE_LINE (line, 9, top) endif endif end do write (line,1010) call WRITE_LINE (line, 0, top) call WRITE_LINE (' ', 0, top) c write chi2 call WRITE_LINE (' ', 0, top) write (line(1:9), fmt = '(''[h]^2! = '')') write (line(10:22), fmt = '(1pg13.5)') fmin call WRITE_LINE (line, 5, top) write (*, *) 'c2(j) = ', c2(set) call WRITE_LINE (' ', 0, top) write (line(1:14), fmt = '(''[h]^2!(set) = '')') write (line(15:27), fmt = '(1pg13.5)') c2(set) call WRITE_LINE (line, 5, top) c write distance from venus to sun call MNEMAT (covmat, npar_max) c do i = 1, nparx c do j = 1, nparx c write (*, *) i, j, covmat(i,j) c end do c end do ind(1) = 1 ind(2) = 2 ind(3) = 4*set - 1 ind(4) = 4*set ind(5) = 4*set + 1 ind(6) = 4*set + 2 rs = par(ind(1)) rv = par(ind(2)) xs = par(ind(3)) ys = par(ind(4)) xv = par(ind(5)) yv = par(ind(6)) d = rs - rv - SQRT( (xv - xs)**2 + (yv - ys)**2 ) dvar = 0. do i = 1, 6 do j = 1, 6 dvar = dvar + & dderiv(par, dpar, ind, i) * & dderiv(par, dpar, ind, j) * & covmat(ind(i), ind(j)) end do end do sigma_d = SQRT(dvar) call WRITE_LINE (' ', 0, top) write (line(1:4), fmt = '(''d = '')') write (line(5:14), fmt = '(1pg10.3)') d write (line(15:16), fmt = '(''+-'')') write (line(17:26), fmt = '(1pg10.3)') sigma_d call WRITE_LINE (line, 5, top) c also output to console write (outlun, *) frame(set), d, sigma_d, c2(set) 1010 FORMAT (19('-')) return END c********************************************************************** double precision function dderiv(par, dpar, ind, i) implicit NONE integer max_par parameter (max_par = 100) integer i, ind(*), j double precision eps double precision par(*), dpar(*) double precision xs, ys, rs, xv, yv, rv double precision dplus, dminus, p(max_par) c begin do j = 1, 6 p(j) = par(ind(j)) ! local copies end do eps = dpar(ind(i))*0.1 p(i) = p(i) + eps rs = p(1) rv = p(2) xs = p(3) ys = p(4) xv = p(5) yv = p(6) dplus = rs - rv - SQRT( (xv - xs)**2 + (yv - ys)**2 ) p(i) = p(i) - 2.*eps rs = p(1) rv = p(2) xs = p(3) ys = p(4) xv = p(5) yv = p(6) dminus = rs - rv - SQRT( (xv - xs)**2 + (yv - ys)**2 ) dderiv = (dplus - dminus)/(2.*eps) return END