[問題]指數的EXP函數問題,請大大幫忙一下!
我跑程式不知道啥會有底下的問題
Warning: Variable EXP is used before its value has been defined
x(i)=log(exp(1)-1)+log(r(i))
我的程式如下,請大大幫我看看是哪裡出錯了,感謝!
program work3
implicit none
integer i
real r(100),x(100),exp(1)
CALL init_random_seed()
CALL RANDOM_NUMBER(r)
write(*,*)r
do i=1,100
x(i)=log(exp(1)-1)+log(r(i))
end do
write(*,*)x
end program work3
SUBROUTINE init_random_seed()
INTEGER :: i, n, clock
INTEGER, DIMENSION(:), ALLOCATABLE :: seed
CALL RANDOM_SEED(size = n)
ALLOCATE(seed(n))
CALL SYSTEM_CLOCK(COUNT=clock)
seed = clock + 37 * (/ (i - 1, i = 1, n) /)
CALL RANDOM_SEED(PUT = seed)
DEALLOCATE(seed)
END SUBROUTINE
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.131.96.30
→
03/16 00:36, , 1F
03/16 00:36, 1F
→
03/16 14:10, , 2F
03/16 14:10, 2F
Fortran 近期熱門文章
PTT數位生活區 即時熱門文章