小推广的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”