| 查看: 553 | 回复: 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人回复
大龄残疾硕士的一点执念
已经有21人回复
今年E04面上
已经有20人回复
网络举报学术不端成为了男女之间情杀的手段了,真荒唐。。。
已经有3人回复
2026年面上项目中了,2A+B, 会评顺利通过
已经有12人回复
Suzuki偶联中硼酸酯原料掉下的硼酸酯是否可以自身偶联,生成B2Pin2杂质
已经有3人回复
刑法学论文投稿求助
已经有5人回复
Journal of Environmental Chemical Engineering
已经有3人回复
最后一年,祈求好运
已经有3人回复
风电环氧领域
已经有3人回复
» 抢金币啦!回帖就可以得到:
如何快速、批量挖掘高活性生物酶 挖酶、生物酶挖掘、挖酶教学、批量挖掘、高质量
+1/83
化学所分子识别实验室公开招聘项目聘用人员
+1/81
澳门大学周胤宁课题组招收2027年8月入学博士生
+1/43
海南大学化学院,招聘2026科研助理,博士,博士后
+1/37
北京师范大学(珠海)电催化方向招收2027年硕士研究生化学或材料方向
+1/36
厦门大学张桥保教授团队招收2027年硕士/博士研究生以及博士后(材料、化学方向)
+1/31
Monash University, 低碳冶金建模方向博士生招生(3-6名),位置开放至2028年12月31号 [
+1/31
回首往事
+1/31
华南理工大学电力学院雪映教授招收博士生(2027年秋季入学)
+2/28
深圳大学杨楚罗/黄忠衍团队招聘博士后
+1/25
暨南大学开明峰教授团队博士后招聘启事
+1/20
澳大利亚昆士兰大学(UQ)】全奖PhD招生:碳捕集与液流电池储能方向
+1/11
Forestry Economics Review(《林业经济评论》)2026年第一期正式上线
+1/6
量子化学软件开发工程师-深圳
+1/5
EI 会议持续收稿,全科接收,检索稳定
+1/4
圣路易斯华盛顿大学管建均教授课题组招聘博士后(2名)
+1/4
清华大学韩军功教授课题组博士后招聘启事
+1/3
Urgent!知名外资仪器厂家急招Application Scientist(2名,售前,SH)
+1/3
北理工集成电路杰青团队 | 诚招科助理
+1/1
招聘具身智能机器人用二次电池关键材料理论计算与实验制备方向博士后-深圳理工大学
+1/1
2楼2011-02-13 10:18:59
3楼2011-02-13 10:24:20











回复此楼