DeltaE calculation using the CIE94 formula.
Delta = 2.3 corresponds to a just noticeable difference.
436923
public function cie94($color1, $color2)
    {
        $Kl = 1.0;
        $K1 = .045;
        $K2 = 0.015;

        $Kc = 1.0;
        $Kh = 1.0;

        $f1 = $this->toLab($color1);
        $f2 = $this->toLab($color2);

        $deltaL = $f2->l - $f1->l;
        $deltaA = $f2->a - $f1->a;
        $deltaB = $f2->b - $f1->b;

        $c1 = sqrt($f1->a * $f1->a + $f1->b * $f1->b);
        $c2 = sqrt($f2->a * $f2->a + $f2->b * $f2->b);
        $deltaC = $c2 - $c1;

        $deltaH = $deltaA * $deltaA + $deltaB * $deltaB - $deltaC * $deltaC;
        $deltaH = $deltaH < 0 ? 0 : sqrt($deltaH);

        $Sl = 1.0;
        $Sc = 1 + $K1 * $c1;
        $Sh = 1 + $K2 * $c1;

        $deltaLKlsl = $deltaL / ($Kl * $Sl);
        $deltaCkcsc = $deltaC / ($Kc * $Sc);
        $deltaHkhsh = $deltaH / ($Kh * $Sh);

        $deltaE = $deltaLKlsl * $deltaLKlsl + $deltaCkcsc * $deltaCkcsc + $deltaHkhsh * $deltaHkhsh;

        return $deltaE < 0 ? 0 : sqrt($deltaE);
    }
512530
def get_delta_plus_epsilon(nat, i_now, dr_now, dr_old):
    
    XIJ = get_XIJ(nat, i_now, dr_now, dr_old)
    YIJ = get_YIJ(nat, i_now, dr_old)

    YIJ_invert = array_inverse(YIJ)

    # Perform sum_k X_ik Y_jk^-1
    epsilon = np.sum(XIJ.reshape(-1,3,1,3)*YIJ_invert.reshape(-1,1,3,3), axis=3)

    return epsilon
1004731
public boolean eq(IntFloatSortedVector other, float delta) {
        // This is slow, but correct.
        IntFloatSortedVector v1 = IntFloatSortedVector.getWithNoZeroValues(this, delta);
        IntFloatSortedVector v2 = IntFloatSortedVector.getWithNoZeroValues(other, delta);
                
        if (v2.size() != v1.size()) {
            return false;
        }

        for (IntFloatEntry ve : v1) {
            if (!Primitives.equals(ve.get(), v2.get(ve.index()), delta)) {
                return false;
            }
        }
        for (IntFloatEntry ve : v2) {
            if (!Primitives.equals(ve.get(), v1.get(ve.index()), delta)) {
                return false;
            }
        }
        return true;
    }
46939
def completeness(self, delta, method='step'):
        
        delta = np.asarray(delta)
        if method == 'step':
            func = lambda delta: (delta > 0).astype(float)
        elif method == 'erf':
            # Trust the SDSS EDR???
            # 95% completeness: 
            def func(delta):
                # Efficiency at bright end (assumed to be 100%)
                e = 1.0
                # EDR says full width is ~0.5 mag
                width = 0.2 
                # This should be the halfway point in the curve
                return (e/2.0)*(1/np.sqrt(2*width))*(np.sqrt(2*width)-scipy.special.erf(-delta))
        elif method == 'flemming':
            # Functional form taken from Fleming et al. AJ 109, 1044 (1995)
            # http://adsabs.harvard.edu/abs/1995AJ....109.1044F
            # f = 1/2 [1 - alpha(V - Vlim)/sqrt(1 + alpha^2 (V - Vlim)^2)]
            # CAREFUL: This definition is for Vlim = 50% completeness
            def func(delta):
                alpha = 2.0
                return 0.5 * (1 - (alpha * delta)/np.sqrt(1+alpha**2 * delta**2))
        else:
            raise Exception('...')
        return func(delta)
405619
function( t ) {

		var delta = 0.0001;
		var t1 = t - delta;
		var t2 = t + delta;

		// Capping in case of danger

		if ( t1 < 0 ) t1 = 0;
		if ( t2 > 1 ) t2 = 1;

		var pt1 = this.getPoint( t1 );
		var pt2 = this.getPoint( t2 );

		var vec = pt2.clone().sub( pt1 );
		return vec.normalize();

	}
950571
def calculate_u(dt, dx, dy, u, um, k):
    up = numpy.zeros((u.shape[0], u.shape[1]))
    ""
    for i in xrange(1, u.shape[0]-1):
        for j in xrange(1, u.shape[1]-1):
            up[i,j] = 2*u[i,j] - um[i,j] + \
                (dt/dx)**2*(
                        (0.5*(k[i+1,j] + k[i,j])*(u[i+1,j] - u[i,j]) -
                            0.5*(k[i,j] + k[i-1,j])*(u[i,j] - u[i-1,j]))) + \
                        (dt/dy)**2*(
                                (0.5*(k[i,j+1] + k[i,j])*(u[i,j+1] - u[i,j]) -
                                    0.5*(k[i,j] + k[i,j-1])*(u[i,j] - u[i,j-1])))
    return up
