public static double dchisqLog(double x,double ncp){
  if (ncp == 0.0)   return dchisqLog(x);
  double xh=Math.sqrt(x);
  double mean=Math.sqrt(ncp);
  return Math.log(dnorm(xh - mean) + dnorm(-xh - mean)) - Math.log(2 * xh);
}

public static double dchisqLog ( double x , double ncp ) { if ( ncp == 0.0 ) return dchisqLog ( x ) ; double xh = Math . sqrt ( x ) ; double mean = Math . sqrt ( ncp ) ; return Math . log ( dnorm ( xh - mean ) + dnorm ( - xh - mean ) ) - Math . log ( 2 * xh ) ; }
returns the log - density value of a noncentral chi - square distribution .
