| 查看: 555 | 回复: 2 | |||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | |||
[交流]
【求助】为什么两种写法得到的值不一样?
|
|||
|
为什么把if语句放到不同的位置,结果就不一样了呢?请大家帮忙分析一下,多谢。 写法一(判断语句为h0(t)/=0): t0=0 do ntel=1, npoints neworig = .false. if (t0.eq.0) then neworig = .true. elseif (ntel-time0(t0).eq.it0)then neworig = .true. endif if (neworig) then t0 = t0 + 1 ! update number of t=0 time0(t0) = ntel ! store the time of t=0 h0(t0) = h(ntel) endif do t=1, t0 ! update tcf for t=0 delt=ntel-time0(t)+1 ! actual time minus t=0 if(h0(t)/=0.and.(delt.lt.npoints)) then ntime(delt) = ntime(delt)+1d0 tcf(delt)=tcf(delt)+h(ntel)*h0(t) tcf0(delt)=tcf0(delt)+h0(t)*h0(t) endif enddo enddo 写法二(判断语句为if (h(ntel)/=0) then) t0=0 do ntel=1, npoints neworig = .false. if (h(ntel)/=0) then if (t0.eq.0) then neworig = .true. elseif (ntel-time0(t0).eq.it0)then neworig = .true. endif endif if (neworig) then t0 = t0 + 1 ! update number of t=0 time0(t0) = ntel ! store the time of t=0 h0(t0) = h(ntel) endif do t=1, t0 ! update tcf for t=0 delt=ntel-time0(t)+1 ! actual time minus t=0 if(delt.lt.npoints) then ntime(delt) = ntime(delt)+1d0 tcf(delt)=tcf(delt)+h(ntel)*h0(t) tcf0(delt)=tcf0(delt)+h0(t)*h0(t) endif enddo enddo |
» 猜你喜欢
在职考研
已经有4人回复
b口会评
已经有3人回复
2026年面上项目中了,2A+B, 会评顺利通过
已经有13人回复
生命口会评
已经有4人回复
大龄残疾硕士的一点执念
已经有21人回复
今年E04面上
已经有20人回复
网络举报学术不端成为了男女之间情杀的手段了,真荒唐。。。
已经有3人回复
Suzuki偶联中硼酸酯原料掉下的硼酸酯是否可以自身偶联,生成B2Pin2杂质
已经有3人回复
刑法学论文投稿求助
已经有5人回复
Journal of Environmental Chemical Engineering
已经有3人回复
» 抢金币啦!回帖就可以得到:
实验室技术孵化和中试技术转让
+1/1973
]青岛市人才引进直事业编,93年,985硕,180 70,爱好弹吉他唱歌
+1/142
化学所分子识别实验室公开招聘项目聘用人员
+1/84
固态电池专家
+1/73
上海交通大学化工学院邱惠斌教授课题组招募科研助理、交流生
+1/34
北京师范大学(珠海)电催化方向招收2027年硕士研究生化学或材料方向
+1/34
美国圣路易斯大学招聘生物信息学博士后
+1/30
回首往事
+1/30
沈阳农业大学招聘微生物酶工程方向博士!!!!!!!!!!!!!
+1/29
Monash University, 低碳冶金建模方向博士生招生(3-6名),位置开放至2028年12月31号 [
+1/29
暨南大学开明峰教授团队博士后招聘启事
+1/13
澳大利亚昆士兰大学(UQ)】全奖PhD招生:碳捕集与液流电池储能方向
+1/11
悉尼大学-全奖PhD-电催化【实验】and【计算】
+1/6
量子化学软件开发工程师-深圳
+1/5
浙江大学-化工学院刘平伟课题组-二维材料/功能聚合物开发-博后招聘
+1/4
国家纳米中心招聘项目聘用研究助理
+1/4
圣路易斯华盛顿大学管建均教授课题组招聘博士后(2名)
+1/3
清华大学韩军功教授课题组博士后招聘启事
+1/3
圣路易斯华盛顿大学管建均教授课题组招聘博士后(2名)
+1/2
北理工集成电路杰青团队 | 诚招科助理
+1/1
3楼2011-02-13 10:24:20
2楼2011-02-13 10:18:59











回复此楼