مجموعه مسایل محاسبات عددی حل شده در Fortran 90
بالغ بر 70 فایل در مورد حل مسایل محاسبات عددی مقطع کارشناسی به صورت برنامه نویسی شده در نرم افزار Fortran 90 آماده دانلود است. یک نمونه از برنامه های نوشته شده در ادامه آورده شده است:
C***********************************************************************
C *
C ADAMS-FOURTH ORDER PREDICTOR-CORRECTOR METHOD *
C *
C***********************************************************************
C
C
C
C TO APPROXIMATE THE SOLUTION OF THE INITIAL VALUE PROLEM:
C Y’=F(T,Y), A<=T<=B, Y(A)=ALPHA,
C AT (N+1) EQUALLY SPACED NUMBERS IN THE INTERVAL (A,B).
C
C INPUT: ENDPOINTS A,B; INTEGER N; INITIAL CONDITION ALPHA.
C
C OUTPUT: APPROXIMATION W TO Y AT THE (N+1) VALUES OF T.
C
C T(1),…,T(4) AND W(1),…,W(4) ARE THE 4 MOST RECENT VALUES OF
C T(I) AND W(I) RESP.
C
DIMENSION T(10000),W(10000)
CHARACTER NAME*14,NAME1*14,AA*1
INTEGER INP,OUP,FLAG
LOGICAL OK
F(TZ,WZ) = WZ
OPEN(UNIT=5,FILE=’CON’,ACCESS=’SEQUENTIAL’)
OPEN(UNIT=6,FILE=’CON’,ACCESS=’SEQUENTIAL’)
WRITE(6,*) ‘This is the Adams-Bashforth ‘
WRITE(6,*) ‘Predictor-Corrector Method.’
WRITE(6,*) ‘Has the function F been created in the program? ‘
WRITE(6,*) ‘NOTE: The function is defined in two places.’
WRITE(6,*) ‘Enter Y or N ‘
WRITE(6,*) ‘ ‘
READ(5,*) AA
IF(( AA .EQ. ‘Y’ ) .OR. ( AA .EQ. ‘y’ )) THEN
OK = .FALSE.
10 IF (OK) GOTO 11
WRITE(6,*) ‘Input left and right endpoints separated by’
WRITE(6,*) ‘blank – include decimal point’
WRITE(6,*) ‘ ‘
READ(5,*) A, B
IF (A.GE.B) THEN
WRITE(6,*) ‘Left endpoint must be less’
WRITE(6,*) ‘than right endpoint’
ELSE
OK = .TRUE.
ENDIF
GOTO 10
11 OK = .FALSE.
12 IF (OK) GOTO 13
WRITE(6,*) ‘Input a positive integer for the number’
WRITE(6,*) ‘of subinvervals ‘
WRITE(6,*) ‘ ‘
READ(5,*) N
IF ( N .LE. 0 ) THEN
WRITE(6,*) ‘Must be positive integer ‘
ELSE
OK = .TRUE.
ENDIF
GOTO 12
13 WRITE(6,*) ‘Input the initial condition.’
WRITE(6,*) ‘ ‘
READ(5,*) ALPHA
ELSE
WRITE(6,*) ‘The program will end so that the function F ‘
WRITE(6,*) ‘can be created ‘
OK = .FALSE.
ENDIF
IF(.NOT.OK) GOTO 400
WRITE(6,*) ‘Select output destinations: ‘
WRITE(6,*) ‘1. Screen ‘
WRITE(6,*) ‘2. Text file ‘
WRITE(6,*) ‘Enter 1 or 2 ‘
WRITE(6,*) ‘ ‘
READ(5,*) FLAG
IF ( FLAG .EQ. 2 ) THEN
WRITE(6,*) ‘Input the file name in the form – ‘
WRITE(6,*) ‘drive:name.ext’
WRITE(6,*) ‘with the name contained within quotes’
WRITE(6,*) ‘as example: ”A:OUTPUT.DTA” ‘
WRITE(6,*) ‘ ‘
READ(5,*) NAME1
OUP = 3
OPEN(UNIT=OUP,FILE=NAME1,STATUS=’NEW’)
ELSE
OUP = 6
ENDIF
WRITE(OUP,*) ‘OPEN-INTIGRATE METHOD’
T(0) = A
W(0) = ALPHA
H = (B-A)/N
I = 0
W(1) = ALPHA+H*F(A,ALPHA)
T(1)= T(0)+H
WRITE(OUP,2)
WRITE(OUP,3) I,T(0),W(0)
DO I=1,N
T(I+1) = T(I)+H
W(I+1) = W(I-1)+2*H*F(T(I),W(I))
WRITE(OUP,3) I,T(I),W(I)
ENDDO
400 CLOSE(UNIT=5)
CLOSE(UNIT=OUP)
IF(OUP.NE.6) CLOSE(UNIT=6)
STOP
2 FORMAT(1X,7X,’I’,12X,’X’,19X,’Y’)
3 FORMAT(1X,5X,I4,5X,E15.8,5X,E15.8)
END