'Compute new expression strings and a new inputs tuple for combining
self and other with a binary operator.'

def build_binary_op(self, op, other):

    if isinstance(other, NumericalExpression):
        (self_expr, other_expr, new_inputs) = self._merge_expressions(other)
    elif isinstance(other, Term):
        self_expr = self._expr
        (new_inputs, other_idx) = _ensure_element(self.inputs, other)
        other_expr = ('x_%d' % other_idx)
    elif isinstance(other, Number):
        self_expr = self._expr
        other_expr = str(other)
        new_inputs = self.inputs
    else:
        raise BadBinaryOperator(op, other)
    return (self_expr, other_expr, new_inputs)
