本文整理汇总了Java中org.apache.commons.math3.ode.sampling.StepInterpolator.getInterpolatedState方法的典型用法代码示例。如果您正苦于以下问题:Java StepInterpolator.getInterpolatedState方法的具体用法?Java StepInterpolator.getInterpolatedState怎么用?Java StepInterpolator.getInterpolatedState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.ode.sampling.StepInterpolator
的用法示例。
在下文中一共展示了StepInterpolator.getInterpolatedState方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入方法依赖的package包/类
public void handleStep(StepInterpolator interpolator, boolean isLast)
throws MaxCountExceededException {
++nbSteps;
for (int a = 1; a < 10; ++a) {
double prev = interpolator.getPreviousTime();
double curr = interpolator.getCurrentTime();
double interp = ((10 - a) * prev + a * curr) / 10;
interpolator.setInterpolatedTime(interp);
double[] interpolatedY = interpolator.getInterpolatedState ();
double[] theoreticalY = pb.computeTheoreticalState(interpolator.getInterpolatedTime());
double dx = interpolatedY[0] - theoreticalY[0];
double dy = interpolatedY[1] - theoreticalY[1];
double error = dx * dx + dy * dy;
if (error > maxError) {
maxError = error;
}
}
if (isLast) {
Assert.assertTrue(maxError < 7.0e-10);
Assert.assertTrue(nbSteps < 400);
}
}
示例2: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入方法依赖的package包/类
public void handleStep(StepInterpolator interpolator, boolean isLast)
throws MaxCountExceededException {
double[] interpolatedY = interpolator.getInterpolatedState();
double[] theoreticalY = pb.computeTheoreticalState(interpolator.getCurrentTime());
double dx = interpolatedY[0] - theoreticalY[0];
double dy = interpolatedY[1] - theoreticalY[1];
double error = dx * dx + dy * dy;
if (error > maxError) {
maxError = error;
}
if (isLast) {
// even with more than 1000 evaluations per period,
// RK4 is not able to integrate such an eccentric
// orbit with a good accuracy
Assert.assertTrue(maxError > 0.005);
}
}
示例3: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入方法依赖的package包/类
public void handleStep(StepInterpolator interpolator, boolean isLast)
throws MaxCountExceededException {
double[] interpolatedY = interpolator.getInterpolatedState ();
double[] theoreticalY = pb.computeTheoreticalState(interpolator.getCurrentTime());
double dx = interpolatedY[0] - theoreticalY[0];
double dy = interpolatedY[1] - theoreticalY[1];
double error = dx * dx + dy * dy;
if (error > maxError) {
maxError = error;
}
if (isLast) {
// even with more than 1000 evaluations per period,
// RK4 is not able to integrate such an eccentric
// orbit with a good accuracy
Assert.assertTrue(maxError > 0.005);
}
}
示例4: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入方法依赖的package包/类
public void handleStep(StepInterpolator interpolator, boolean isLast)
throws MaxCountExceededException {
++nbSteps;
for (int a = 1; a < 10; ++a) {
double prev = interpolator.getPreviousTime();
double curr = interpolator.getCurrentTime();
double interp = ((10 - a) * prev + a * curr) / 10;
interpolator.setInterpolatedTime(interp);
double[] interpolatedY = interpolator.getInterpolatedState ();
double[] theoreticalY = pb.computeTheoreticalState(interpolator.getInterpolatedTime());
double dx = interpolatedY[0] - theoreticalY[0];
double dy = interpolatedY[1] - theoreticalY[1];
double error = dx * dx + dy * dy;
if (error > maxError) {
maxError = error;
}
}
if (isLast) {
Assert.assertTrue(maxError < 2.4e-10);
Assert.assertTrue(nbSteps < 150);
}
}
示例5: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入方法依赖的package包/类
public void handleStep(StepInterpolator interpolator, boolean isLast)
throws MaxCountExceededException {
++nbSteps;
for (int a = 1; a < 100; ++a) {
double prev = interpolator.getPreviousTime();
double curr = interpolator.getCurrentTime();
double interp = ((100 - a) * prev + a * curr) / 100;
interpolator.setInterpolatedTime(interp);
double[] interpolatedY = interpolator.getInterpolatedState ();
double[] theoreticalY = pb.computeTheoreticalState(interpolator.getInterpolatedTime());
double dx = interpolatedY[0] - theoreticalY[0];
double dy = interpolatedY[1] - theoreticalY[1];
double error = dx * dx + dy * dy;
if (error > maxError) {
maxError = error;
}
}
if (isLast) {
Assert.assertTrue(maxError < 2.7e-6);
Assert.assertTrue(nbSteps < 80);
}
}
示例6: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入方法依赖的package包/类
public void handleStep(StepInterpolator interpolator, boolean isLast)
throws MaxCountExceededException {
double[] interpolatedY = interpolator.getInterpolatedState();
double[] theoreticalY = pb.computeTheoreticalState(interpolator.getCurrentTime());
double dx = interpolatedY[0] - theoreticalY[0];
double dy = interpolatedY[1] - theoreticalY[1];
double error = dx * dx + dy * dy;
if (error > maxError) {
maxError = error;
}
if (isLast) {
// even with more than 1000 evaluations per period,
// RK4 is not able to integrate such an eccentric
// orbit with a good accuracy
Assert.assertTrue(maxError > 0.001);
}
}
示例7: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入方法依赖的package包/类
@Override
public void handleStep(StepInterpolator interpolator, boolean isLast) throws MaxCountExceededException {
double t = interpolator.getCurrentTime();
double[] y = interpolator.getInterpolatedState();
// make sure all y's are positive. Yes, then can become negative
for(int i=0; i<y.length;i++)
if (y[i]< 0) y[i]=0.0;
// System.out.println("--> Step handler: "+t);
timeseries.addY(t,y);
this.updateMatrices(t, y);
timeseries.addFG(t, births, migrations);
/* -- trying to optimise -too many special cases
if (this.fixedStepSize) {
timeseries.addY(t,y);
if (isLast) { // Final step in series
//System.out.println("Last iteration");
double[] yDot = new double[y.length];
this.computeDerivatives(t, y, yDot);
}
} else {
timeseries.addY(t,y);
// add last-computed FG matrices
timeseries.addFG(t,this.births,this.migrations);
}
*/
}
示例8: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入方法依赖的package包/类
public void handleStep(StepInterpolator interpolator, boolean isLast) {
double[] interpolatedY = interpolator.getInterpolatedState ();
double[] theoreticalY = pb.computeTheoreticalState(interpolator.getCurrentTime());
double dx = interpolatedY[0] - theoreticalY[0];
double dy = interpolatedY[1] - theoreticalY[1];
double error = dx * dx + dy * dy;
if (error > maxError) {
maxError = error;
}
if (isLast) {
Assert.assertTrue(maxError < 2.2e-7);
}
}