c c Numerical Analysis: c The Mathematics of Scientific Computing c D.R. Kincaid & E.W. Cheney c Brooks/Cole Publ., 1990 c c Section 3.5 c c Example of Laguerre's Method c c c file: laguerre.f c implicit complex (a-h,o-z) parameter (n=4, M=7) dimension a(0:n) data a/(-72.,68.),(1140.,636.),(-216.,190.),(-10.,-26.),(1.,0.)/ data z/(1.,1.)/ c print * print *,' Laguerre''s Method Example' print *,' Section 3.5, Kincaid-Cheney' print * print *,' Value of n and values of coefficients:' print *,n,(a(j),j=0,n) print * print *,' Starting point for the iteration:',z print * c sn = real(n) c do 3 k=1,m alpha = a(n) beta = (0.0,0.0) gamma = (0.0,0.0) c do 2 j=n-1,0,-1 gamma = z*gamma + beta beta = z*beta + alpha alpha = z*alpha + a(j) 2 continue c ca = -beta/alpha cb = ca*ca - 2.0*gamma/alpha c1 = sqrt((sn-1.0)*(sn*cb - ca*ca)) cc1 = (ca + c1)/sn cc2 = (ca - c1)/sn cc = cc2 if (abs(cc1) .gt. abs(cc2)) then cc = cc1 c2 = 1.0/cc z = z + c2 d = (ca - cc)/(sn - 1.0) rho1 = sqrt(sn)*c2 rho2 = sqrt(sn/(cc*cc + (sn-1)*d*d)) print *,'values of z, c2, rho1, and rho2:' print *,z,c2,rho1,rho2 print * 3 continue c stop end