Schaffer function x0 in [-100..100]
763329
def schaffer(self, x):
        
        N = len(x)
        s = x[0:N - 1]**2 + x[1:N]**2
        return sum(s**0.25 * (np.sin(50 * s**0.1)**2 + 1))
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
1374683
def _call(self, x):
        """"""

        sum_constr = abs(x.ufuncs.sum() / self.diameter - 1) <= self.sum_rtol

        nonneq_constr = x.ufuncs.greater_equal(0).asarray().all()

        if sum_constr and nonneq_constr:
            return 0
        else:
            return np.inf
285459
def not0(a):
    """"""
    return matrix(list(map(lambda x: 1 if x == 0 else x, a)), a.size)
1350432
def schwefelmult(self, x, pen_fac=1e4):
        """"""
        y = [x] if isscalar(x[0]) else x
        N = len(y[0])
        f = array([418.9829 * N - 1.27275661e-5 * N - sum(x * np.sin(np.abs(x)**0.5))
                + pen_fac * sum((abs(x) > 500) * (abs(x) - 500)**2) for x in y])
        return f if len(f) > 1 else f[0]
194388
function multiplier(x) {
    var parts = x.toString().split('.');
    if (parts.length < 2) {
      return 1;
    }
    return Math.pow(10, parts[1].length);
  }
510011
private double ssqerr(int k0, int kmax, double[] logk, double[] log_kDist, double m, double t) {
    int k = kmax - k0;
    double result = 0;
    for(int i = 0; i < k; i++) {
      // double h = log_kDist[i] - (m * (logk[i] - logk[0]) + t); ???
      double h = log_kDist[i] - m * logk[i] - t;
      result += h * h;
    }
    return result;
  }
521387
def xorsum(t):
    
    _b = t[0]
    for i in t[1:]:
        _b = _b ^ i
        _b &= 0xff
    return _b
790101
function bpser(a, b, x) {
      var c, ser;

      c = 1;
      ser = a * series(function(i) {
         if (i === 0) { return 0; }
         c = c * (1 - b / i) * x;
         return c / (a + i);
      });
      ser = ser > -1 ? log1p(ser) : -Infinity;
      return -lbeta(a, b) + a * Math.log(x) - Math.log(a) + ser;
   }
