本文整理汇总了Java中org.apache.commons.math3.analysis.integration.SimpsonIntegrator类的典型用法代码示例。如果您正苦于以下问题:Java SimpsonIntegrator类的具体用法?Java SimpsonIntegrator怎么用?Java SimpsonIntegrator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpsonIntegrator类属于org.apache.commons.math3.analysis.integration包,在下文中一共展示了SimpsonIntegrator类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: cumulativeProbabilityIsOneWithRealData
import org.apache.commons.math3.analysis.integration.SimpsonIntegrator; //导入依赖的package包/类
private void cumulativeProbabilityIsOneWithRealData(final double mu, double min, double max, boolean test)
{
double p = 0;
UnivariateIntegrator in = new SimpsonIntegrator();
p = in.integrate(20000, new UnivariateFunction()
{
public double value(double x)
{
double v;
v = PoissonCalculator.likelihood(mu, x);
//v = pgf.probability(x, mu);
//System.out.printf("x=%f, v=%f\n", x, v);
return v;
}
}, min, max);
System.out.printf("mu=%f, p=%f\n", mu, p);
if (test)
{
Assert.assertEquals(String.format("mu=%f", mu), P_LIMIT, p, 0.02);
}
}
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:25,代码来源:PoissonCalculatorTest.java
示例2: cumulativeProbabilityIsOneWithRealData
import org.apache.commons.math3.analysis.integration.SimpsonIntegrator; //导入依赖的package包/类
private void cumulativeProbabilityIsOneWithRealData(final double mu, int max)
{
double p = 0;
SimpsonIntegrator in = new SimpsonIntegrator();
p = in.integrate(20000, new UnivariateFunction()
{
public double value(double x)
{
return PoissonLikelihoodWrapper.likelihood(mu, x);
}
}, 0, max);
System.out.printf("mu=%f, p=%f\n", mu, p);
Assert.assertEquals(String.format("mu=%f", mu), 1, p, 0.02);
}
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:18,代码来源:PoissonLikelihoodWrapperTest.java
示例3: calcEffectiveAlpha
import org.apache.commons.math3.analysis.integration.SimpsonIntegrator; //导入依赖的package包/类
protected double calcEffectiveAlpha(final double[] effectivePhis) {
final QAlphaUnivariateFunction qAlpha = new QAlphaUnivariateFunction(effectivePhis);
final AQAlphaUnivariateFunction aQAlpha = new AQAlphaUnivariateFunction(effectivePhis);
final BaseAbstractUnivariateIntegrator integrator = new SimpsonIntegrator();
final double numerator = integrator.integrate(10, aQAlpha, MIN_E_ELPHA_INTEGRATION_RANGE, MAX_E_ELPHA_INTEGRATION_RANGE);
final double denominator = integrator.integrate(10, qAlpha, MIN_E_ELPHA_INTEGRATION_RANGE, MAX_E_ELPHA_INTEGRATION_RANGE);
return numerator/denominator;
}
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:12,代码来源:CNLOHCaller.java
示例4: execute
import org.apache.commons.math3.analysis.integration.SimpsonIntegrator; //导入依赖的package包/类
/**
* Calculates the integral of the given time series using the simpson integrator of commons math lib
*
* @param timeSeries the time series as argument for the chronix function
* @param functionValueMap the analysis and values result map
*/
@Override
public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) {
if (timeSeries.isEmpty()) {
functionValueMap.add(this, Double.NaN);
return;
}
SimpsonIntegrator simpsonIntegrator = new SimpsonIntegrator();
double integral = simpsonIntegrator.integrate(Integer.MAX_VALUE, x -> timeSeries.getValue((int) x), 0, timeSeries.size() - 1);
functionValueMap.add(this, integral);
}
开发者ID:ChronixDB,项目名称:chronix.server,代码行数:20,代码来源:Integral.java
示例5: getVelocity
import org.apache.commons.math3.analysis.integration.SimpsonIntegrator; //导入依赖的package包/类
public double getVelocity(double startSpeed, double startTime, double endTime){
UnivariateIntegrator integrator = new SimpsonIntegrator();
double integralAddition = 0;
if (!dEqual(startTime,endTime)) {
try {
integralAddition = startTime * integrator.integrate(10, v -> getAccel(v), startTime, endTime);
} catch (Exception e) {
System.err.println(e.getMessage());
}
}
return startSpeed + integralAddition;
}
开发者ID:ValisStigma,项目名称:LazyDrivers,代码行数:13,代码来源:Accel.java
示例6: cumulativeProbabilityIsOneWithRealAbove4
import org.apache.commons.math3.analysis.integration.SimpsonIntegrator; //导入依赖的package包/类
private void cumulativeProbabilityIsOneWithRealAbove4(final double gain, final double mu, int min, int max)
{
final double o = mu * gain;
final PoissonFunction f = new PoissonFunction(1.0 / gain, true);
double p = 0;
SimpsonIntegrator in = new SimpsonIntegrator(3, 30);
try
{
p = in.integrate(Integer.MAX_VALUE, new UnivariateFunction()
{
public double value(double x)
{
return f.likelihood(x, o);
}
}, min, max);
System.out.printf("g=%f, mu=%f, o=%f, p=%f\n", gain, mu, o, p);
Assert.assertEquals(String.format("g=%f, mu=%f", gain, mu), 1, p, 0.02);
}
catch (TooManyEvaluationsException e)
{
//double inc = max / 20000.0;
//for (double x = 0; x <= max; x += inc)
//{
// final double pp = f.likelihood(x, o);
// //System.out.printf("g=%f, mu=%f, o=%f, p=%f\n", gain, mu, o, pp);
// p += pp;
//}
//System.out.printf("g=%f, mu=%f, o=%f, p=%f\n", gain, mu, o, p);
Assert.assertFalse(e.getMessage(), true);
}
}
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:35,代码来源:PoissonFunctionTest.java
示例7: cumulativeProbabilityIsOneWithRealData
import org.apache.commons.math3.analysis.integration.SimpsonIntegrator; //导入依赖的package包/类
private void cumulativeProbabilityIsOneWithRealData(final double mu, double min, double max, boolean test)
{
double p = 0;
// Test using a standard Poisson-Gaussian convolution
//min = -max;
//final PoissonGaussianFunction pgf = PoissonGaussianFunction.createWithVariance(1, 1, VAR);
UnivariateIntegrator in = new SimpsonIntegrator();
p = in.integrate(20000, new UnivariateFunction()
{
public double value(double x)
{
double v;
v = SCMOSLikelihoodWrapper.likelihood(mu, VAR, G, O, x);
//v = pgf.probability(x, mu);
//System.out.printf("x=%f, v=%f\n", x, v);
return v;
}
}, min, max);
//System.out.printf("mu=%f, p=%f\n", mu, p);
if (test)
{
Assert.assertEquals(String.format("mu=%f", mu), P_LIMIT, p, 0.02);
}
}
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:29,代码来源:SCMOSLikelihoodWrapperTest.java
示例8: createAiryDistribution
import org.apache.commons.math3.analysis.integration.SimpsonIntegrator; //导入依赖的package包/类
private static synchronized void createAiryDistribution()
{
if (spline != null)
return;
final double relativeAccuracy = 1e-4;
final double absoluteAccuracy = 1e-8;
final int minimalIterationCount = 3;
final int maximalIterationCount = 32;
UnivariateIntegrator integrator = new SimpsonIntegrator(relativeAccuracy, absoluteAccuracy,
minimalIterationCount, maximalIterationCount);
UnivariateFunction f = new UnivariateFunction()
{
public double value(double x)
{
// The pattern profile is in one dimension.
// Multiply by the perimeter of a circle to convert to 2D volume then normalise by 4 pi
//return AiryPattern.intensity(x) * 2 * Math.PI * x / (4 * Math.PI);
return AiryPattern.intensity(x) * 0.5 * x;
}
};
// Integrate up to a set number of dark rings
int samples = 1000;
final double step = RINGS[SAMPLE_RINGS] / samples;
double to = 0, from = 0;
r = new double[samples + 1];
sum = new double[samples + 1];
for (int i = 1; i < sum.length; i++)
{
from = to;
r[i] = to = step * i;
sum[i] = integrator.integrate(2000, f, from, to) + sum[i - 1];
}
if (DoubleEquality.relativeError(sum[samples], POWER[SAMPLE_RINGS]) > 1e-3)
throw new RuntimeException("Failed to create the Airy distribution");
SplineInterpolator si = new SplineInterpolator();
spline = si.interpolate(sum, r);
}
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:43,代码来源:AiryPSFModel.java
注:本文中的org.apache.commons.math3.analysis.integration.SimpsonIntegrator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论