| 查看: 453 | 回复: 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 |
» 猜你喜欢
限项规定
已经有6人回复
西南交通大学国家级人才团队2026年博士研究生招生(考核制)—机械、材料、力学方向
已经有3人回复
救命帖
已经有6人回复
英文综述是否需要润色及查重
已经有5人回复
为什么nbs上溴 没有产物点出现呢
已经有9人回复
招博士
已经有3人回复
最失望的一年
已经有18人回复
» 抢金币啦!回帖就可以得到:
邀您投稿 Polymers 特刊
+1/483
上海87年GG诚求女友
+1/166
南京林业大学特聘教授团队招聘博后和2026博士研究生
+1/82
大连理工大学智能系统实验室优秀硕博研究生招生
+1/79
深圳大学信息功能聚合物电介质方向“申请-考核制”博士生招生
+1/78
征婚
+1/75
上海交通大学变革分子学中心申涛课题组2026秋季入学推荐-考核制博士招生(有机)
+1/74
电子科技大学崔春华课题组招收物理化学背景博士生1名-申请考核制
+2/48
南开大学物理学院张书辉副教授招收凝聚态物理理论方向博士生、硕士生
+1/38
中山大学农业与生物技术学院周潇峰课题组诚聘微生物/植物病理学方向科研助理
+1/35
东北林业大学刘松教授课题组长期招收博士、博士后
+1/31
西工大可塑性液体材料课题组招收软物质、流体力学、细胞工程等背景博士生
+1/28
2026申博自荐 本硕双一流学科 纳米药物递送方向 一篇一区TOP 两个国家奖学金
+1/17
【陕西师范大学】催化化学课题组2026年招收博士后/讲师/副高
+1/16
福建师范大学柔性电子学院 院士团队招2026级博士 光电器件、发光传感忆阻器
+1/12
顺磁计算交流
+1/7
华南理工大学宋波教授招收2026年博士生(二氧化碳转化方向优先)
+1/6
2025版《中国药典》方法测定二甲基亚砜含量偏高
+1/5
中南民族大学超支化聚合物团队2026年博士研究生招生
+1/1
0854电子信息330求调剂
+1/1
2楼2011-02-13 10:18:59
3楼2011-02-13 10:24:20













回复此楼