Python / 常微分方程式の数値解法
Python で常微分方程式の数値解を求める。聯立微分方程式であっても方程式ごとに個別に def で定義する。リアルタイムシミュレーションが目的であるので 1 刻みだけ計算する (1 刻み計算して描画、1 刻み計算して描画、...... を繰り返す)。
関連:
TI-Nspire & Lua / 常微分方程式の数値解法のまとめ (『パソコンで見る天体の動き』) / クラス化する -
TI-Nspire & Lua / 常微分方程式の数値解法のまとめ (『パソコンで見る天体の動き』) / クロージャを利用する -
0. scipy.integrate.odeint を利用する
構文: spODE([funcs], t0, [inits], h [, numOfDiv])
1. 古典的 Runge-Kutta 法
構文: RK4([funcs], t0, [inits], h [, numOfDiv])
2. Shanks による 12 段 8 次の Runge-Kutta 法
構文: Shanks8([funcs], t0, [inits], h [, numOfDiv])
3. 特殊な方程式に対する Nyström 法 (5 次)
構文: Nystroem([funcs], t0, [inits], [initsDot], h [, numOfDiv])
4. Fehlberg 法 (6 段 5 次 & 4 次)
構文: Fehlberg([funcs], t0, [inits], h [, tol])
5. 特殊な方程式に対する 4 段の Cowell 法
構文: Cowell4([funcs], t0, [pairsOfInits], h)
6. 特殊な方程式に対する 7 段の Cowell 法
構文: Cowell7([funcs], t0, [pairsOfInits], h)
7. 補外法
構文: Extrapo([funcs], t0, [inits], h [,numOfDiv])
8. 特殊な方程式に対する補外法
構文: Gragg([funcs], t0, [inits], [initsDot], h [, numOfDiv])
参考:
パソコンで見る天体の動き