478458
public static double Digamma(double x) {
        double s = 0;
        double w = 0;
        double y = 0;
        double z = 0;
        double nz = 0;

        boolean negative = false;

        if (x <= 0.0) {
            negative = true;
            double q = x;
            double p = (int) Math.floor(q);

            if (p == q) {
                try {
                    throw new ArithmeticException("Function computation resulted in arithmetic overflow.");
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            nz = q - p;

            if (nz != 0.5) {
                if (nz > 0.5) {
                    p = p + 1.0;
                    nz = q - p;
                }
                nz = Math.PI / Math.tan(Math.PI * nz);
            } else {
                nz = 0.0;
            }

            x = 1.0 - x;
        }

        if (x <= 10.0 && x == Math.floor(x)) {
            y = 0.0;
            int n = (int) Math.floor(x);
            for (int i = 1; i <= n - 1; i++) {
                w = i;
                y = y + 1.0 / w;
            }
            y = y - 0.57721566490153286061;
        } else {
            s = x;
            w = 0.0;

            while (s < 10.0) {
                w = w + 1.0 / s;
                s = s + 1.0;
            }

            if (s < 1.0E17) {
                z = 1.0 / (s * s);

                double polv = 8.33333333333333333333E-2;
                polv = polv * z - 2.10927960927960927961E-2;
                polv = polv * z + 7.57575757575757575758E-3;
                polv = polv * z - 4.16666666666666666667E-3;
                polv = polv * z + 3.96825396825396825397E-3;
                polv = polv * z - 8.33333333333333333333E-3;
                polv = polv * z + 8.33333333333333333333E-2;
                y = z * polv;
            } else {
                y = 0.0;
            }
            y = Math.log(s) - 0.5 / s - y - w;
        }

        if (negative == true) {
            y = y - nz;
        }

        return y;
    }
48701
function ceil(x) {
            if (Math.abs(Math.round(x) - x) < 0.00002) {
                return Math.round(x);
            }

            return Math.round(x * 100000) / 100000;
        }
231420
function bnpFromInt(x) {
  this.t = 1;
  this.s = (x<0)?-1:0;
  if(x > 0) this[0] = x;
  else if(x < -1) this[0] = x+this.DV;
  else this.t = 0;
}
516862
function(x0, y0, x1, y1, x2, y2, x3, y3) {
  var tvalues = [],
      bounds = [[], []],
      a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  for (var i = 0; i < 2; ++i) {
    if (i == 0) {
      b = 6 * x0 - 12 * x1 + 6 * x2;
      a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
      c = 3 * x1 - 3 * x0;
    } else {
      b = 6 * y0 - 12 * y1 + 6 * y2;
      a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
      c = 3 * y1 - 3 * y0;
    }
    if (Math.abs(a) < 1e-12) {
      if (Math.abs(b) < 1e-12) {
        continue;
      }
      t = -c / b;
      if (0 < t && t < 1) {
        tvalues.push(t);
      }
      continue;
    }
    b2ac = b * b - 4 * c * a;
    sqrtb2ac = Math.sqrt(b2ac);
    if (b2ac < 0) {
      continue;
    }
    t1 = (-b + sqrtb2ac) / (2 * a);
    if (0 < t1 && t1 < 1) {
      tvalues.push(t1);
    }
    t2 = (-b - sqrtb2ac) / (2 * a);
    if (0 < t2 && t2 < 1) {
      tvalues.push(t2);
    }
  }

  var x, y, j = tvalues.length,
      jlen = j,
      mt;
  while (j--) {
    t = tvalues[j];
    mt = 1 - t;
    bounds[0][j] = (mt * mt * mt * x0) + (3 * mt * mt * t * x1) + (3 * mt * t * t * x2) + (t * t * t * x3);
    bounds[1][j] = (mt * mt * mt * y0) + (3 * mt * mt * t * y1) + (3 * mt * t * t * y2) + (t * t * t * y3);
  }

  bounds[0][jlen] = x0;
  bounds[1][jlen] = y0;
  bounds[0][jlen + 1] = x3;
  bounds[1][jlen + 1] = y3;
  bounds[0].length = bounds[1].length = jlen + 2;

  return {
    min: {x: Math.min.apply(0, bounds[0]), y: Math.min.apply(0, bounds[1])},
    max: {x: Math.max.apply(0, bounds[0]), y: Math.max.apply(0, bounds[1])}
  };
}
159468
function erf( x ) {
	var sign;
	var ax;
	var z;
	var r;
	var s;
	var y;
	var p;
	var q;

	// Special case: NaN
	if ( x !== x ) {
		return NaN;
	}
	// Special case: +infinity
	if ( x === PINF ) {
		return 1;
	}
	// Special case: -infinity
	if ( x === NINF ) {
		return -1;
	}
	// Special case: +-0
	if ( x === 0 ) {
		return x;
	}
	if ( x < 0 ) {
		sign = true;
		ax = -x;
	} else {
		sign = false;
		ax = x;
	}
	// |x| < 0.84375
	if ( ax < 0.84375 ) {
		if ( ax < SMALL ) {
			if ( ax < VERY_TINY ) {
				// Avoid underflow:
				return 0.125 * (8.0*x + EFX8*x);
			}
			return x + EFX*x;
		}
		z = x * x;
		r = PPC + z*polyvalPP( z );
		s = QQC + z*polyvalQQ( z );
		y = r / s;
		return x + x*y;
	}
	// 0.84375 <= |x| < 1.25
	if ( ax < 1.25 ) {
		s = ax - 1;
		p = PAC + s*polyvalPA( s );
		q = QAC + s*polyvalQA( s );
		if ( sign ) {
			return -ERX - p/q;
		}
		return ERX + p/q;
	}
	// +inf > |x| >= 6
	if ( ax >= 6 ) {
		if ( sign ) {
			return TINY - 1.0; // raise inexact
		}
		return 1.0 - TINY; // raise inexact
	}
	s = 1.0 / (ax*ax);

	// |x| < 1/0.35 ~ 2.857143
	if ( ax < 2.857142857142857 ) {
		r = RAC + s*polyvalRA( s );
		s = SAC + s*polyvalSA( s );
	}
	// |x| >= 1/0.35 ~ 2.857143
	else {
		r = RBC + s*polyvalRB( s );
		s = SBC + s*polyvalSB( s );
	}
	z = setLowWord( ax, 0 ); // pseudo-single (20-bit) precision x
	r = exp( -z*z - 0.5625 ) * exp( (z-ax)*(z+ax) + r/s );
	if ( sign ) {
		return r/ax - 1;
	}
	return 1 - r/ax;
}
382572
function ecp_proj(R, N, p, l) {
	var x = N[0], y = N[1], z = N[2];
	var xr = R[0], yr = R[1], zr = R[2];
	var t0 = _ecp_t0, t1 = _ecp_t1, t2 = _ecp_t2;
	fp_mul(t2, t0, fp_sqr(t1, fp_inv(t0, z, p, l), p, l), p, l);
	fp_mul(xr, x, t1, p, l);
	fp_mul(yr, y, t2, p, l);
	mpn_zero(zr, l), zr[0] = 1;
	return R;
}
485434
def function(self, x, y, amp, alpha, beta, center_x, center_y):
        
        x_shift = x - center_x
        y_shift = y - center_y
        return amp * (1. + (x_shift**2+y_shift**2)/alpha**2)**(-beta)
54329
def highpass(cutoff):
  
  R = thub(exp(-cutoff), 2)
  G = (R + 1) / 2
  return G * (1 - z ** -1) / (1 - R * z ** -1)