作者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/m.aspx?n=bbs/Fortran/M.1512064345.A.4E4.html
1F:推 jubilee2: 有上色!! 12/14 06:20