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


Java AdamsBashforthIntegrator类代码示例

本文整理汇总了Java中org.apache.commons.math3.ode.nonstiff.AdamsBashforthIntegrator的典型用法代码示例。如果您正苦于以下问题:Java AdamsBashforthIntegrator类的具体用法?Java AdamsBashforthIntegrator怎么用?Java AdamsBashforthIntegrator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AdamsBashforthIntegrator类属于org.apache.commons.math3.ode.nonstiff包,在下文中一共展示了AdamsBashforthIntegrator类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: derivativesConsistency

import org.apache.commons.math3.ode.nonstiff.AdamsBashforthIntegrator; //导入依赖的package包/类
@Test
public void derivativesConsistency()
    throws NumberIsTooSmallException, DimensionMismatchException,
           MaxCountExceededException, NoBracketingException {
    TestProblem3 pb = new TestProblem3();
    AdamsBashforthIntegrator integ = new AdamsBashforthIntegrator(4, 0.0, 1.0, 1.0e-10, 1.0e-10);
    StepInterpolatorTestUtils.checkDerivativesConsistency(integ, pb, 5e-9);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:9,代码来源:NordsieckStepInterpolatorTest.java

示例2: AdamsBashforthSolver

import org.apache.commons.math3.ode.nonstiff.AdamsBashforthIntegrator; //导入依赖的package包/类
public AdamsBashforthSolver(final int nSteps, final double minStep, final double maxStep,
		final double scalAbsoluteTolerance, final double scalRelativeTolerance,
		final GamaMap<String, IList<Double>> integrated_val) {
	super((minStep + maxStep) / 2,
			new AdamsBashforthIntegrator(nSteps, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance),
			integrated_val);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:8,代码来源:AdamsBashforthSolver.java

示例3: serialization

import org.apache.commons.math3.ode.nonstiff.AdamsBashforthIntegrator; //导入依赖的package包/类
@Test
public void serialization()
throws IOException, ClassNotFoundException,
       NumberIsTooSmallException, DimensionMismatchException,
       MaxCountExceededException, NoBracketingException {

    TestProblem1 pb = new TestProblem1();
    AdamsBashforthIntegrator integ = new AdamsBashforthIntegrator(4, 0.0, 1.0, 1.0e-10, 1.0e-10);
    integ.addStepHandler(new ContinuousOutputModel());
    integ.integrate(pb,
                    pb.getInitialTime(), pb.getInitialState(),
                    pb.getFinalTime(), new double[pb.getDimension()]);

    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream    oos = new ObjectOutputStream(bos);
    for (StepHandler handler : integ.getStepHandlers()) {
        oos.writeObject(handler);
    }

    Assert.assertTrue(bos.size () >  25500);
    Assert.assertTrue(bos.size () <  26500);

    ByteArrayInputStream  bis = new ByteArrayInputStream(bos.toByteArray());
    ObjectInputStream     ois = new ObjectInputStream(bis);
    ContinuousOutputModel cm  = (ContinuousOutputModel) ois.readObject();

    Random random = new Random(347588535632l);
    double maxError = 0.0;
    for (int i = 0; i < 1000; ++i) {
        double r = random.nextDouble();
        double time = r * pb.getInitialTime() + (1.0 - r) * pb.getFinalTime();
        cm.setInterpolatedTime(time);
        double[] interpolatedY = cm.getInterpolatedState ();
        double[] theoreticalY  = pb.computeTheoreticalState(time);
        double dx = interpolatedY[0] - theoreticalY[0];
        double dy = interpolatedY[1] - theoreticalY[1];
        double error = dx * dx + dy * dy;
        if (error > maxError) {
            maxError = error;
        }
    }

    Assert.assertTrue(maxError < 1.0e-6);

}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:46,代码来源:NordsieckStepInterpolatorTest.java


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