小推廣的Runge-Kutta方法正確嗎?

來源: 9$ 2012-12-12 09:57:29 [] [博客] [舊帖] [給我悄悄話] 本文已被閱讀: 次 (1144 bytes)
同學們:
有一個數學問題請教:“Runge–Kutta methods”
可以參考wikipedia:
http://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods
其中有一句話“Now pick a step-size h>0 and define”
事實上,星係的曲線是可以繞圈的,所以上麵的h>0 有時必須h小於0.
我的程序是這樣處理有時大於零,有時小於零(下麵是程序)。我的處理正確嗎?

k1=tan(alp); dec=sin(alp);
if( cos(alp)>=0 ){goe1=fabs(goe1);}else{goe1=-fabs(goe1);}
xh=X+0.5*goe1; yh=Y+0.5*goe1*k1;
sl2=x1v(xh,yh,dec);
k2=tan(sl2); dec=sin(sl2);
if( cos(sl2)>=0 ){goe2=fabs(goe2);}else{goe2=-fabs(goe2);}
xh=X+0.5*goe2; yh=Y+0.5*goe2*k2;
sl2=x1v(xh,yh,dec);
k3=tan(sl2); dec=sin(sl2);
if( cos(sl2)>=0 ){goe3=fabs(goe3);}else{goe3=-fabs(goe3);}
xh=X+goe3; yh=Y+goe3*k3;
sl2=x1v(xh,yh,dec);
k4=tan(sl2); dec=sin(sl2);
if( cos(sl2)>=0 ){goe4=fabs(goe4);}else{goe4=-fabs(goe4);}
Xp=X+(1./6.)*(goe1+2*goe2+2*goe3+goe4);
Yp=Y+(1./6.)*(goe1*k1+2*goe2*k2+2*goe3*k3+goe4*k4);
alp=x1v(Xp,Yp,dec);

其中的goe1等等就是上述的h
請幫忙證明是否正確。謝謝!!


