作者PTT0207445 (我是乡民)
看板Fortran
标题Re: [问题] Fortran双重积分怎麽写
时间Fri Dec 1 01:52:23 2017
program doubleint
implicit none
integer,
parameter :: N
=100
real,
parameter :: dx
=0.01, dy
=0.01
real :: f,x,y,s
integer :: i,j
s
=0.0
do i
=1,N
do j
=1,N
x
=i
*dx
y
=j
*dy
s
=s
+f(x,y)
*dx
*dy
enddo
enddo
print*,s
end program doubleint
real function f(x,y)
implicit none
real :: x,y
f
=sin(x)
+cos(y)
end function f
※ 引述《CYVS (Satolbuki)》之铭言:
: 小弟我以前没接触过fortran,想请教板上前辈指导一下双重积分要怎麽写,
: 自己有翻书找到梯形法跟辛普森法,但实在是看不懂,能不能举个例子
: 或哪边能够参考可以告诉我,拜托了!
: 手机发文伤眼抱歉!
: -----
: Sent from JPTT on my Sony E6853.
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 129.12.24.112
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Fortran/M.1512064345.A.4E4.html
1F:推 jubilee2: 有上色!! 12/14 06:20