当前位置: 首页>>代码示例>>Java>>正文


Java StepInterpolator.getInterpolatedState方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:26,代码来源:DormandPrince54IntegratorTest.java

示例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);
  }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:19,代码来源:ThreeEighthesIntegratorTest.java

示例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);
  }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:19,代码来源:ClassicalRungeKuttaIntegratorTest.java

示例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);
  }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:26,代码来源:DormandPrince853IntegratorTest.java

示例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);
  }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:26,代码来源:GraggBulirschStoerIntegratorTest.java

示例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);
  }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:19,代码来源:GillIntegratorTest.java

示例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);
    }
    */
    
}
 
开发者ID:mrc-ide,项目名称:PhyDyn,代码行数:32,代码来源:PopModelODE.java

示例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);
            }
        }
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:15,代码来源:LutherIntegratorTest.java


注:本文中的org.apache.commons.math3.ode.sampling.StepInterpolator.getInterpolatedState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。