org.apache.commons.math3.special.Gamma.logGamma1p()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中org.apache.commons.math3.special.Gamma.logGamma1p()方法的一些代码示例,展示了Gamma.logGamma1p()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Gamma.logGamma1p()方法的具体详情如下:
包路径:org.apache.commons.math3.special.Gamma
类名称:Gamma
方法名:logGamma1p

Gamma.logGamma1p介绍

[英]Returns the value of log Γ(1 + x) for -0.5 ≤ x ≤ 1.5. This implementation is based on the double precision implementation in the NSWC Library of Mathematics Subroutines, DGMLN1.
[中]返回-0.5的logΓ(1+x)值≤ 十、≤ 1.5. 此实现基于NSWC数学子程序库,DGMLN1中的双精度实现。

代码示例

代码示例来源:origin: org.apache.commons/commons-math3

/**
 * Returns the value of log Γ(a + b) for 1 ≤ a, b ≤ 2. Based on the
 * <em>NSWC Library of Mathematics Subroutines</em> double precision
 * implementation, {@code DGSMLN}. In {@code BetaTest.testLogGammaSum()},
 * this private method is accessed through reflection.
 *
 * @param a First argument.
 * @param b Second argument.
 * @return the value of {@code log(Gamma(a + b))}.
 * @throws OutOfRangeException if {@code a} or {@code b} is lower than
 * {@code 1.0} or greater than {@code 2.0}.
 */
private static double logGammaSum(final double a, final double b)
  throws OutOfRangeException {
  if ((a < 1.0) || (a > 2.0)) {
    throw new OutOfRangeException(a, 1.0, 2.0);
  }
  if ((b < 1.0) || (b > 2.0)) {
    throw new OutOfRangeException(b, 1.0, 2.0);
  }
  final double x = (a - 1.0) + (b - 1.0);
  if (x <= 0.5) {
    return Gamma.logGamma1p(1.0 + x);
  } else if (x <= 1.5) {
    return Gamma.logGamma1p(x) + FastMath.log1p(x);
  } else {
    return Gamma.logGamma1p(x - 1.0) + FastMath.log(x * (1.0 + x));
  }
}

代码示例来源:origin: org.apache.commons/commons-math3

ret = Double.NaN;
} else if (x < 0.5) {
  return logGamma1p(x) - FastMath.log(x);
} else if (x <= 2.5) {
  return logGamma1p((x - 0.5) - 0.5);
} else if (x <= 8.0) {
  final int n = (int) FastMath.floor(x - 1.5);
    prod *= x - i;
  return logGamma1p(x - (n + 1)) + FastMath.log(prod);
} else {
  double sum = lanczos(x);

代码示例来源:origin: geogebra/geogebra

ret = Double.NaN;
} else if (x < 0.5) {
  return logGamma1p(x) - Math.log(x);
} else if (x <= 2.5) {
  return logGamma1p((x - 0.5) - 0.5);
} else if (x <= 8.0) {
  final int n = (int) Math.floor(x - 1.5);
    prod *= x - i;
  return logGamma1p(x - (n + 1)) + Math.log(prod);
} else {
  double sum = lanczos(x);

代码示例来源:origin: geogebra/geogebra

/**
 * Returns the value of log ?(a + b) for 1 ? a, b ? 2. Based on the
 * <em>NSWC Library of Mathematics Subroutines</em> double precision
 * implementation, {@code DGSMLN}. In {@code BetaTest.testLogGammaSum()},
 * this private method is accessed through reflection.
 *
 * @param a First argument.
 * @param b Second argument.
 * @return the value of {@code log(Gamma(a + b))}.
 * @throws OutOfRangeException if {@code a} or {@code b} is lower than
 * {@code 1.0} or greater than {@code 2.0}.
 */
private static double logGammaSum(final double a, final double b)
  throws OutOfRangeException {
  if ((a < 1.0) || (a > 2.0)) {
    throw new OutOfRangeException(a, 1.0, 2.0);
  }
  if ((b < 1.0) || (b > 2.0)) {
    throw new OutOfRangeException(b, 1.0, 2.0);
  }
  final double x = (a - 1.0) + (b - 1.0);
  if (x <= 0.5) {
    return Gamma.logGamma1p(1.0 + x);
  } else if (x <= 1.5) {
    return Gamma.logGamma1p(x) + Math.log1p(x);
  } else {
    return Gamma.logGamma1p(x - 1.0) + Math.log(x * (1.0 + x));
  }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * Returns the value of log Γ(a + b) for 1 ≤ a, b ≤ 2. Based on the
 * <em>NSWC Library of Mathematics Subroutines</em> double precision
 * implementation, {@code DGSMLN}. In {@code BetaTest.testLogGammaSum()},
 * this private method is accessed through reflection.
 *
 * @param a First argument.
 * @param b Second argument.
 * @return the value of {@code log(Gamma(a + b))}.
 * @throws OutOfRangeException if {@code a} or {@code b} is lower than
 * {@code 1.0} or greater than {@code 2.0}.
 */
private static double logGammaSum(final double a, final double b)
  throws OutOfRangeException {
  if ((a < 1.0) || (a > 2.0)) {
    throw new OutOfRangeException(a, 1.0, 2.0);
  }
  if ((b < 1.0) || (b > 2.0)) {
    throw new OutOfRangeException(b, 1.0, 2.0);
  }
  final double x = (a - 1.0) + (b - 1.0);
  if (x <= 0.5) {
    return Gamma.logGamma1p(1.0 + x);
  } else if (x <= 1.5) {
    return Gamma.logGamma1p(x) + FastMath.log1p(x);
  } else {
    return Gamma.logGamma1p(x - 1.0) + FastMath.log(x * (1.0 + x));
  }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

ret = Double.NaN;
} else if (x < 0.5) {
  return logGamma1p(x) - FastMath.log(x);
} else if (x <= 2.5) {
  return logGamma1p((x - 0.5) - 0.5);
} else if (x <= 8.0) {
  final int n = (int) FastMath.floor(x - 1.5);
    prod *= x - i;
  return logGamma1p(x - (n + 1)) + FastMath.log(prod);
} else {
  double sum = lanczos(x);

相关文章