PROGRAM Rabbit_Sheep
PARAMETER(kx=10000)
INTEGER::i,j,n,k
REAL::t(kx),dt,x(50,kx),y(50,kx)
OPEN(25,FILE="p6in.dat")
OPEN(15,FILE="p6out.dat",STATUS="unknown")
READ(25,*) k
DO n=1,k
READ(25,*) x(n,1),y(n,1)
ENDDO
dt=0.001
t(1)=0.0
DO n=1,k
DO i=1,kx-1
x(n,i+1)=x(n,i)+dt*(x(n,i)*(3.0-x(n,i)-2.0*y(n,i)))
y(n,i+1)=y(n,i)+dt*(y(n,i)*(2.0-x(n,i)-y(n,i)))
t(i+1)=t(i)+dt
ENDDO
ENDDO
DO i=1,kx-1
WRITE(15,1)t(i),(x(n,i),n=1,k),(y(n,i),n=1,k)
ENDDO
1 FORMAT(45(F7.3,1x))
END PROGRAM
PARAMETER(kx=10000)
INTEGER::i,j,n,k
REAL::t(kx),dt,x(50,kx),y(50,kx)
OPEN(25,FILE="p6in.dat")
OPEN(15,FILE="p6out.dat",STATUS="unknown")
READ(25,*) k
DO n=1,k
READ(25,*) x(n,1),y(n,1)
ENDDO
dt=0.001
t(1)=0.0
DO n=1,k
DO i=1,kx-1
x(n,i+1)=x(n,i)+dt*(x(n,i)*(3.0-x(n,i)-2.0*y(n,i)))
y(n,i+1)=y(n,i)+dt*(y(n,i)*(2.0-x(n,i)-y(n,i)))
t(i+1)=t(i)+dt
ENDDO
ENDDO
DO i=1,kx-1
WRITE(15,1)t(i),(x(n,i),n=1,k),(y(n,i),n=1,k)
ENDDO
1 FORMAT(45(F7.3,1x))
END PROGRAM
Comments
Post a Comment