question: public static DoubleVector dchisq ( double x , DoubleVector ncp ) { int n = ncp . size ( ) ; DoubleVector d = new DoubleVector ( n ) ; double xh = Math . sqrt ( x ) ; double mean ; for ( int i = 0 ; i < n ; i ++ ) { mean = Math . sqrt ( ncp . get ( i ) ) ; if ( ncp . get ( i ) == 0.0 ) d . set ( i , dchisq ( x ) ) ; else d . set ( i , ( dnorm ( xh - mean ) + dnorm ( - xh - mean ) ) / ( 2 * xh ) ) ; } return d ; }
target:  Returns the density of the noncentral Chi-squared distribution.