/** {@inheritDoc} */ @Override protected double doIntegrate() throws TooManyEvaluationsException, MaxCountExceededException { TrapezoidIntegrator qtrap = new TrapezoidIntegrator(); if (getMinimalIterationCount() == 1) { return (4 * qtrap.stage(this, 1) - qtrap.stage(this, 0)) / 3.0; } // Simpson's rule requires at least two trapezoid stages. double olds = 0; double oldt = qtrap.stage(this, 0); while (true) { final double t = qtrap.stage(this, getIterations()); incrementCount(); final double s = (4 * t - oldt) / 3.0; if (getIterations() >= getMinimalIterationCount()) { final double delta = FastMath.abs(s - olds); final double rLimit = getRelativeAccuracy() * (FastMath.abs(olds) + FastMath.abs(s)) * 0.5; if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) { return s; } } olds = s; oldt = t; } }
/** {@inheritDoc} */ @Override protected double doIntegrate() throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException { double oldt = stage(this, 0); incrementCount(); while (true) { final int i = getIterations(); final double t = stage(this, i); if (i >= getMinimalIterationCount()) { final double delta = FastMath.abs(t - oldt); final double rLimit = getRelativeAccuracy() * (FastMath.abs(oldt) + FastMath.abs(t)) * 0.5; if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) { return t; } } oldt = t; incrementCount(); } }
/** {@inheritDoc} */ @Override protected double doIntegrate() throws TooManyEvaluationsException, MaxCountExceededException { TrapezoidIntegrator qtrap = new TrapezoidIntegrator(); if (getMinimalIterationCount() == 1) { return (4 * qtrap.stage(this, 1) - qtrap.stage(this, 0)) / 3.0; } // Simpson's rule requires at least two trapezoid stages. double olds = 0; double oldt = qtrap.stage(this, 0); while (true) { final double t = qtrap.stage(this, getIterations()); incrementCount(); final double s = (4 * t - oldt) / 3.0; if (getIterations() >= getMinimalIterationCount()) { final double delta = Math.abs(s - olds); final double rLimit = getRelativeAccuracy() * (Math.abs(olds) + Math.abs(s)) * 0.5; if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) { return s; } } olds = s; oldt = t; } }
/** {@inheritDoc} */ @Override protected double doIntegrate() throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException { double oldt = stage(this, 0); incrementCount(); while (true) { final int i = getIterations(); final double t = stage(this, i); if (i >= getMinimalIterationCount()) { final double delta = Math.abs(t - oldt); final double rLimit = getRelativeAccuracy() * (Math.abs(oldt) + Math.abs(t)) * 0.5; if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) { return t; } } oldt = t; incrementCount(); } }
/** {@inheritDoc} */ @Override protected double doIntegrate() throws TooManyEvaluationsException, MaxCountExceededException { TrapezoidIntegrator qtrap = new TrapezoidIntegrator(); if (getMinimalIterationCount() == 1) { return (4 * qtrap.stage(this, 1) - qtrap.stage(this, 0)) / 3.0; } // Simpson's rule requires at least two trapezoid stages. double olds = 0; double oldt = qtrap.stage(this, 0); while (true) { final double t = qtrap.stage(this, getIterations()); incrementCount(); final double s = (4 * t - oldt) / 3.0; if (getIterations() >= getMinimalIterationCount()) { final double delta = FastMath.abs(s - olds); final double rLimit = getRelativeAccuracy() * (FastMath.abs(olds) + FastMath.abs(s)) * 0.5; if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) { return s; } } olds = s; oldt = t; } }
/** {@inheritDoc} */ @Override protected double doIntegrate() throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException { double oldt = stage(this, 0); incrementCount(); while (true) { final int i = getIterations(); final double t = stage(this, i); if (i >= getMinimalIterationCount()) { final double delta = FastMath.abs(t - oldt); final double rLimit = getRelativeAccuracy() * (FastMath.abs(oldt) + FastMath.abs(t)) * 0.5; if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) { return t; } } oldt = t; incrementCount(); } }