01 /*
02 * $Id: VdpolRKFStep.java,v 1.4 2008/02/02 03:06:25 koga Exp $
03 *
04 * Copyright (C) 2004 Koga Laboratory. All rights reserved.
05 *
06 */
07 package matxbook.chap21;
08
09 import org.mklab.nfc.matrix.DoubleMatrix;
10 import org.mklab.nfc.matrix.Matrix;
11 import org.mklab.nfc.ode.DifferentialEquationSolver;
12 import org.mklab.nfc.ode.DifferentialEquation;
13 import org.mklab.nfc.ode.SolverStopException;
14 import org.mklab.nfc.ode.RungeKuttaFehlberg;
15
16
17 /**
18 * ヴァンデルポール方程式をRKF法(4次のルンゲ・クッタ法)で1ステップ分だけ解くクラスです。
19 *
20 * @author koga
21 * @version $Revision: 1.4 $, 2004/04/22
22 */
23 public class VdpolRKFStep {
24
25 /**
26 * メインメソッド
27 *
28 * @param args コマンドライン引数
29 * @throws SolverStopException ソルバーが停止された場合
30 */
31 @SuppressWarnings("nls")
32 public static void main(String[] args) throws SolverStopException {
33 DifferentialEquation equation = new Vdpol();
34 Matrix x0 = new DoubleMatrix(new double[] {0, 0.25}).transpose();
35 double t0 = 0.0;
36 double timeStep = 0.1;
37 DifferentialEquationSolver solver = new RungeKuttaFehlberg();
38 Matrix x1 = solver.step(equation, t0, x0, timeStep);
39 x1.print("x1");
40 }
41 }
|