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


Java GaussIntegrator.integrate方法代码示例

本文整理汇总了Java中org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator.integrate方法的典型用法代码示例。如果您正苦于以下问题:Java GaussIntegrator.integrate方法的具体用法?Java GaussIntegrator.integrate怎么用?Java GaussIntegrator.integrate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator的用法示例。


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

示例1: stage

import org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator; //导入方法依赖的package包/类
/**
 * Compute the n-th stage integral.
 *
 * @param n Number of steps.
 * @return the value of n-th stage integral.
 * @throws TooManyEvaluationsException if the maximum number of evaluations
 * is exceeded.
 */
private double stage(final int n)
    throws TooManyEvaluationsException {
    // Function to be integrated is stored in the base class.
    final UnivariateFunction f = new UnivariateFunction() {
            public double value(double x)
                throws MathIllegalArgumentException, TooManyEvaluationsException {
                return computeObjectiveValue(x);
            }
        };

    final double min = getMin();
    final double max = getMax();
    final double step = (max - min) / n;

    double sum = 0;
    for (int i = 0; i < n; i++) {
        // Integrate over each sub-interval [a, b].
        final double a = min + i * step;
        final double b = a + step;
        final GaussIntegrator g = FACTORY.legendreHighPrecision(numberOfPoints, a, b);
        sum += g.integrate(f);
    }

    return sum;
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:34,代码来源:IterativeLegendreGaussIntegrator.java

示例2: stage

import org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator; //导入方法依赖的package包/类
/**
 * Compute the n-th stage integral.
 *
 * @param n Number of steps.
 * @return the value of n-th stage integral.
 * @throws TooManyEvaluationsException if the maximum number of evaluations
 * is exceeded.
 */
private double stage(final int n)
    throws TooManyEvaluationsException {
    // Function to be integrated is stored in the base class.
    final UnivariateFunction f = new UnivariateFunction() {
            public double value(double x) {
                return computeObjectiveValue(x);
            }
        };

    final double min = getMin();
    final double max = getMax();
    final double step = (max - min) / n;

    double sum = 0;
    for (int i = 0; i < n; i++) {
        // Integrate over each sub-interval [a, b].
        final double a = min + i * step;
        final double b = a + step;
        final GaussIntegrator g = FACTORY.legendreHighPrecision(numberOfPoints, a, b);
        sum += g.integrate(f);
    }

    return sum;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:33,代码来源:IterativeLegendreGaussIntegrator.java

示例3: stage

import org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator; //导入方法依赖的package包/类
/**
 * Compute the n-th stage integral.
 *
 * @param n Number of steps.
 * @return the value of n-th stage integral.
 * @throws TooManyEvaluationsException if the maximum number of evaluations
 * is exceeded.
 */
private double stage(final int n)
    throws TooManyEvaluationsException {
    // Function to be integrated is stored in the base class.
    final UnivariateFunction f = new UnivariateFunction() {
            /** {@inheritDoc} */
            public double value(double x)
                throws MathIllegalArgumentException, TooManyEvaluationsException {
                return computeObjectiveValue(x);
            }
        };

    final double min = getMin();
    final double max = getMax();
    final double step = (max - min) / n;

    double sum = 0;
    for (int i = 0; i < n; i++) {
        // Integrate over each sub-interval [a, b].
        final double a = min + i * step;
        final double b = a + step;
        final GaussIntegrator g = FACTORY.legendreHighPrecision(numberOfPoints, a, b);
        sum += g.integrate(f);
    }

    return sum;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:35,代码来源:IterativeLegendreGaussIntegrator.java


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