請閱讀更多我的博客文章>>>
  • 小推廣的Runge-Kutta方法正確嗎?
  • 美女指標 和 性之起源
  • 一個公式可能拯救整個世界
  • 所有跟帖: 

    回複:小推廣的Runge-Kutta方法正確嗎? -孩子長了翅膀- 給 孩子長了翅膀 發送悄悄話 (566 bytes) () 12/12/2012 postreply 10:46:08

    謝謝!我的問題非常簡單,沒有你想象的那麽複雜, -9$- 給 9$ 發送悄悄話 9$ 的博客首頁 (68 bytes) () 12/12/2012 postreply 10:54:50

    嗬嗬,比我想象的複雜。 -孩子長了翅膀- 給 孩子長了翅膀 發送悄悄話 (21 bytes) () 12/12/2012 postreply 11:00:49

    在平麵上處處(!)給定 dy/dx, 你就能積分得出平行曲線簇, -9$- 給 9$ 發送悄悄話 9$ 的博客首頁 (31 bytes) () 12/12/2012 postreply 11:10:04

    在2D問題中,如果你隻有包含x變量,y,y dot,y double ldot 等叫做常微分方程, -孩子長了翅膀- 給 孩子長了翅膀 發送悄悄話 (68 bytes) () 12/12/2012 postreply 11:19:45

    我研究的是最簡單PDE: partial y/partial x = f(x,y) -9$- 給 9$ 發送悄悄話 9$ 的博客首頁 (0 bytes) () 12/12/2012 postreply 11:28:19

    這叫常微分方程。 -孩子長了翅膀- 給 孩子長了翅膀 發送悄悄話 (214 bytes) () 12/12/2012 postreply 11:34:05

    同學們,對不起。我的問題是常微分方程!! -9$- 給 9$ 發送悄悄話 9$ 的博客首頁 (0 bytes) () 12/12/2012 postreply 11:35:07

    沒有時間變量的常微分方程 -孩子長了翅膀- 給 孩子長了翅膀 發送悄悄話 (321 bytes) () 12/12/2012 postreply 11:54:31

    當恒有h<0時, Rutta-cotta 方法絕對是正確的,在交界點時, -9$- 給 9$ 發送悄悄話 9$ 的博客首頁 (97 bytes) () 12/12/2012 postreply 12:27:26

    當恒有h小於0時, Rutta-cotta 方法絕對是正確的,在交界點時, -9$- 給 9$ 發送悄悄話 9$ 的博客首頁 (0 bytes) () 12/12/2012 postreply 12:28:13

    駐波曲線可以有N個交界點,一個x (可正可負)可以對應N個y值,h是increment,不是函數變量本身。 -孩子長了翅膀- 給 孩子長了翅膀 發送悄悄話 (0 bytes) () 12/12/2012 postreply 12:36:36

    你總是用教科書,而我的是實際問題!關鍵是alp, 不是tan(alp) -9$- 給 9$ 發送悄悄話 9$ 的博客首頁 (269 bytes) () 12/13/2012 postreply 07:27:37

    回複:你總是用教科書,而我的是實際問題!關鍵是alp, 不是tan(alp) -孩子長了翅膀- 給 孩子長了翅膀 發送悄悄話 (422 bytes) () 12/13/2012 postreply 07:49:23

    參數,同學,參數,parameter,parameter,你懂嗎? -參謀總長- 給 參謀總長 發送悄悄話 參謀總長 的博客首頁 (0 bytes) () 12/12/2012 postreply 21:54:45

    參謀長倒是需要多讀一點教科書。 -9$- 給 9$ 發送悄悄話 9$ 的博客首頁 (0 bytes) () 12/13/2012 postreply 07:28:37

    回複:參謀長倒是需要多讀一點教科書。 -孩子長了翅膀- 給 孩子長了翅膀 發送悄悄話 (215 bytes) () 12/13/2012 postreply 08:03:44

    我的科研(如果正確)相當於開普勒的工作(數據規律),不是動力學, -9$- 給 9$ 發送悄悄話 9$ 的博客首頁 (566 bytes) () 12/13/2012 postreply 08:15:30

    不管你的科研搞什麽,你對電腦程序是新手, -孩子長了翅膀- 給 孩子長了翅膀 發送悄悄話 (145 bytes) () 12/13/2012 postreply 08:24:11

    step size 就是數值積分所得近似折線的相連折點之間的某種間隔 -9$- 給 9$ 發送悄悄話 9$ 的博客首頁 (0 bytes) () 12/13/2012 postreply 08:30:33

    你自己再考慮一下 Runge-cotta 方法的應用範圍 -孩子長了翅膀- 給 孩子長了翅膀 發送悄悄話 (199 bytes) () 12/13/2012 postreply 09:06:36

    假如ODE的解是橢圓,解上半圓h大於0,解下半圓h小於0, -9$- 給 9$ 發送悄悄話 9$ 的博客首頁 (116 bytes) () 12/13/2012 postreply 09:31:01

    這個用 polar coordinate (r,theta)的牛頓方程 -孩子長了翅膀- 給 孩子長了翅膀 發送悄悄話 (29 bytes) () 12/13/2012 postreply 10:10:24

    用polar coordinate解也是上半圓h大於0,解下半圓h小於0,一樣滴,嘿嘿 -參謀總長- 給 參謀總長 發送悄悄話 參謀總長 的博客首頁 (0 bytes) () 12/13/2012 postreply 15:03:30

    打轉轉不會想不通的,就是x有點想不通,走到頭了回不來 :) -孩子長了翅膀- 給 孩子長了翅膀 發送悄悄話 (0 bytes) () 12/13/2012 postreply 15:09:22

    我支持9美刀,堅決不打轉轉,就是政府好玩,就是要玩政府 :) -參謀總長- 給 參謀總長 發送悄悄話 參謀總長 的博客首頁 (0 bytes) () 12/13/2012 postreply 15:14:31

    不是玩政府吧,是玩新 Kepler? -孩子長了翅膀- 給 孩子長了翅膀 發送悄悄話 (0 bytes) () 12/13/2012 postreply 15:21:39

    是玩正負吧,跟玩政府一樣,我看沒什麽不同,嘿嘿 -參謀總長- 給 參謀總長 發送悄悄話 參謀總長 的博客首頁 (0 bytes) () 12/13/2012 postreply 15:58:55

    同學,你不是在糾結政府嗎?9美刀倒是需要多讀一點民主教科書 -參謀總長- 給 參謀總長 發送悄悄話 參謀總長 的博客首頁 (0 bytes) () 12/13/2012 postreply 14:55:57

    請您先登陸,再發跟帖!

    發現Adblock插件

    如要繼續瀏覽
    請支持本站 請務必在本站關閉/移除任何Adblock

    關閉Adblock後 請點擊

    請參考如何關閉Adblock/Adblock plus

    安裝Adblock plus用戶請點擊瀏覽器圖標
    選擇“Disable on www.wenxuecity.com”

    安裝Adblock用戶請點擊圖標
    選擇“don't run on pages on this domain”