Inversion of CDF by bisection numeric root finding of "cdf(x) = p"
for continuous distribution.
764914
protected double quantile(double p, double xmin, double xmax, double eps) {
        if (eps <= 0.0) {
            throw new IllegalArgumentException("Invalid epsilon: " + eps);            
        }
        
        while (Math.abs(xmax - xmin) > eps) {
            double xmed = (xmax + xmin) / 2;
            if (cdf(xmed) > p) {
                xmax = xmed;
            } else {
                xmin = xmed;
            }
        }

        return xmin;
    }
671369
function gam1(x) {
      if (x <= -1) { return NaN; }
      if (x < -0.5 || x > 1.5) { return 1 / gamma(x + 1) - 1; }
      if (x <= 0) { return x * (1 + w.evalAt(x)); }
      if (x <= 0.5) { return x * w1.evalAt(x); }
      if (x <= 1) { return (x - 1) / x * w.evalAt(x - 1); }
      return (x - 1) / x * (w1.evalAt(x - 1) - 1);
   }
383796
public double inverseCumulativeDistribution(double x) {
		double p = Math.exp(-lambda);
		double dp = p;
		int k = 0;
		while(x > p) {
			k++;
			dp *= lambda / k;
			p += dp;
		}
		return k;
	}
736270
def get_p_vals(self, X):
		'''
		

		'''
		z_scores = self.get_scores(X[:, 0], X[:, 1])
		return norm.cdf(z_scores)
154349
def cdf(x, df, loc=0.0, scale=1.0, gamma = 1.0):
        
        result = np.zeros(x.shape[0])
        result[x<0] = 2.0/(np.power(gamma,2) + 1.0)*ss.t.cdf(gamma*(x[x-loc < 0]-loc[x-loc < 0])/scale, df=df)
        result[x>=0] = 1.0/(np.power(gamma,2) + 1.0) + 2.0/((1.0/np.power(gamma,2)) + 1.0)*(ss.t.cdf((x[x-loc >= 0]-loc[x-loc >= 0])/(gamma*scale), df=df)-0.5)
        return result
400969
function inverse$18(p) {
        var n;
        var x = p.x;
        var y = p.y;

        var delta_x = x - this.x0;
        var delta_y = y - this.y0;

        // 1. Calculate z
        var z_re = delta_y / this.a;
        var z_im = delta_x / this.a;

        // 2a. Calculate theta - first approximation gives km accuracy
        var z_n_re = 1;
        var z_n_im = 0; // z^0
        var z_n_re1;
        var z_n_im1;

        var th_re = 0;
        var th_im = 0;
        for (n = 1; n <= 6; n++) {
            z_n_re1 = z_n_re * z_re - z_n_im * z_im;
            z_n_im1 = z_n_im * z_re + z_n_re * z_im;
            z_n_re = z_n_re1;
            z_n_im = z_n_im1;
            th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im;
            th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im;
        }

        // 2b. Iterate to refine the accuracy of the calculation
        //        0 iterations gives km accuracy
        //        1 iteration gives m accuracy -- good enough for most mapping applications
        //        2 iterations bives mm accuracy
        for (var i = 0; i < this.iterations; i++) {
            var th_n_re = th_re;
            var th_n_im = th_im;
            var th_n_re1;
            var th_n_im1;

            var num_re = z_re;
            var num_im = z_im;
            for (n = 2; n <= 6; n++) {
                th_n_re1 = th_n_re * th_re - th_n_im * th_im;
                th_n_im1 = th_n_im * th_re + th_n_re * th_im;
                th_n_re = th_n_re1;
                th_n_im = th_n_im1;
                num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
                num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
            }

            th_n_re = 1;
            th_n_im = 0;
            var den_re = this.B_re[1];
            var den_im = this.B_im[1];
            for (n = 2; n <= 6; n++) {
                th_n_re1 = th_n_re * th_re - th_n_im * th_im;
                th_n_im1 = th_n_im * th_re + th_n_re * th_im;
                th_n_re = th_n_re1;
                th_n_im = th_n_im1;
                den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
                den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
            }

            // Complex division
            var den2 = den_re * den_re + den_im * den_im;
            th_re = (num_re * den_re + num_im * den_im) / den2;
            th_im = (num_im * den_re - num_re * den_im) / den2;
        }

        // 3. Calculate d_phi              ...                                    // and d_lambda
        var d_psi = th_re;
        var d_lambda = th_im;
        var d_psi_n = 1; // d_psi^0

        var d_phi = 0;
        for (n = 1; n <= 9; n++) {
            d_psi_n = d_psi_n * d_psi;
            d_phi = d_phi + this.D[n] * d_psi_n;
        }

        // 4. Calculate latitude and longitude
        // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians.
        var lat = this.lat0 + (d_phi * SEC_TO_RAD * 1E5);
        var lon = this.long0 + d_lambda;

        p.x = lon;
        p.y = lat;

        return p;
    }
