差分方程式

簡単な差分方程式をMAXIMAで解く

How to solve simple difference equations with MAXIMA?

計量経済学のなかの一つの専門分野として書かれた時系列分析のテキスト(例えばHamiltonやEnders)では書籍の最初の章で差分方程式の解法などが詳しく書かれていることがある。小生のような初学者にとっては、このような面倒な計算に習熟しないと先に進めないのかと暗い気持ちになり、最初につまずいてしまうが、差分方程式を解くだけであればMAXIMAの力を借りればなんとかなる。時系列が定常過程がどうか、安定性や反転可能性のチェックをするときに差分方程式の特性根を求めるので、そのための基礎知識として詳しく書かれているのだろうと勝手に解釈している。Rの時系列分析パッケージ(例えばforecast)を利用すれば、そのような計算は総て自動的に処理し、丁寧にユニットサークルや単位根のグラフまで示してくれるし、シミュレーションモデルが定常過程でない場合にはその旨も警告してくれるので、実務的にはあまり気落ちすることもなさそうに思う。

MAXIMAで差分方程式を解く場合には、最初に差分方程式用のパッケージ solve_rec をloadしておく必要がある。

(%i1) load("solve_rec");

\[\]\[\tag{%o1} "C:/maxima-5.49.0/share/maxima/5.49.0/share/solve\_ rec/solve\_ rec.mac"\]

Walter Enders  Applied econometric time series  John wiley & sons 1995 に差分方程式の解法手順が記されているが、その中で y[t]=0.9*y[t-1]-.0.2*y[t-2] + 3 の差分方程式の事例をMAXIMAで解いてみる。
エンダースのテキストの第1章差分方程式(1.28)(1995,原書)(邦訳書では差分方程式(1.24)}

(%i3) solve_rec(y[t]=0.9·y[t1]0.2·y[t2]+3,y[t]) ;

\[\]\[rat: replaced 0.2 by 1/5 = 0.2 \]\[rat: replaced -0.9 by -9/10 = -0.9\]

\[\]\[\tag{%o3} {y_t}\mathop{=}\frac{{{\ensuremath{\mathrm{\% k}}}_2}}{{{2}^{t}}}\mathop{+}\frac{{{2}^{t}} {{\ensuremath{\mathrm{\% k}}}_1}}{{{5}^{t}}}\mathop{+}10\]

%kは任意定数を示す。

初期値としてy[0]=13, y[1]=11.3を与えて差分方程式をMAXIMAで解くと

(%i5) solve_rec(y[t]=0.9·y[t1]0.2·y[t2]+3,y[t],y[1]=11.3,y[0]=13) ,float ;

\[\]\[rat: replaced 0.2 by 1/5 = 0.2 \]\[rat: replaced -0.9 by -9/10 = -0.9 \]\[rat: replaced 1.0 by 1/1 = 1.0 \]\[rat: replaced -0.9 by -9/10 = -0.9 \]\[rat: replaced 0.2 by 1/5 = 0.2 \]\[rat: replaced 0.2 by 1/5 = 0.2 \]\[rat: replaced -0.9 by -9/10 = -0.9 \]\[rat: replaced 0.2 by 1/5 = 0.2 \]\[rat: replaced -0.9 by -9/10 = -0.9 \]\[rat: replaced 0.1 by 1/10 = 0.1 \]\[rat: replaced -3.0 by -3/1 = -3.0 \]\[rat: replaced 0.3 by 3/10 = 0.3 \]\[rat: replaced 0.1 by 1/10 = 0.1 \]\[rat: replaced 0.1 by 1/10 = 0.1 \]\[rat: replaced 0.30000000000000004 by 3/10 = 0.3 \]\[rat: replaced 0.0 by 0/1 = 0.0 \]\[rat: replaced -1.3000000000000007 by -13/10 = -1.3 \]\[rat: replaced 0.4 by 2/5 = 0.4 \]\[rat: replaced 0.5 by 1/2 = 0.5 \]\[rat: replaced 1.0 by 1/1 = 1.0 \]\[rat: replaced 1.0 by 1/1 = 1.0\]

\[\]\[\tag{%o5} {y_t}\mathop{=}{{0.5}^{t}}\mathop{+}2 {{0.4}^{t}}\mathop{+}10\]



上式は (0.5)^t + 2*(0.4)^t + 10
を表している。



参考文献
ウォルター・エンダース著 新谷元嗣、藪友良 訳
(2019)実証のための計量時系列分析 有斐閣(Walter Enders Applied Econometric time series Wiley & Sons Inc)
Walter Enders 1995,Applied Econometric time series Wiley & Sons Inc



ARMA(1,1)モデルの反転可能性、因果性等をMAXIMAで探究


2次差分方程式(定係数、同次)の特性方程式が複素根のケースと時系列分析
New




高齢者の学び(PythonをRStudioで少し勉強  )
New

PythonのパッケージSymPyで差分方程式を解く


金融工学を初等数学で 目次