| 查看: 380 | 回复: 3 | |||
| 当前主题已经存档。 | |||
[交流]
【求助】一个Fortran 90程序出错
|
|||
|
各位好!求助一个Fortran 90程序如下: program D3R1 !driver for routine TRAPZD real,parameter::nmax=15,pio2=1.5707963 external Func,Fint real::A=0.0,B=pio2 write(*,'(1x,a)') 'integral of Func with 2^(n-1) points' write(*,'(1x,a,f10.6)')'actual value of integral is',& Fint(B)-Fint(A) write(*,'(1x,t7,a,t16,a)')'n','Approx.integral' do i=1,nmax call TRAPZD(Func,A,B,s,i) write(*,'(1x,i6,f20.6)')i,s end do end program D3R1 Function Func(x) Func=(x**2)*(x**2-2.0)*sin(x) end function Func function Fint(x) !integral of Func Fint=4.0*x*((x**2)-7.0)*sin(x)-((x**4)-14.0*(x**2)+28.0)*cos(x) end function Fint subroutine TRAPZD(Func,A,B,s,n) integer,parameter::k1=selected_int_kind(13) integer(kind=k1)::tnm integer,parameter::k2=selected_real_kind(8,13) real(kind=k2)::del,sum,x if(n==1)then s=0.5*(b-a)*(Func(a)+Func(b)) else tnm=2.0**(n-1) del=(b-a)/tnm x=A sum=0.0 do j=2,tnm x=x+del sum=sum+Func(x) end do s=0.5*(Func(A)+Func(B)+2.0*sum)*del end if end subroutine TRAPZD 运行后提示:Error: This is an incorrect value for a kind type parameter in this context. [K1] integer(kind=k1)::tnm 请问错误在哪?? |
» 猜你喜欢
有没有人能给点建议
已经有5人回复
假如你的研究生提出不合理要求
已经有12人回复
实验室接单子
已经有7人回复
全日制(定向)博士
已经有5人回复
萌生出自己或许不适合搞科研的想法,现在跑or等等看?
已经有4人回复
Materials Today Chemistry审稿周期
已经有4人回复
参与限项
已经有3人回复
对氯苯硼酸纯化
已经有3人回复
所感
已经有4人回复
要不要辞职读博?
已经有7人回复
yuheng2182
木虫 (正式写手)
- 应助: 2 (幼儿园)
- 金币: 2963.5
- 散金: 10
- 帖子: 536
- 在线: 44.7小时
- 虫号: 734967
- 注册: 2009-03-30
- 性别: GG
- 专业: 原子和分子物理
2楼2009-06-20 08:15:54
argo
铁杆木虫 (著名写手)
上善若水
- 应助: 4 (幼儿园)
- 金币: 9672.8
- 散金: 200
- 红花: 34
- 帖子: 1940
- 在线: 486.4小时
- 虫号: 507533
- 注册: 2008-02-19
- 性别: GG
- 专业: 凝聚态物性 II :电子结构

3楼2009-06-20 09:55:01
yuheng2182
木虫 (正式写手)
- 应助: 2 (幼儿园)
- 金币: 2963.5
- 散金: 10
- 帖子: 536
- 在线: 44.7小时
- 虫号: 734967
- 注册: 2009-03-30
- 性别: GG
- 专业: 原子和分子物理
4楼2009-06-20 10:26:27












回复此楼