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 * @author koga
19 * @version $Revision: 1.4 $, 2004/04/22
20 */
21 public class VdpolRk4Step {
22
23 /**
24 * メインメソッド
25 *
26 * @param args コマンドライン引数
27 * @throws SolverStopException ソルバーが停止された場合
28 */
29 @SuppressWarnings("nls")
30 public static void main(String[] args) throws SolverStopException {
31 DifferentialEquation equation = new Vdpol();
32 Matrix x0 = new DoubleMatrix(new double[] {0, 0.25}).transpose();
33 double t0 = 0.0;
34 double timeStep = 0.1;
35 DifferentialEquationSolver solver = new RungeKutta4();
36 Matrix x1 = solver.step(equation, t0, x0, timeStep);
37 x1.print("x1");
38 }
39 }
|