297607
def lognormcdf(x, mu, tau):
    """"""
    x = np.atleast_1d(x)
    return np.array(
        [0.5 * (1 - flib.derf(-(np.sqrt(tau / 2)) * (np.log(y) - mu))) for y in x])
843064
public static double cdf(double x, double location, double shape) {
    return FastMath.atan2(x - location, shape) / Math.PI + .5;
  }
1139191
public static double cdf(double val, double loc, double scale, double shape1, double shape2) {
    val = (val - loc) / scale;
    if(val == Double.NEGATIVE_INFINITY) {
      return 0.;
    }
    if(val == Double.POSITIVE_INFINITY) {
      return 1.;
    }
    if(val != val) {
      return Double.NaN;
    }
    if(shape1 == 0.) {
      val = FastMath.exp(-val);
    }
    else {
      double tmp = shape1 * val;
      if(tmp == Double.NEGATIVE_INFINITY) {
        return shape2 == 0 ? 1 : 0.;
      }
      if(tmp >= 1.) {
        return shape2 == 0 ? 0 : 1.;
      }
      val = FastMath.exp(FastMath.log1p(-tmp) / shape1);
    }
    if(shape2 == 0.) {
      return FastMath.exp(-val);
    }
    final double tmp = shape2 * val;
    return tmp < 1. ? FastMath.exp(FastMath.log1p(-tmp) / shape2) : 0.;
  }
294067
def cumulative_distribution(self, X):
        
        self.check_fit()

        U, V = self.split_matrix(X)

        if self.theta == 1:
            return np.multiply(U, V)

        else:
            h = np.power(-np.log(U), self.theta) + np.power(-np.log(V), self.theta)
            h = -np.power(h, 1.0 / self.theta)
            cdfs = np.exp(h)
            return cdfs
1043989
def _cdf(self, xloc, dist, length, cache):
        
        output = evaluation.evaluate_forward(
            dist, xloc.reshape(1, -1)).reshape(length, -1)
        assert xloc.shape == output.shape
        return output
740078
def cumulative_distribution(self, X):
        
        self.check_fit()
        return norm.cdf(X, loc=self.mean, scale=self.std)
81880
def cbrt (x):
  """"""
  if x >= 0: 
    return   math.pow(x     , 1.0 / 3.0)
  else:
    return - math.pow(abs(x), 1.0 / 3.0)
778417
def k_s(X):
    
    xbar, sigma = pmag.gausspars(X)
    d, f = 0, 0.
    for i in range(1, len(X) + 1):
        b = old_div(float(i), float(len(X)))
        a = gaussfunc(X[i - 1], xbar, sigma)
        if abs(f - a) > abs(b - a):
            delta = abs(f - a)
        else:
            delta = abs(b - a)
        if delta > d:
            d = delta
        f = b
    return d, xbar, sigma
532060
function cubicEaseInOut (p) {
    if(p < 0.5) {
        return 4 * p * p * p;
    } else {
        var f = ((2 * p) - 2);
        return 0.5 * f * f * f + 1;
    }
}
1282811
def invcdf(x):
    """"""
    x_flat = np.ravel(x)
    x_trans = np.array([flib.ppnd16(y, 1) for y in x_flat])
    return np.reshape(x_trans, np.shape(x))
714916
def normcdf(x, log=False):
    """"""
    y = np.atleast_1d(x).copy()
    flib.normcdf(y)
    if log:
        if (y>0).all():
            return np.log(y)
        return -np.inf
    return y