| 查看: 1080 | 回复: 7 | |||
| 【奖励】 本帖被评价4次,作者学员7eU8hQ增加金币 3.5 个 | |||
| 当前主题已经存档。 | |||
[资源]
【分享】产生高斯分布随机数源代码(Fortran)
|
|||
|
subroutine gauss(x1,x2,x,w,n) integer n real x1,x2,x(n),w(n) double precision xm,xl,z,p1,p2,p3,pp,z1 integer m,i,j parameter (eps=3.d-14) m=(n+1)/2 xm=0.5d0*(x2+x1) xl=0.5d0*(x2-x1) do 12 i=1,m z=cos(3.141592654d0*(i-.25d0)/(n+.5d0)) 1 continue p1=1.d0 p2=0.d0 do 11 j=1,n p3=p2 p2=p1 p1=((2.d0*j-1.d0)*z*p2-(j-1.d0)*p3)/j 11 continue pp=n*(z*p1-p2)/(z*z-1.d0) z1=z z=z1-p1/pp if(abs(z-z1).gt.eps)go to 1 if (abs(z).lt.eps) z=0. x(i)=xm-xl*z x(n+1-i)=xm+xl*z w(i)=2.d0*xl/((1.d0-z*z)*pp*pp) w(n+1-i)=w(i) 12 continue return end [ Last edited by woshilsh on 2009-2-20 at 16:32 ] |
» 收录本帖的淘帖专辑推荐
文献查阅 |
» 猜你喜欢
最近几年招的学生写论文不引自己组发的文章
已经有11人回复
写了一篇“相变储能技术在冷库中应用”的论文,论文内容以实验为主,投什么期刊合适?
已经有4人回复
需要合成515-64-0,50g,能接单的留言
已经有3人回复
中科院杭州医学所招收博士生一名(生物分析化学、药物递送)
已经有3人回复
临港实验室与上科大联培博士招生1名
已经有8人回复
想换工作。大多数高校都是 评职称时 认可5年内在原单位取得的成果吗?
已经有4人回复
带资进组求博导收留
已经有9人回复
2楼2008-05-05 17:35:26
★★★★★ 五星级,优秀推荐
★ ★ ★
woshilsh(金币+3,VIP+0):多谢交流,常来,互相帮助 2-20 16:32
woshilsh(金币+3,VIP+0):多谢交流,常来,互相帮助 2-20 16:32
|
楼主,我怎么运行有好多错误啊 --------------------Configuration: shuijishu - Win32 Debug-------------------- Compiling Fortran... D:\exe\shuijishu.for f90: Error: Illegal character in statement label field [s] f90: Error: Illegal character in statement label field f90: Error: Illegal character in statement label field f90: Error: Illegal character in statement label field [r] f90: Error: Illegal character in statement label field [o] f90: Error: First statement in file must not be continued D:\exe\shuijishu.for(1) : Error: Syntax error, found END-OF-STATEMENT when expecting one of: ( % . = => subroutine gauss(x1,x2,x,w,n) -----------------------------^ D:\exe\shuijishu.for(30) : Error: A RETURN statement is invalid in the main program. return ------^ D:\exe\shuijishu.for(3) : Error: An automatic object is invalid in a main program. [X] real x1,x2,x(n),w(n) -----------------^ D:\exe\shuijishu.for(3) : Error: An automatic object is invalid in a main program. [W] real x1,x2,x(n),w(n) ----------------------^ D:\exe\shuijishu.for(2) : Error: A specification expression object must be a dummy argument, a COMMON block object, or an object accessible through host or use association [N] integer n --------------^ Error executing df.exe. shuijishu.obj - 11 error(s), 0 warning(s) 我对fortran不是太懂,你可以给我的意见吗,谢谢 |
3楼2009-02-20 15:37:15
4楼2009-02-21 09:22:51
5楼2009-02-21 09:59:30













回复此楼
