fortran问题,最好能运算EXTERNAL F DIMENSION X(4),Y(4) DATA X /4*0.0/ B = 2.0 N=4 M=10 EPS=1.0E-5 CALL DNMTC(X,N,B,M,EPS,F,Y) WRITE(*,*) DO 10 I=1,N10 WRITE(*,100) I,X(I) WRITE(*,
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/24 22:15:04
fortran问题,最好能运算EXTERNAL F DIMENSION X(4),Y(4) DATA X /4*0.0/ B = 2.0 N=4 M=10 EPS=1.0E-5 CALL DNMTC(X,N,B,M,EPS,F,Y) WRITE(*,*) DO 10 I=1,N10 WRITE(*,100) I,X(I) WRITE(*,
fortran问题,最好能运算
EXTERNAL F
DIMENSION X(4),Y(4)
DATA X /4*0.0/
B = 2.0
N=4
M=10
EPS=1.0E-5
CALL DNMTC(X,N,B,M,EPS,F,Y)
WRITE(*,*)
DO 10 I=1,N
10 WRITE(*,100) I,X(I)
WRITE(*,*)
100 FORMAT(5X,'X(',I2,1X,')=',E13.6)
END
FUNCTION F(X,N)
DIMENSION X(N)
F1=4*X(4)*X(3)-408.48*X(3)-408.48*X(4)+41713.98
F2=0.96*X(1)*X(3)+0.63*X(1)*X(4)+1.46*X(4)*X(3)-1.91*X(2)*X(4)-154.5*X(1)-235.6*X(3)-390.1*X(4)+38043.93-0.96*X(2)*X(2)
\x05F3=X(1)*X(3)+1.14*X(1)*X(4)+0.87*X(4)*X(3)-1.99*X(2)*X(4)-234.4*X(1)-203.83*X(3)-438.23*X(4)+40811.5-X(2)*X(2)
\x05F4=0.45*X(1)*X(3)+3.04*X(1)*X(4)+0.07*X(4)*X(3)-0.9*X(2)*X(4)-299.42*X(1)+29505.57-44.12*X(3)-343.54*X(4)-0.45*X(2)*X(2)
F=SQRT(F1*F1+F2*F2+F3*F3+F4*F4)
END
SUBROUTINE DNMTC(X,N,B,M,EPS,F,Y)
DIMENSION X(N),Y(N)
DOUBLE PRECISION R
REAL NRND1
A=B
K=1
R=1.0D0
Z=F(X,N)
10 IF(A.GE.EPS) THEN
L=L+1
\x05DO 20 I=1,N
20 Y(I)=-A+2.0*A*NRND1(R)+X(I)
Z1=F(Y,N)
K=K+1
IF(Z1.GE.Z) THEN
IF(K.GT.M) THEN
\x05K=1
\x05A=A/2.0
END IF
GOTO 10
ELSE
K=1
\x05DO 30 I=1,N
30 X(I)=Y(I)
Z=Z1
IF(Z.GE.EPS) GOTO 10
END IF
END IF
END
\x05REAL FUNCTION NRND1(R)
\x05DOUBLE PRECISION S,U,V,R
\x05S=65536.0
\x05U=2053.0
\x05V=13849.0
\x05M=R/S
\x05R=R-M*S
\x05R=U*R+V
\x05M=R/S
\x05R=R-M*S
\x05NRND1=R/S
\x05RETURN
\x05END
-------------------Configuration:DNMTC0 - Win32 Debug--------------------
Compiling Fortran...
D:\Ccaculate\DNMTC0.FOR
D:\Ccaculate\DNMTC0.FOR(21) :Error:The shapes of the array expressions do not conform. [F4]
F4=0.45*X(1)*X(3)+3.04*X(1)*X(4)+0.07*X(4)*X(3)-0.9*X(2)*X(4)-299.42*X(1)+29505.57-44.12*X(3)-343.54*X(4)-0.45*X(2)*X(2)
---------^
Error executing df.exe.
DNMTC0.exe - 1 error(s),0 warning(s)
能不能让程序能运行通.
出错代码段
fortran问题,最好能运算EXTERNAL F DIMENSION X(4),Y(4) DATA X /4*0.0/ B = 2.0 N=4 M=10 EPS=1.0E-5 CALL DNMTC(X,N,B,M,EPS,F,Y) WRITE(*,*) DO 10 I=1,N10 WRITE(*,100) I,X(I) WRITE(*,
不要重复提问.妈呀