def anderson_bjoerk_step(f, start, end, last_yc):
    """Performs a single iteration of Anderson-Bjoerck root-finding algorithm

    Args:
        f: univariate function the root of which we are looking for
        start: x and y values on the left of the interval, tuple of (a, ya)
        end: x and y values on the right of the interval, tuple of (b, yb)
        last_yc: value of the previously discovered y value, yc

    Returns:
         tuple of tuples: new values of (a, ya), (b, yb) and (c, yc)
         where c and yc are the newly discovered x and y values
    """
    a, ya = start
    b, yb = end
    s = last_yc
    c = (yb * a - ya * b) / (yb - ya)
    yc = f(c)
    if yc * ya > 0:
        if yc * s > 0:
            m = 1 - yc / ya
            m = m if m > 0 else 0.5
            yb *= m
        a = c
        ya = yc
    else:
        if yc * s > 0:
            m = 1 - yc / yb
            m = m if m > 0 else 0.5
            ya *= m
        b = c
        yb = yc
    return (a, ya), (b, yb), (c, yc)
