| 5 | 1/1 | 返回列表 |
| 查看: 1539 | 回復: 4 | ||
fgwei2000銅蟲 (正式寫手)
|
[求助]
我編的Simpson積分法fortran程序給不出結果,大俠們看看哪里出了問題?
|
|
如題:我編的Simpson積分法fortran程序給不出結果,大俠們看看哪里出了問題? 線性函數(shù)f=x在區(qū)間【0,1】上的積分,結果0.5.[ Last edited by fgwei2000 on 2011-10-29 at 23:07 ] |
金蟲 (正式寫手)
迷途書蟲

金蟲 (正式寫手)
迷途書蟲
|
建議參考下列代碼 Program Simpsons implicit none real, Parameter :: a=0,b=1 integer :: n_points integer :: k,i real :: approx real :: del_x, height, area, t,x real :: n_points_1 Write(*,*)'Enter number of points' Read(*,*)n_points n_points_1 = real(n_points) del_x = abs(b-a)/(n_points_1-1.) approx = 0 t = a do k=1, n_points-1 x = t + del_x/2 area = del_x/6 * ( 4*functio_n ( x ) + functio_n(t) + functio_n(t+del_x) ) t = t + del_x approx = approx + area end do Write(*,*)approx Contains Real Function functio_n(x) Real, Intent(in) :: x functio_n=exp(-x) end function end program |

銅蟲 (正式寫手)
銅蟲 (正式寫手)
| 5 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 材料工程專碩調劑 +5 | 204818@lcx 2026-03-17 | 5/250 |
|
|---|---|---|---|---|
|
[考研] 材料專碩326求調劑 +6 | 墨煜姒莘 2026-03-15 | 7/350 |
|
|
[考博] 26申博 +4 | 八旬速覽 2026-03-16 | 4/200 |
|
|
[考研] 一志愿南京大學,080500材料科學與工程,調劑 +4 | Jy? 2026-03-16 | 4/200 |
|
|
[考研] 285化工學碩求調劑(081700) +9 | 柴郡貓_ 2026-03-12 | 9/450 |
|
|
[考研] 311求調劑 +5 | 26研0 2026-03-15 | 5/250 |
|
|
[考研] 0703化學調劑 290分有科研經(jīng)歷,論文在投 +7 | 膩膩gk 2026-03-14 | 7/350 |
|
|
[基金申請]
NSFC申報書里申請人簡歷中代表性論著還需要在申報書最后的附件里面再上傳一遍嗎
20+5
|
NSFC2026我來了 2026-03-10 | 14/700 |
|
|
[考研] 復試調劑 +4 | z1z2z3879 2026-03-14 | 5/250 |
|
|
[考研] 330求調劑 +3 | ?醬給調劑跪了 2026-03-13 | 3/150 |
|
|
[考研] 336求調劑 +6 | Iuruoh 2026-03-11 | 6/300 |
|
|
[考研] 26調劑/材料/英一數(shù)二/總分289/已過A區(qū)線 +6 | 步川酷紫123 2026-03-13 | 6/300 |
|
|
[考研] 0703化學一志愿211 總分320求調劑 +5 | 瑪卡巴卡啊哈 2026-03-11 | 5/250 |
|
|
[考研] 【考研調劑求收留】 +3 | Ceciilia 2026-03-11 | 3/150 |
|
|
[碩博家園] 085600 260分求調劑 +3 | 天空還下雨么 2026-03-13 | 5/250 |
|
|
[考研] 求調劑 +5 | 一定有學上- 2026-03-12 | 5/250 |
|
|
[考研] 工科278分求調劑 +5 | 周慢熱啊 2026-03-12 | 7/350 |
|
|
[考研] 328化工專碩求調劑 +4 | 。,。,。,。i 2026-03-12 | 4/200 |
|
|
[考研] 277求調劑 +4 | anchor17 2026-03-12 | 4/200 |
|
|
[考研] 283求調劑,材料、化工皆可 +8 | 蘇打水7777 2026-03-11 | 10/500 |
|