term : factor OP_PLUS term
                | factor OP_MINUS term
                | factor OP_TIMES term
                | factor OP_DIVIDE term
                | factor OP_MODULO term
                | factor
18678
def p_term(tok):
        """"""
        if len(tok) == 4:
            tok[0] = MathBinOpRule(tok[2], tok[1], tok[3])
        else:
            tok[0] = tok[1]
229964
def rbf(ra, coeff, mag):
    
    a1ca, a1cb, a1cc, a1cd, a1ce, a2ca, a2cb, a2cc, a2cd, a2ce = gc(coeff, mag)
    term1 = a1ca + a1cb * mag + a1cc * np.log(ra + a1cd*np.exp(a1ce*mag))
    term2 = a2ca + a2cb * mag
    term3 = a2cd*np.exp(a2ce*mag)
    return np.exp((term1 - term2) / a2cc) - term3
905695
function mod(n, a, b) {
	n = intOf(n);
	a = intOf(a);
	b = intOf(b);
	var rem;
	if (a < 0 || b < 0) {
		var places = (b - a);
		rem = (n - a) % (places + 1);
		rem = rem < 0 ? (rem + (places + 1)) : rem === 0 ? 0 : rem;
		return rem - (places - b);
	}
	if (n === b) { return n; }
	if (n === b + 1) { return a; }
	if (n === a - 1) { return b; }
	rem = n % (b || 1);
	rem = rem < a ? (rem + b) : rem === 0 ? 0 : rem;
	return rem;
}
400520
def _validate_data_dep_params(self, X):
        
        n_samples, m_features = X.shape

        # terms
        if self.terms is 'auto':
            # one numerical spline per feature
            self.terms = TermList(*[SplineTerm(feat, verbose=self.verbose) for feat in range(m_features)])

        elif self.terms is None:
            # no terms
            self.terms = TermList()

        else:
            # user-specified
            self.terms = TermList(self.terms, verbose=self.verbose)

        # add intercept
        if self.fit_intercept:
            self.terms = self.terms + Intercept()

        if len(self.terms) == 0:
            raise ValueError('At least 1 term must be specified')

        # copy over things from plural
        remove = []
        for k, v in self.__dict__.items():
            if k in self._plural:
                setattr(self.terms, k, v)
                remove.append(k)
        for k in remove:
            delattr(self, k)

        self.terms.compile(X)
1335565
function getTermName(node, op) {
  const polyNode = new Node.PolynomialTerm(node);
  // we 'name' polynomial terms by their symbol name
  let termName = polyNode.getSymbolName();
  // when adding terms, the exponent matters too (e.g. 2x^2 + 5x^3 can't be combined)
  if (op === '+') {
    const exponent = print(polyNode.getExponentNode(true));
    termName += '^' + exponent;
  }
  return termName;
}
429003
function _term()
    {
        $result = $this->_fact();
        if (PEAR::isError($result)) {
            return $result;
        }
        while (($this->_current_token == SPREADSHEET_EXCEL_WRITER_MUL) or
               ($this->_current_token == SPREADSHEET_EXCEL_WRITER_DIV)) {
        /**/
            if ($this->_current_token == SPREADSHEET_EXCEL_WRITER_MUL) {
                $this->_advance();
                $result2 = $this->_fact();
                if (PEAR::isError($result2)) {
                    return $result2;
                }
                $result = $this->_createTree('ptgMul', $result, $result2);
            } else {
                $this->_advance();
                $result2 = $this->_fact();
                if (PEAR::isError($result2)) {
                    return $result2;
                }
                $result = $this->_createTree('ptgDiv', $result, $result2);
            }
        }
        return $result;
    }
104617
def _compute_term_3(self, C, rhypo):
        
        d = rhypo
        d[d <= 15.0] = 15.0

        return C['a3'] * np.log10(d)
738966
def invsubword(w):
    
    w = w.reshape(4, 8)
    return ISBOX[w[0]] + ISBOX[w[1]] + ISBOX[w[2]] + ISBOX[w[3]]
1153714
def to_ngrams(self, terms):
        ''' 
        '''
        if len(terms) <= self.n:
            return terms
        if self.n == 1:
            n_grams = [[term] for term in terms]
        else:
            n_grams = []
            for i in range(0,len(terms)-self.n+1):
                n_grams.append(terms[i:i+self.n])
        return n_grams
1051565
def p_definitions(self, p):
        ''
        p[0] = p[1] + (p[2],)
        p.set_lineno(0, p.lineno(1))
658412
def **(x)
      check_operable
      m = Utils.as_numeric(x)
      dims = dimension_uop{|a| a*m}
      Unit.new(@factor**m,dims)
    end
149311
def +(x)
      x = Unit.cast(x)
      check_operable2(x)
      assert_same_dimension(x)
      Unit.new(@factor+x.factor,@dim.dup)
    end
1257946
def OneHot(*xs, simplify=True, conj=True):
    
    xs = [Expression.box(x).node for x in xs]
    terms = list()
    if conj:
        for x0, x1 in itertools.combinations(xs, 2):
            terms.append(exprnode.or_(exprnode.not_(x0),
                                      exprnode.not_(x1)))
        terms.append(exprnode.or_(*xs))
        y = exprnode.and_(*terms)
    else:
        for i, xi in enumerate(xs):
            zeros = [exprnode.not_(x) for x in xs[:i] + xs[i+1:]]
            terms.append(exprnode.and_(xi, *zeros))
        y = exprnode.or_(*terms)
    if simplify:
        y = y.simplify()
    return _expr(y)
567615
def p_expression_mod(self, p):
        ''
        p[0] = Mod(p[1], p[3], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
1331274
def add_intercept_term(self, x):
        
        nr_x,nr_f = x.shape
        intercept = np.ones([nr_x,1])
        x = np.hstack((intercept,x))
        return x
503018
def _compute_base_term(self, C, rup, dists):
        
        c1 = self.CONSTS['c1']
        R = np.sqrt(dists.rrup ** 2 + self.CONSTS['c4'] ** 2)

        base_term = (C['a1'] +
                     C['a8'] * ((8.5 - rup.mag) ** 2) +
                     (C['a2'] + self.CONSTS['a3'] * (rup.mag - c1)) *
                     np.log(R))

        if rup.mag <= c1:
            return base_term + self.CONSTS['a4'] * (rup.mag - c1)
        else:
            return base_term + self.CONSTS['a5'] * (rup.mag - c1)
870100
def iter_terms(fs, conj=False):
    
    for num in range(1 << len(fs)):
        yield num2term(num, fs, conj)