NTC0394
Programmer
- Jun 19, 2013
- 21
Hi guys! I am trying to modify my code but it do not works.
I am trying to put "DO j= 1, 1000" first that "DO i= 1, 20". How to do and keep the same results?
DO i = 1, 20
m = 0
m_2 = 0
p = 10*i
DO j = 1, 1000
d = 0
c = 0
DO
IF (harvest .lt. 0.5) THEN
d = d + 1
ELSE
d = d - 1
END IF
c = c + 1
IF (c .eq. p) exit
END IF
END DO
m = m + d/real(1000)
m_2 = m_2 + (d**2)/real(1000)
END DO
WRITE(1, *) p, m
dp = sqrt(m_2 - m**2)
WRITE(2, *) p, dp
WRITE(3, *) sqrt(REAL(p)), log(dp)
END DO
I am trying to put "DO j= 1, 1000" first that "DO i= 1, 20". How to do and keep the same results?
DO i = 1, 20
m = 0
m_2 = 0
p = 10*i
DO j = 1, 1000
d = 0
c = 0
DO
IF (harvest .lt. 0.5) THEN
d = d + 1
ELSE
d = d - 1
END IF
c = c + 1
IF (c .eq. p) exit
END IF
END DO
m = m + d/real(1000)
m_2 = m_2 + (d**2)/real(1000)
END DO
WRITE(1, *) p, m
dp = sqrt(m_2 - m**2)
WRITE(2, *) p, dp
WRITE(3, *) sqrt(REAL(p)), log(dp)
END DO