def m_i(i):
    """
    Compute one plus the "total degree of the interpolating
    polynoimals" (Kruger & Kubler, 2004). This shows up many times in
    Smolyak's algorithm. It is defined as:

    .. math::

        m_i = \\begin{cases}
        1 \\quad & \\text{if } i = 1 \\\\
        2^{i-1} + 1 \\quad & \\text{if } i \\geq 2
        \\end{cases}

    Parameters
    ----------
    i : int
        The integer i which the total degree should be evaluated

    Returns
    -------
    num : int
        Return the value given by the expression above

    """
    if i < 0:
        raise ValueError('i must be positive')
    elif i == 0:
        return 0
    elif i == 1:
        return 1
    else:
        return 2 ** (i - 1) + 1
