SXY=SXY+X1*YI 10 CONTINUE DXX SXX-SX*SX/N DYY=SYY-SY+SY/N DXY=SXY-SXSY/N B=DXYDXX A=(SY-B*SXVN R=DXY/SQRT(DXX*DYY) RETURN END SUBROUTINE LGRG2(X YNTZY DIMENSION X(N).Y(N) DOUBLE PRECISIONX.Y.T.Z.S Z=0.0 IF(N.LE.0)RETURN IF(N.EO.1)THEN 7=Y1) RETURN END IF IF(N.EQ.2)THEN Z-(Y(1)*(T-X(2yY(2)*(T-X1)MX(1X2》 RETURN ENDIE IF(T.LE.X(2)YTHEN K=1 M=3 ELSE IF(T.GE.X(N-1))THEN K=N-2 ELSE K=1 M=N 10 IF(IABS(K-M).NE.I)THEN L=(K+M)2 IF(T.I T.X(L))THEN M=L ELse K=1 ENDIE G0T010 END IF IF(ABS(T-X(K)).LT.ABS(T-X(M)))THEN K=K-1SXY=SXY+X1*Y1 10 CONTINUE DXX=SXX-SX*SX/N DYY=SYY-SY*SY/N DXY=SXY-SX*SY/N B=DXY/DXX A=(SY-B*SX)/N R=DXY/SQRT(DXX*DYY) RETURN END SUBROUTINE LGRG2(X,Y,N,T,Z) DIMENSION X(N),Y(N) DOUBLE PRECISION X,Y,T,Z,S Z=0.0 IF(N.LE.0)RETURN IF(N.EQ.1)THEN Z=Y(1) RETURN END IF IF(N.EQ.2)THEN Z=(Y(1)*(T-X(2))-Y(2)*(T-X(1)))/(X(1)-X(2)) RETURN END IF IF(T.LE.X(2))THEN K=1 M=3 ELSE IF(T.GE.X(N-1))THEN K=N-2 M=N ELSE K=1 M=N 10 IF(IABS(K-M).NE.1)THEN L=(K+M)/2 IF(T.LT.X(L))THEN M=L ELSE K=L ENDIF GOTO 10 END IF IF(ABS(T-X(K)).LT.ABS(T-X(M))) THEN K=K-1