SUBROUTINE HrmZro ( n, x ) ! !---------------------- HrmZro ----------------------------------------- ! ! HrmZro -- zeroes of Hermite polynomials ! ! === Latest Revision: | 900524 at 15:38 | fixed up the convergence ! ! input -- ! ! n -- order of the Hermite polynomial whose zeroes are desired ! (h0 has NONE, h1 has one zero, h25 has 25 zeroes) ! ! output -- ! ! x -- array listing the non-negative zeroes of nth polynomial ! x will be returned with 13 numbers in it IF n=25 ! note-- dimension statements limit n=200 ! !----------------------------------------------------------------------- ! USE Numeric_Kinds_Module USE FileUnits_Module INTEGER(KIND=IW_Kind) :: i, ic, ifpr, iodd, iroot, it, n, nnr, np, npr REAL(KIND=WP_Kind) :: cor, xav, xfp, xs, xz, xzn, tn, tnr REAL(KIND=WP_Kind) :: xg(200), hp(200), x(n) LOGICAL ODD, LAST ! !---------------------xecution begins here ---------------------------- ! IF( n .lt. 1 ) RETURN ! x(1) = Zero IF( n .eq. 1 ) RETURN ! npr = n/2 np = n + 1 tn = Two*n + One tnr = Half/n iodd = mod(n,2) ODD = iodd .eq. 1 nnr = iodd + npr ifpr = iodd + 1 IF( ODD ) x(1) = Zero ! xfp = pi/SQRT(tn) IF( .not.ODD ) xfp = Half*xfp IF( ODD ) xfp = pi/SQRT(tn-Fourth*xfp**2) xg(1) = xfp ! IF( npr .lt. 2 ) GOTO 2 DO i = 2, npr xs = pi/SQRT(tn - xg(i-1)**2) xav = Half*xs + xg(i-1) xg(i) = xg(i-1) + pi/SQRT(tn - xav**2) ENDDO 2 CONTINUE ! ic = 0 iroot = npr + iodd ! DO i = ifpr, nnr iroot = iroot + 1 ic = ic + 1 xz = xg(ic) CALL Hermit_fun ( xz, n, hp, np ) it = 0 LAST = .false. ! 11 CONTINUE it = it + 1 cor = hp(np)*tnr/hp(n) xzn = xz - cor ! IF( LAST ) GOTO 12 LAST = One + Half*ABS(cor/xzn) .eq. One IF( it .gt. 30 ) GOTO 13 ! CALL Hermit_fun ( xzn, n, hp, np ) xz = xzn GOTO 11 ! 13 CONTINUE WRITE (Msg_Unit, 1000 ) it, iroot, n, xzn, xz ! 12 CONTINUE x(i) = xzn ENDDO ! 1000 FORMAT( ' poor convergence after ', i2, ' iterations *** HrmZro -- root(order) = ' & , i3,"(",i3,")",/, ' best zero = ', e20.10, ', previous guess = ', e20.10 ) ! RETURN END SUBROUTINE HrmZro