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

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

本文整理了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

  1. /**
  2. * Returns the value of log Γ(a + b) for 1 ≤ a, b ≤ 2. Based on the
  3. * <em>NSWC Library of Mathematics Subroutines</em> double precision
  4. * implementation, {@code DGSMLN}. In {@code BetaTest.testLogGammaSum()},
  5. * this private method is accessed through reflection.
  6. *
  7. * @param a First argument.
  8. * @param b Second argument.
  9. * @return the value of {@code log(Gamma(a + b))}.
  10. * @throws OutOfRangeException if {@code a} or {@code b} is lower than
  11. * {@code 1.0} or greater than {@code 2.0}.
  12. */
  13. private static double logGammaSum(final double a, final double b)
  14. throws OutOfRangeException {
  15. if ((a < 1.0) || (a > 2.0)) {
  16. throw new OutOfRangeException(a, 1.0, 2.0);
  17. }
  18. if ((b < 1.0) || (b > 2.0)) {
  19. throw new OutOfRangeException(b, 1.0, 2.0);
  20. }
  21. final double x = (a - 1.0) + (b - 1.0);
  22. if (x <= 0.5) {
  23. return Gamma.logGamma1p(1.0 + x);
  24. } else if (x <= 1.5) {
  25. return Gamma.logGamma1p(x) + FastMath.log1p(x);
  26. } else {
  27. return Gamma.logGamma1p(x - 1.0) + FastMath.log(x * (1.0 + x));
  28. }
  29. }

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

  1. ret = Double.NaN;
  2. } else if (x < 0.5) {
  3. return logGamma1p(x) - FastMath.log(x);
  4. } else if (x <= 2.5) {
  5. return logGamma1p((x - 0.5) - 0.5);
  6. } else if (x <= 8.0) {
  7. final int n = (int) FastMath.floor(x - 1.5);
  8. prod *= x - i;
  9. return logGamma1p(x - (n + 1)) + FastMath.log(prod);
  10. } else {
  11. double sum = lanczos(x);

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

  1. ret = Double.NaN;
  2. } else if (x < 0.5) {
  3. return logGamma1p(x) - Math.log(x);
  4. } else if (x <= 2.5) {
  5. return logGamma1p((x - 0.5) - 0.5);
  6. } else if (x <= 8.0) {
  7. final int n = (int) Math.floor(x - 1.5);
  8. prod *= x - i;
  9. return logGamma1p(x - (n + 1)) + Math.log(prod);
  10. } else {
  11. double sum = lanczos(x);

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

  1. /**
  2. * Returns the value of log ?(a + b) for 1 ? a, b ? 2. Based on the
  3. * <em>NSWC Library of Mathematics Subroutines</em> double precision
  4. * implementation, {@code DGSMLN}. In {@code BetaTest.testLogGammaSum()},
  5. * this private method is accessed through reflection.
  6. *
  7. * @param a First argument.
  8. * @param b Second argument.
  9. * @return the value of {@code log(Gamma(a + b))}.
  10. * @throws OutOfRangeException if {@code a} or {@code b} is lower than
  11. * {@code 1.0} or greater than {@code 2.0}.
  12. */
  13. private static double logGammaSum(final double a, final double b)
  14. throws OutOfRangeException {
  15. if ((a < 1.0) || (a > 2.0)) {
  16. throw new OutOfRangeException(a, 1.0, 2.0);
  17. }
  18. if ((b < 1.0) || (b > 2.0)) {
  19. throw new OutOfRangeException(b, 1.0, 2.0);
  20. }
  21. final double x = (a - 1.0) + (b - 1.0);
  22. if (x <= 0.5) {
  23. return Gamma.logGamma1p(1.0 + x);
  24. } else if (x <= 1.5) {
  25. return Gamma.logGamma1p(x) + Math.log1p(x);
  26. } else {
  27. return Gamma.logGamma1p(x - 1.0) + Math.log(x * (1.0 + x));
  28. }
  29. }

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

  1. /**
  2. * Returns the value of log Γ(a + b) for 1 ≤ a, b ≤ 2. Based on the
  3. * <em>NSWC Library of Mathematics Subroutines</em> double precision
  4. * implementation, {@code DGSMLN}. In {@code BetaTest.testLogGammaSum()},
  5. * this private method is accessed through reflection.
  6. *
  7. * @param a First argument.
  8. * @param b Second argument.
  9. * @return the value of {@code log(Gamma(a + b))}.
  10. * @throws OutOfRangeException if {@code a} or {@code b} is lower than
  11. * {@code 1.0} or greater than {@code 2.0}.
  12. */
  13. private static double logGammaSum(final double a, final double b)
  14. throws OutOfRangeException {
  15. if ((a < 1.0) || (a > 2.0)) {
  16. throw new OutOfRangeException(a, 1.0, 2.0);
  17. }
  18. if ((b < 1.0) || (b > 2.0)) {
  19. throw new OutOfRangeException(b, 1.0, 2.0);
  20. }
  21. final double x = (a - 1.0) + (b - 1.0);
  22. if (x <= 0.5) {
  23. return Gamma.logGamma1p(1.0 + x);
  24. } else if (x <= 1.5) {
  25. return Gamma.logGamma1p(x) + FastMath.log1p(x);
  26. } else {
  27. return Gamma.logGamma1p(x - 1.0) + FastMath.log(x * (1.0 + x));
  28. }
  29. }

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

  1. ret = Double.NaN;
  2. } else if (x < 0.5) {
  3. return logGamma1p(x) - FastMath.log(x);
  4. } else if (x <= 2.5) {
  5. return logGamma1p((x - 0.5) - 0.5);
  6. } else if (x <= 8.0) {
  7. final int n = (int) FastMath.floor(x - 1.5);
  8. prod *= x - i;
  9. return logGamma1p(x - (n + 1)) + FastMath.log(prod);
  10. } else {
  11. double sum = lanczos(x);

相关文章