在Fortran中通过log10
函数运行迭代函数时遇到问题。
program start
integer t, dt, range, rangestart
real*8 k1, k2, k, lognmdott, nmdott, interval
dt = 10
t = 0
range = 0
rangestart = 0
interval = 0
open(unit=1, file='accretion.txt', status='unknown')
do i = 1, 200000
t=t+dt
range = t-rangestart
if (range .gt. 100 .and. range .le. 300) then
k1 = log10(1.) - log10(0.001)
k2 = log10(200.)
k = k1/k2
interval = interval + dt
lognmdott = -k*(log10(interval))
if (interval .eq. 200) then
interval = 0
endif
nmdott = 10**lognmdott
write(1,*) t, nmdott
endif
close(1)
end
我希望得到log10(interval)
输出,其值介于10到200之间,步长为10。我实际上得到了错误
'x' argument of 'log10' intrinsic at (1) must be REAL