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


Java MathUtils.factorialDouble方法代码示例

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


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

示例1: generate

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public GaussianQuadratureData generate(final int n) {
  Validate.isTrue(n > 0, "n > 0");
  final Pair<DoubleFunction1D, DoubleFunction1D>[] polynomials = JACOBI.getPolynomialsAndFirstDerivative(n, _alpha, _beta);
  final Pair<DoubleFunction1D, DoubleFunction1D> pair = polynomials[n];
  final DoubleFunction1D previous = polynomials[n - 1].getFirst();
  final DoubleFunction1D function = pair.getFirst();
  final DoubleFunction1D derivative = pair.getSecond();
  final double[] x = new double[n];
  final double[] w = new double[n];
  double root = 0;
  for (int i = 0; i < n; i++) {
    final double d = 2 * n + _c;
    root = getInitialRootGuess(root, i, n, x);
    root = ROOT_FINDER.getRoot(function, derivative, root);
    x[i] = root;
    w[i] = GAMMA_FUNCTION.evaluate(_alpha + n) * GAMMA_FUNCTION.evaluate(_beta + n) / MathUtils.factorialDouble(n) / GAMMA_FUNCTION.evaluate(n + _c + 1) * d * Math.pow(2, _c)
        / (derivative.evaluate(root) * previous.evaluate(root));
  }
  return new GaussianQuadratureData(x, w);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:25,代码来源:GaussJacobiWeightAndAbscissaFunction.java

示例2: generate

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public GaussianQuadratureData generate(final int n) {
  Validate.isTrue(n > 0);
  final Pair<DoubleFunction1D, DoubleFunction1D>[] polynomials = LAGUERRE.getPolynomialsAndFirstDerivative(n, _alpha);
  final Pair<DoubleFunction1D, DoubleFunction1D> pair = polynomials[n];
  final DoubleFunction1D p1 = polynomials[n - 1].getFirst();
  final DoubleFunction1D function = pair.getFirst();
  final DoubleFunction1D derivative = pair.getSecond();
  final double[] x = new double[n];
  final double[] w = new double[n];
  double root = 0;
  for (int i = 0; i < n; i++) {
    root = ROOT_FINDER.getRoot(function, derivative, getInitialRootGuess(root, i, n, x));
    x[i] = root;
    w[i] = -GAMMA_FUNCTION.evaluate(_alpha + n) / MathUtils.factorialDouble(n) / (derivative.evaluate(root) * p1.evaluate(root));
  }
  return new GaussianQuadratureData(x, w);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:22,代码来源:GaussLaguerreWeightAndAbscissaFunction.java

示例3: probability

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * The probability mass function P(X = x) for a Poisson distribution.
 * 
 * @param x the value at which the probability density function is evaluated.
 * @return the value of the probability mass function at x
 */
public double probability(int x) {
    if (x < 0 || x == Integer.MAX_VALUE) {
        return 0;
    }
    return Math.pow(getMean(), x) / 
        MathUtils.factorialDouble(x) * Math.exp(-mean);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:14,代码来源:PoissonDistributionImpl.java

示例4: FACTDOUBLE

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
public double FACTDOUBLE(int number) {
	return MathUtils.factorialDouble(number);
}
 
开发者ID:netxilia,项目名称:netxilia,代码行数:4,代码来源:MathFunctions.java


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