public static double pdf(double x,double dof){
  if (x <= 0) {
    return 0.0;
  }
  if (dof <= 0) {
    return Double.NaN;
  }
  final double k=dof * .5;
  if (Math.abs(k - 1.0) < Double.MIN_NORMAL) {
    return Math.exp(-x * 2.0) * 2.0;
  }
  return Math.exp((k - 1.0) * Math.log(x * 2.0) - x * 2.0 - logGamma(k)) * 2.0;
}

public static double pdf ( double x , double dof ) { if ( x <= 0 ) { return 0.0 ; } if ( dof <= 0 ) { return Double . NaN ; } final double k = dof * .5 ; if ( Math . abs ( k - 1.0 ) < Double . MIN_NORMAL ) { return Math . exp ( - x * 2.0 ) * 2.0 ; } return Math . exp ( ( k - 1.0 ) * Math . log ( x * 2.0 ) - x * 2.0 - logGamma ( k ) ) * 2.0 ; }
chi - squared distribution pdf ( with 0 . 0 for x & lt ; 0 )
