CDF of Rayleigh distribution

@param x Value
@param sigma Scale parameter
@return CDF at position x.
513569
public static double cdf(double x, double sigma) {
    if(x <= 0.) {
      return 0.;
    }
    final double xs = x / sigma;
    return 1. - FastMath.exp(-.5 * xs * xs);
  }
113118
protected static double gammaCdf(double x, double a) {
        if(x<0) {
            throw new IllegalArgumentException("The x parameter must be positive.");
        }
        
        double GI;
        if (a>200) {
            double z=(x-a)/Math.sqrt(a);
            double y=gaussCdf(z);
            double b1=2/Math.sqrt(a);
            double phiz=0.39894228*Math.exp(-z*z/2);
            double w=y-b1*(z*z-1)*phiz/6;  //Edgeworth1
            double b2=6/a;
            int zXor4=((int)z)^4;
            double u=3*b2*(z*z-3)+b1*b1*(zXor4-10*z*z+15);
            GI=w-phiz*z*u/72;        //Edgeworth2
        } 
        else if (x<a+1) {
            GI=gSer(x,a);
        } 
        else {
            GI=gCf(x,a);
        }
        
        return GI;
    }
1315840
public static double logpdf(double x, double mu, double sigma, double lambda) {
    final double dx = x - mu;
    final double lss = lambda * sigma * sigma;
    final double erfc = NormalDistribution.erfc((lss - dx) / (sigma * MathUtil.SQRT2));
    return erfc > 0 ? FastMath.log(.5 * lambda * erfc) + lambda * (lss * .5 - dx) : (x == x) ? Double.NEGATIVE_INFINITY : Double.NaN;
  }
1043887
public double Function1D(double x) {
        double frequency = initFrequency;
        double amplitude = initAmplitude;
        double sum = 0;

        // octaves
        for (int i = 0; i < octaves; i++) {
            sum += SmoothedNoise(x * frequency) * amplitude;

            frequency *= 2;
            amplitude *= persistence;
        }
        return sum;
    }
512438
public static double cdf(double x, double k, double theta, double shift) {
    if(x == Double.NEGATIVE_INFINITY) {
      return 0.;
    }
    if(x == Double.POSITIVE_INFINITY) {
      return 1.;
    }
    if(x != x) {
      return Double.NaN;
    }
    final double e = FastMath.exp((x - shift) * theta);
    return e < Double.POSITIVE_INFINITY ? GammaDistribution.regularizedGammaP(k, e) : 1.;
  }
432034
public static double pdf(double x, double sigma) {
    if(!(x > 0.) || x == Double.POSITIVE_INFINITY) {
      return x == x ? 0. : Double.NaN;
    }
    final double xs = x / sigma;
    final double v = FastMath.exp(-.5 * xs * xs);
    return v > 0. ? xs / sigma * v : 0.;
  }
184228
public double Function1D(double x) {
        return Math.exp(x * x / (-2 * sqrSigma)) / (Math.sqrt(2 * Math.PI) * sigma);
    }
1355867
public static double gammaCdf(double x, double a, double b) {
        if(a<=0 || b<=0) {
            throw new IllegalArgumentException("All the parameters must be positive.");
        }
        
        double GammaCdf = ContinuousDistributions.gammaCdf(x/b, a);
        
        return GammaCdf;
    }
773549
public SDVariable squaredNorm(SDVariable x, boolean keepDims, int... dimensions) {
        return squaredNorm(null, x, keepDims, dimensions);
    }
1144282
public static double logcdf(double val, double loc, double scale) {
    val = (val - loc) / scale;
    if (val <= 18.) {
      return -FastMath.log1p(FastMath.exp(-val));
    } else if (val > 33.3) {
      return val;
    } else {
      return val - FastMath.exp(val);
    }
  }
3989
def MakeCdf(self, steps=101):
        """"""
        xs = [i / (steps - 1.0) for i in xrange(steps)]
        ps = [scipy.special.betainc(self.alpha, self.beta, x) for x in xs]
        cdf = Cdf(xs, ps)
        return cdf
88943
function partial( lambda ) {

	/**
	* FUNCTION: cdf( x )
	*	Evaluates the cumulative distribution function (CDF) for a Poisson distribution.
	*
	* @private
	* @param {Number} x - input value
	* @returns {Number} evaluated CDF
	*/
	return function cdf( x ) {
		if ( x < 0 ) {
			return 0;
		}
		return gammainc( lambda, floor( x ) + 1, {
			'tail': 'upper',
			'regularized': true
		});
	};
}
1367439
private double getDensityOutlierScore(ClusKernel x, ClusKernel entry) {
		double[] sigmaSquared = entry.getVarianceVector();
		// f(x) = factor * e^( -0.5 (x- mu ) * Sigma ^-1 * (x- mu ) )
		double resultDensity = 0;

		// exponent = -0.5 (x- mu ) * Sigma ^-1 * (x- mu ) )
		//                = -0.5 ( sum_d ((x_i - mu_i)^2 / var_i) )
		double exponent = 0.0;
		double[] mu = entry.getCenter();

		// factor = 1 / sqrt ( (2*PI)^d * \prod_d(variance) )
		//        = 1 / sqrt ((2*PI)^d) * sqrt (\prod_d(variance))
		//        = 1 / (2*PI)^(d/2)   * \prod_d( sqrt (variance))
		double factor = Math.pow( (2.0 * Math.PI) , ((sigmaSquared.length/2.0)) );
		for (int i = 0; i < sigmaSquared.length; i++) {
			factor *= Math.sqrt(sigmaSquared[i]);
			exponent += ((x.LS[i] - mu[i])*(x.LS[i] - mu[i])) / sigmaSquared[i];
		}

		// factor = 1 / sqrt ( (2*PI)^d * \prod_d(variance) )
		factor = 1 / factor;
		exponent *= -0.5;
		//System.out.println(factor);
		resultDensity = factor * Math.exp(exponent);
		//System.out.println(resultDensity);

		// TODO: dangerous, since the density is not necessarily between 0 and 1
		return 1-resultDensity;
	}
1034431
public static double cdf(double val, double k, double lambda, double theta) {
    return (val > theta) ? //
        (1.0 - FastMath.exp(-FastMath.pow((val - theta) / lambda, k))) //
        : val == val ? 0.0 : Double.NaN;
  }
941870
public static double logPdf(double x, double mu, double sigma)
    {
        return -0.5*log(2*PI) - log(sigma) + -pow(x-mu,2)/(2*sigma*sigma);
    }
558668
public static double logpdf(double x, double mu, double sigma) {
    if(x <= 0.) {
      return Double.NEGATIVE_INFINITY;
    }
    final double xrel = (FastMath.log(x) - mu) / sigma;
    return MathUtil.LOG_ONE_BY_SQRTTWOPI - FastMath.log(sigma * x) - .5 * xrel * xrel;
  }
573812
public static int pixelXToTileXWithScaleFactor(double pixelX, double scaleFactor, int tileSize) {
        return (int) Math.min(Math.max(pixelX / tileSize, 0), scaleFactor - 1);
    }