| 查看: 456 | 回复: 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人回复
救命帖
已经有7人回复
限项规定
已经有6人回复
西南交通大学国家级人才团队2026年博士研究生招生(考核制)—机械、材料、力学方向
已经有3人回复
英文综述是否需要润色及查重
已经有5人回复
为什么nbs上溴 没有产物点出现呢
已经有9人回复
最失望的一年
已经有18人回复
» 抢金币啦!回帖就可以得到:
南佛罗里达大学化学系刘文奇课题组 2026 Fall 招收有机/超分子方向博士生
+2/922
东北大学-招收2026年硕士研究生2-3名(金属材料3D打印方向)
+5/105
北京理工大学 珠海校区全职院士招数名博士生--申请考核制-半导体、光学、微电子
+2/96
征婚
+1/75
大连理工大学智能系统实验室优秀硕博研究生招生
+1/73
自驾淄博回四川遂宁过年,寻找小伙伴一起
+1/65
招收博士生(大连理工大学,2026.09入学)
+1/61
辽宁材料实验室框架复合材料课题组招收联合培养研究生(长期有效)
+2/44
西交利物浦大学黄彪院士招收26年全奖博士生1名(工业智能方向)
+1/31
深圳大学信息功能聚合物电介质方向“申请-考核制”博士生招生
+2/30
93年坐标北京,征女友
+1/14
中国科学院深圳先进技术研究院合成生物学研究所陈禹课题组招聘博士后
+2/14
中国地质大学(武汉)分析地球化学团队招收博士生1名、硕士生3名
+2/10
多伦多城市大学深度学习方向博士后
+1/4
复旦大学2026年博士研究生,“药学 + 合成生物学”
+1/4
中南民族大学-国家级领军人才团队超支化聚合物方向2026年博士研究生招生
+1/4
华南理工大学宋波教授招收2026年博士生
+1/4
自荐:大模型ai辅助论文阅读软件:EasyReader论文易读
+1/3
意大利米兰理工大学Lorenza Petrini教授招收玛丽居里MEDALLOY博士
+1/2
多伦多城市大学计算机视觉方向博士后
+1/1
3楼2011-02-13 10:24:20
2楼2011-02-13 10:18:59













回复此楼