// $AISD_VERSION:RKDemo.java@1.2/home/coei/arc/archive%shell3.ba.best.com$ //COPYRIGHT: Copyright (c) 1997 by Christopher K. Oei, Incorporated. //COPYRIGHT: //COPYRIGHT: http://www.chrisoei.com //COPYRIGHT: info@chrisoei.com //COPYRIGHT: //COPYRIGHT: Permission to use, display, and modify this code //COPYRIGHT: is hereby granted provided that: //COPYRIGHT: //COPYRIGHT: 1) this notice is included in its entirety //COPYRIGHT: 2) we are notified of the usage // RKDemo is a class that demonstrates the use of the RKInt class // by integrating an ODE of the form // // dx[0]/dt = -x[1] - 0.05 x[0] // dx[1]/dt = x[0] // import RKInt; import NumDemo; public class RKDemo extends RKInt { static double Ideriv=0; public RKDemo(double i_t,double[] i_x,double i_dt) { super(i_t,i_x,i_dt); } protected double[] derivative(double i_t,double[] i_x) { double q = NumDemo.qvalue; double beta1 = NumDemo.betavalue; double[] y = new double[3]; double beta; beta=beta1*beta1; y[0]=i_x[2]; y[1]=-q*i_x[1] + beta*i_x[2] * ((1.5*i_x[0])/Math.pow((1.00+Math.pow(i_x[0],2.0)),2.5)); y[2]=-1.0 - ((1.5*i_x[0])/Math.pow(1.00+Math.pow(i_x[0],2.0),2.5)) * i_x[1]; Ideriv = y[1]; return y; } }