PROGRAM BT4_12 PARAMETER (NMAX=100,MMAX=12) DIMENSION X(NMAX,MMAX),Y(NMAX,MMAX) REAL MUY1,MUY2,XICMA, ALFA,T,TALFA REAL TBX(NMAX),TBY(NMAX),SX,SY INTEGER NX,NY,M,I,J CHARACTER*15 H0,H1,ANSWER1,ANSWER2 ! XICMA: DO LECH CHUAN CUA X VA Y ! ALFA: XAC SUAT PHAM SAI LAM LOAI I DATA XICMA,ALFA /0.4,0.05/ DATA H0,H1 /'CHAP NHAN H0','BAC BO H0'/ OPEN(1,FILE='C:\MASTER\G_TR\BAITAP~1\NEW\BANG11-B.TXT') READ(1,*) READ(1,*) READ(1,*) NX,M DO I=1,NX READ(1,*) TMP, (X(I,J),J=1,M) ENDDO OPEN(1,FILE='C:\MASTER\G_TR\BAITAP~1\NEW\BANG11-C.TXT') READ(1,*) READ(1,*) READ(1,*) NY,M DO I=1,NY READ(1,*) TMP, (Y(I,J),J=1,M) ENDDO ! TINH TRUNG BINH SO HOC DO I=1,NX TBX(I)=0.0 DO J=1,M TBX(I)=TBX(I)+X(I,J) ENDDO TBX(I)=TBX(I)/REAL(M) ENDDO MUY1=AMMGOC(TBX,NX,1) SX=AMMTAM(TBX,NX,2) SX=SQRT(SX) DO I=1,NY TBY(I)=0.0 DO J=1,M TBY(I)=TBY(I)+Y(I,J) ENDDO TBY(I)=TBY(I)/REAL(M) ENDDO MUY2=AMMGOC(TBY,NY,1) SY=AMMTAM(TBY,NY,2) SY=SQRT(SY) ! TINH T VA TALFA A=(REAL(NX-1)*SX+REAL(NY-1)*SY)/REAL(NX+NY-2) A=SQRT(A) B=(MUY1-MUY2)/SQRT(1.0/REAL(NX)+1.0/REAL(NY)) T=B/A TALFA=TINV(ALFA,REAL(NX+NY-2)) IF (ABS(T).LT.TALFA) THEN ANSWER1=H0 ELSE ANSWER1=H1 ENDIF WRITE(*,*)' KET QUA KIEM NGHIEM T - H0: MUY1=MUY2' WRITE(*,'(" MUY1 = ",F10.3)') MUY1 WRITE(*,'(" MUY2 = ",F10.3)') MUY2 WRITE(*,'(" N1 = ",I10)') NX WRITE(*,'(" N2 = ",I10)') NY WRITE(*,'(" T = ",F10.3)') T WRITE(*,'(" ALFA = ",F10.3)') ALFA WRITE(*,'(" TALFA = ",F10.3)') TALFA WRITE(*,'(" KET LUAN: ",A15)') ANSWER1 END FUNCTION TINV(P,N) ! HAM NAY TINH GIA TRI X0 CUA BIEN NGAU NHIEN X PHAN BO ! STUDENT VOI N BAC TU DO THOA MAN DIEU KIEN ! P(|X|>X0)=P. ! INPUT: + P XAC SUAT DE |X|>X0 (P(|X|>X0)=P) ! + N SO BAC TU DO, PHAI LA MOT SO THUC ! OUTPUT: X0 ! SUBROUTINE/FUNCTION DUOC GOI TOI: TDIST PARAMETER (EPS=1.0E-6) REAL P,AP,N, A,B,C,P0 IF (P.LT.0.0.OR.P.GT.1.0) THEN WRITE(*,*)' INVALID NUMERIC INPUT IN AKBPINV FUNCTION' STOP ENDIF IF (P.EQ.0.0) THEN WRITE(*,*)' THE P VALUE TOO SMALL IN AKBPINV FUNCTION' STOP ELSE IF (P.EQ.1) THEN WRITE(*,*)' THE P VALUE TOO BIG IN AKBPINV FUNCTION' STOP ENDIF ! A=0.0 B=99999.0 ! C=A AP=P 10 P0=TDIST(B,N) SS=ABS((P0-AP)/AP) SS1=ABS((B-C)/B) IF (SS.GE.EPS.AND.SS1.GE.EPS) THEN IF (AP.GT.P0) THEN C=B B=(A+B)/2.0 ! PRINT*,'1- B=',B,' C=',C GOTO 10 ELSE IF (AP.LT.P0) THEN B=(C+B)/2.0 ! PRINT*,'2- B=',B,' C=',C GOTO 10 ENDIF ENDIF A=(C+B)/2.0 TINV=A RETURN END FUNCTION TDIST(X0,N) ! HAM NAY TINH XAC SUAT DE BIEN NGAU NHIEN X CO PHAN BO STUDENT ! VOI N BAC TU DO NHAN GIA TRI NGOAI KHOANG (-X0;X0): ! P=P(|X|>X0)=1-P(|X|