="justify"> * Copyright (c) 2002 - 2010
*
* PERMISSION TO COPY:
* Permission to use, copy and modify this software and its documentation for
* NON-COMMERCIAL purposes is granted, without fee, provided that an acknowledgement
* to the author, Michael Thomas Flanagan at ee.ucl.ac.uk/ ~ mflanaga, appears in all copies.
*
* Dr Michael Thomas Flanagan makes no representations about the suitability
* or fitness of the software for any or for a particular purpose.
* Michael Thomas Flanagan shall not be liable for any damages suffered
* as a result of using, modifying or distributing this software or its derivatives.
*
****************************************** *******************/model; class RungeKutta_method {float x0; float xn; float y0; float [] yy0; int nODE = 0; float step; RungeKutta_method () {
} void setInitialValueOfX (float x0) {. x0 = x0;
} void setFinalValueOfX (float xn) {. xn = xn;
} void setInitialValuesOfY (float [] yy0) {. yy0 = yy0;. nODE = yy0.length; (this.nODE == 1) this.y0 = yy0 [0];
} void setStepSize (float step) {. step = step;
} void fourthOrderMass (InitSystem g, coordinates XY) {(Double.isNaN (this.x0)) throw new IllegalArgumentException ("No initial x value has been entered"); (Double.isNaN ( this.xn)) throw new IllegalArgumentException ("No final x value has been entered"); (this.yy0 == null) throw new IllegalArgumentException ("No initial y values ​​have been entered"); (Double.isNaN ( this.step)) throw new IllegalArgumentException ("No step size has been entered"); [] k1 = new float [this.nODE]; [] k2 = new float [this.nODE]; [] k3 = new float [this.nODE]; [] k4 = new float [this.nODE]; [] y = new float [this.nODE]; [] yd = new float [this.nODE]; [] dydx = new float [this . nODE]; x = 0.0f; ns = (this.xn - this.x0)/this.step; = (float) Math.rint (ns); nsteps = (int) ns;. nIter = nsteps; stepUsed = (this.xn - this.x0)/ns; [] [] Y = new float [this.nODE] [nsteps]; (int i = 0; i