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


Java CombinatoricsUtils.factorialDouble方法代码示例

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


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

示例1: generate

import org.apache.commons.math3.util.CombinatoricsUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public GaussianQuadratureData generate(int n) {
  ArgChecker.isTrue(n > 0, "n > 0");
  Pair<DoubleFunction1D, DoubleFunction1D>[] polynomials = JACOBI.getPolynomialsAndFirstDerivative(n, _alpha, _beta);
  Pair<DoubleFunction1D, DoubleFunction1D> pair = polynomials[n];
  DoubleFunction1D previous = polynomials[n - 1].getFirst();
  DoubleFunction1D function = pair.getFirst();
  DoubleFunction1D derivative = pair.getSecond();
  double[] x = new double[n];
  double[] w = new double[n];
  double root = 0;
  for (int i = 0; i < n; i++) {
    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.applyAsDouble(_alpha + n) * GAMMA_FUNCTION.applyAsDouble(_beta + n) /
            CombinatoricsUtils.factorialDouble(n) / GAMMA_FUNCTION.applyAsDouble(n + _c + 1) * d *
            Math.pow(2, _c)
            / (derivative.applyAsDouble(root) * previous.applyAsDouble(root));
  }
  return new GaussianQuadratureData(x, w);
}
 
开发者ID:OpenGamma,项目名称:Strata,代码行数:28,代码来源:GaussJacobiWeightAndAbscissaFunction.java

示例2: generate

import org.apache.commons.math3.util.CombinatoricsUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public GaussianQuadratureData generate(int n) {
  ArgChecker.isTrue(n > 0);
  Pair<DoubleFunction1D, DoubleFunction1D>[] polynomials = LAGUERRE.getPolynomialsAndFirstDerivative(n, _alpha);
  Pair<DoubleFunction1D, DoubleFunction1D> pair = polynomials[n];
  DoubleFunction1D p1 = polynomials[n - 1].getFirst();
  DoubleFunction1D function = pair.getFirst();
  DoubleFunction1D derivative = pair.getSecond();
  double[] x = new double[n];
  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.applyAsDouble(_alpha + n) / CombinatoricsUtils.factorialDouble(n) /
            (derivative.applyAsDouble(root) * p1.applyAsDouble(root));
  }
  return new GaussianQuadratureData(x, w);
}
 
开发者ID:OpenGamma,项目名称:Strata,代码行数:24,代码来源:GaussLaguerreWeightAndAbscissaFunction.java

示例3: factorial

import org.apache.commons.math3.util.CombinatoricsUtils; //导入方法依赖的package包/类
@Override
public ASTNodeValue factorial(ASTNode value) throws SBMLException {
	double v = toDouble(value);
	double roundedV = FastMath.round(v);

	if (v != roundedV) {
		throw new IllegalArgumentException("factorial cannot be computed from floating point number: " + v);
	}

	return new ASTNodeValue(CombinatoricsUtils.factorialDouble((int) roundedV), this);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:12,代码来源:Parser.java


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