Java Digamma digamma(double x)

Here you can find the source of digamma(double x)

Description

digamma

License

Open Source License

Declaration

public static double digamma(double x) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static double digamma(double x) {
        if (x > 6.0) {
            double x2 = x * x;
            double x4 = x2 * x2;
            double x6 = x2 * x4;
            double x8 = x4 * x4;
            double x10 = x6 * x4;
            double x12 = x6 * x6;
            double x14 = x10 * x4;
            return Math.log(x) - 1.0 / (2 * x) - 1.0 / (12 * x2) - 1.0
                    / (120 * x4) - 1.0 / (252 * x6) + 1.0 / (240 * x8)
                    - 5.0 / (660 * x10) + 691.0 / (32760 * x12) - 1.0
                    / (12 * x14);//from w ww  . j  av  a  2 s  .com
        } else {
            return digamma(x + 1.0) - (1.0 / x);
        }
    }
}

Related

  1. digamma(double x)
  2. digamma(double x)
  3. digammaByDefinition(int d)
  4. digammaDiff(double x, int d)