01 /*
02 * $Id: VdpolRk4Step.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.RungeKutta4;
15
16
17 /**
18 * ヴァンデルポール方程式を4次のルンゲ・クッタ法で1ステップ分だけ解くクラスです。
19 * @author koga
20 * @version $Revision: 1.4 $, 2004/04/22
21 */
22 public class VdpolRk4Step {
23
24 /**
25 * メインメソッド
26 *
27 * @param args コマンドライン引数
28 * @throws SolverStopException ソルバーが停止された場合
29 */
30 @SuppressWarnings("nls")
31 public static void main(String[] args) throws SolverStopException {
32 DifferentialEquation equation = new Vdpol();
33 Matrix x0 = new DoubleMatrix(new double[] {0, 0.25}).transpose();
34 double t0 = 0.0;
35 double timeStep = 0.1;
36 DifferentialEquationSolver solver = new RungeKutta4();
37 Matrix x1 = solver.step(equation, t0, x0, timeStep);
38 x1.print("x1");
39 }
40 }
|