package math;
import org.apache.commons.math3.ode.*;
import org.apache.commons.math3.analysis.*;
import org.apache.commons.math3.ode.FirstOrderIntegrator.*;
import org.apache.commons.math3.ode.nonstiff.HighamHall54Integrator;
class pro{
public static void main(String[] args) {
pro test=new pro();
}
pro(){
double minstep =0.1;
double maxstep=1.0;
double abt=0.001;
double rt=0.001;
FirstOrderDifferentialEquations fode = new FirstOrderDifferentialEquations() {
public int getDimension() {
return 1;
}
public void computeDerivatives(double x, double[] y, double[] dy){
dy[0]=0.01*x+y[0];
}
};
HighamHall54Integrator h54 = new HighamHall54Integrator(minstep,maxstep,abt,rt);
double [] yp={2};
double x;
double []y={7};
double y2;
for(x=1;x<10.0;x++){
h54.integrate(fode, 0, yp, x, y);
y2 = y[0];
System.out.println(x);
System.out.println(y2);
}
}
}
最終更新:2015年12月01日 00:11