CALLLGRG2(X.Y.N.T.YA) 02 CALLLGRG2(X.Y.N,T.YA) 71 10 CALLLGRG2(X.Y.N.T.YA) (5分) DIMENSION X(N).Y(N) SV-00 SXX=0.0 D010=1,N SX-SXX1 10 DXX=S XX-SXSX/ Y-SYN B-DXY/DXX R-DXY/SORT(DXX*DYY) (5分) DOUBLE PRECISION X.Y.TZS N END IE IF(N.EQ3 DIMENSION X(N),Y(N),Z(N) DOUBLE PRECISION X,Y,Z,H,T,YA,YB T=X(1)+H CALL LGRG2(X,Y,N,T,YA) T=X(1)+2*H CALL LGRG2(X,Y,N,T,YB) Z(1)=(4*YA-3*Y(1)-YB)/(2*H) DO 10 I=2,N-1 T=X(I)-H CALL LGRG2(X,Y,N,T,YA) T=X(I)+H CALL LGRG2(X,Y,N,T,YB) Z(I)=(YB-YA)/(2*H) 10 CONTINUE T=X(N)-H CALL LGRG2(X,Y,N,T,YA) T=X(N)-2*H CALL LGRG2(X,Y,N,T,YB) Z(N)=(3*Y(N)-4*YA+YB)/(2*H) RETURN END SUBROUTINE PK(N,X,Y,A,B,R) (5 分) DOUBLE PRECISION X,Y,A,B,R DIMENSION X(N),Y(N) SX=0.0 SY=0.0 SXX=0.0 SYY=0.0 SXY=0.0 DO 10 I=1,N X1=X(I) Y1=Y(I) SX=SX+X1 SY=SY+Y1 SXX=SXX+X1*X1 SYY=SYY+Y1*Y1 SXY=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) (5 分) 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