Go to the first, previous, next, last section, table of contents.


tk_rk.runge_kutta_4_linear

tk_rk.runge_kutta_4_linear(P,X,Y,X0,Y0,Terminal,Step)
:: 4次の Runge-Kutta 法による微分方程式の数値近似解. 線形方程式専用.
return
リスト リストの要素は以下の形式 [Xの値,Y_1の値,Y_2の値, ...]. X の値は減っていく. よってリストの先頭が Terminal 付近での Y の値.
P, X, Y, Step
P は 方程式の右辺. リスト. Y'=P Y である. 従属変数 Y は不要. X 独立変数名. Y リスト. 従属変数のリスト. 従属変数は自動生成される. 使われていないので空リストでよい. Step 刻み幅.
X0, Y0, Terminal
X0 出発点の X の値. Y0 出発点での Y の初期値. Terminal X の終着点.
[1355] import("taka_runge_kutta.rr");
[1590] A=tk_rk.runge_kutta_4_linear([[0,1],[-1,0]],x,[ ], 0, [1,0], 3.14*2, 0.1);
[1591] taka_plot_auto(A);

振動の方程式, y0'=y1, y1'=-y0 (y0''+y0=0). 答は y0=cos(x) を解いている.
taka_plot_auto は下方向で y が正.

ChangeLog


Go to the first, previous, next, last section, table of contents.