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


Java MathUtils.binomialCoefficientDouble方法代码示例

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


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

示例1: choose

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
public static double choose(double n, int k) {
  /*
   * Because gamma(a+1) = factorial(a)
   * we use gamma(n+1) /(gamma(n-k+1) * gamma(k+1)) instead of
   * Binomial(n,k) = n! / ((n-k)! * k!) for non-integer n values.
   * 
   */
  if (k < 0) {
    return (0);
  } else if (k == 0) {
    return (1);
  } else if ((int) n == n) {
    return (MathUtils.binomialCoefficientDouble((int) n, k));
  } else {
    return (MathExt.gamma(n + 1) / (MathExt.gamma(n - k + 1) * MathExt.gamma(k + 1)));
  }
}
 
开发者ID:CompEvol,项目名称:beastshell,代码行数:18,代码来源:MathExt.java

示例2: probability

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * For this distribution, X, this method returns P(X = x).
 * @param x the value at which the PMF is evaluated
 * @return PMF for this distribution
 */
public double probability(int x) {
    double ret;
    if (x < 0) {
        ret = 0.0;
    } else {
        ret = MathUtils.binomialCoefficientDouble(x +
              getNumberOfSuccesses() - 1, getNumberOfSuccesses() - 1) *
              Math.pow(getProbabilityOfSuccess(), getNumberOfSuccesses()) *
              Math.pow(1.0 - getProbabilityOfSuccess(), x);
    }
    return ret;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:18,代码来源:PascalDistributionImpl.java

示例3: probability

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * For this disbution, X, this method returns P(X = x).
 * 
 * @param x the value at which the PMF is evaluated.
 * @return PMF for this distribution. 
 */
public double probability(int x) {
    double ret;
    if (x < 0 || x > getNumberOfTrials()) {
        ret = 0.0;
    } else {
        ret = MathUtils.binomialCoefficientDouble(
                getNumberOfTrials(), x) *
              Math.pow(getProbabilityOfSuccess(), x) *
              Math.pow(1.0 - getProbabilityOfSuccess(),
                    getNumberOfTrials() - x);
    }
    return ret;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:20,代码来源:BinomialDistributionImpl.java

示例4: probability

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
    * For this distribution, X, this method returns P(X = x).
    *
    * @param x the value at which the PMF is evaluated
    * @return PMF for this distribution
    */
   @Override
public double probability(int x) {
       double ret;
       if (x < 0) {
           ret = 0.0;
       } else {
           ret = MathUtils.binomialCoefficientDouble(x +
                   numberOfSuccesses - 1, numberOfSuccesses - 1) *
                   Math.pow(probabilityOfSuccess, numberOfSuccesses) *
                   Math.pow(1.0 - probabilityOfSuccess, x);
       }
       return ret;
   }
 
开发者ID:CompEvol,项目名称:beast2,代码行数:20,代码来源:PascalDistributionImpl.java

示例5: probability

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * For this distribution, {@code X}, this method returns {@code P(X = x)}.
 *
 * @param x Value at which the PMF is evaluated.
 * @return PMF for this distribution.
 */
public double probability(int x) {
    double ret;
    if (x < 0) {
        ret = 0.0;
    } else {
        ret = MathUtils.binomialCoefficientDouble(x +
              numberOfSuccesses - 1, numberOfSuccesses - 1) *
              FastMath.pow(probabilityOfSuccess, numberOfSuccesses) *
              FastMath.pow(1.0 - probabilityOfSuccess, x);
    }
    return ret;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:19,代码来源:PascalDistributionImpl.java

示例6: probability

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * For this distribution, X, this method returns P(X = x).
 * @param x the value at which the PMF is evaluated
 * @return PMF for this distribution
 */
public double probability(int x) {
    double ret;
    if (x < 0) {
        ret = 0.0;
    } else {
        ret = MathUtils.binomialCoefficientDouble(x +
              numberOfSuccesses - 1, numberOfSuccesses - 1) *
              Math.pow(probabilityOfSuccess, numberOfSuccesses) *
              Math.pow(1.0 - probabilityOfSuccess, x);
    }
    return ret;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:18,代码来源:PascalDistributionImpl.java

示例7: probability

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * For this distribution, X, this method returns P(X = x).
 * 
 * @param x the value at which the PMF is evaluated.
 * @return PMF for this distribution. 
 */
public double probability(int x) {
    double ret;
    if (x < 0 || x > getNumberOfTrials()) {
        ret = 0.0;
    } else {
        ret = MathUtils.binomialCoefficientDouble(
                getNumberOfTrials(), x) *
              Math.pow(getProbabilityOfSuccess(), x) *
              Math.pow(1.0 - getProbabilityOfSuccess(),
                    getNumberOfTrials() - x);
    }
    return ret;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:20,代码来源:BinomialDistributionImpl.java

示例8: probability

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * For this distribution, X, this method returns P(X = x).
 * 
 * @param x the value at which the PMF is evaluated
 * @return PMF for this distribution 
 */
public double probability(int x) {
    double ret;
    if (x < 0) {
        ret = 0.0;
    } else {
        ret = MathUtils.binomialCoefficientDouble(x + getNumberOfSuccesses() - 1,
                getNumberOfSuccesses() - 1) *
              Math.pow(getProbabilityOfSuccess(), getNumberOfSuccesses()) *
              Math.pow(1.0 - getProbabilityOfSuccess(),
                    x);
    }
    return ret;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:20,代码来源:PascalDistributionImpl.java


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