264132
def _w_sigma_delta(self, sigma, delta):
        
        sigma2=sigma**2
        w2 = sigma2/(1-2*delta**2/np.pi)
        w = np.sqrt(w2)
        return w
305688
function delta(wgLon, wgLat) {
  var dLat = transformLat(wgLon - 105.0, wgLat - 35.0);
  var dLon = transformLon(wgLon - 105.0, wgLat - 35.0);
  var radLat = wgLat / 180.0 * PI;
  var magic = Math.sin(radLat);
  magic = 1 - OFFSET * magic * magic;
  var sqrtMagic = Math.sqrt(magic);
  dLat = (dLat * 180.0) / ((AXIS * (1 - OFFSET)) / (magic * sqrtMagic) * PI);
  dLon = (dLon * 180.0) / (AXIS / sqrtMagic * Math.cos(radLat) * PI);
  return [dLon, dLat];
}
588828
function (formula, direction, delta) {
      var type,
          counter;

      // left, right -> col
      if (['left', 'right'].indexOf(direction) !== -1) {
        type = 'col';
      } else if (['up', 'down'].indexOf(direction) !== -1) {
        type = 'row'
      }

      // down, up -> row
      if (['down', 'right'].indexOf(direction) !== -1) {
        counter = delta * 1;
      } else if(['up', 'left'].indexOf(direction) !== -1) {
        counter = delta * (-1);
      }

      if (type && counter) {
        return formula.replace(/(\$?[A-Za-z]+\$?[0-9]+)/g, function (match) {

          var alpha = instance.utils.getCellAlphaNum(match).alpha;

          var fixedCol = alpha[0] === '$' || false,
              fixedRow = alpha[alpha.length - 1] === '$' || false;

          if (type === 'row' && fixedRow) {
            return match;
          }

          if (type === 'col' && fixedCol) {
            return match;
          }

          return (type === 'row' ? instance.utils.changeRowIndex(match, counter) : instance.utils.changeColIndex(match, counter));
        });
      }

      return formula;
    }
487715
def Δk(self):
        
        Δc, Δv = self.Δc, self.Δv
        cos = self._energy.trig('cos θ')
        return lambda e: (1 / 2) * ((Δc + Δv) + (Δc - Δv) * cos(e))
757464
def utime_delta(days=0, hours=0, minutes=0, seconds=0):
    
    return (days * DAY) + (hours * HOUR) + (minutes * MINUTE) + (seconds * SECOND)
1191338
def angvel(target, current, scale):
    ''''''
    delta = target - current
    while delta < -180:
        delta += 360;
    while delta > 180:
        delta -= 360;
    return (old_div(2.0, (1.0 + math.exp(old_div(-delta,scale))))) - 1.0
194702
def abs_timedelta(delta):
    """"""
    if delta.days < 0:
        now = _now()
        return now - (now + delta)
    return delta
1207251
def _calc_delta(self,ensemble,scaling_matrix=None):
        '''
        
        '''
        mean = np.array(ensemble.mean(axis=0))
        delta = ensemble.as_pyemu_matrix()
        for i in range(ensemble.shape[0]):
            delta.x[i,:] -= mean
        if scaling_matrix is not None:
            delta = scaling_matrix * delta.T
        delta *= (1.0 / np.sqrt(float(ensemble.shape[0] - 1.0)))
        return delta
1236788
private double deviation(double[] delta, double[][] beta) {
    final double a = squareSum(delta);
    final double b = squareSum(transposeTimes(beta, delta));

    return (a > b) ? FastMath.sqrt(a - b) : 0.;
  }
990431
def delta(self, mapping, prefix):
        
        previous = self.getrange(prefix, strip=True)
        if not previous:
            pk = set()
        else:
            pk = set(previous.keys())
        ck = set(mapping.keys())
        delta = DeltaSet()

        # added
        for k in ck.difference(pk):
            delta[k] = Delta(None, mapping[k])

        # removed
        for k in pk.difference(ck):
            delta[k] = Delta(previous[k], None)

        # changed
        for k in pk.intersection(ck):
            c = mapping[k]
            p = previous[k]
            if c != p:
                delta[k] = Delta(p, c)

        return delta
1374113
function deltaE(labA, labB) {
      var deltaL = labA[0] - labB[0];
      var deltaA = labA[1] - labB[1];
      var deltaB = labA[2] - labB[2];

      return Math.sqrt(Math.pow(deltaL, 2) +
                       Math.pow(deltaA, 2) +
                       Math.pow(deltaB, 2));
    }