def zigzag2(i, curr=.45, upper=.48, lower=.13):
    """
    Generalized version of the zig-zag function.
    Returns points oscillating between two bounds
    linearly.
    """
    if abs(i) <= (upper-curr):
        return curr + i
    else:
        i = i - (upper-curr)
        i = i%(2*(upper-lower))
        if i < (upper-lower):
            return upper-i
        else:
            return 2*lower-upper+i