def quadratic_extrap(ys, xs):
    """
    Quadratically extrapolate from three x,y pairs to x = 0.

    ys: y values from x,y pairs. Note that these can be arrays of values.
    xs: x values from x,y pairs. These should be scalars.

    Returns extrapolated y at x=0.
    """
    y1, y2, y3 = ys
    x1, x2, x3 = xs
    return x2 * x3 / ((x1 - x2) * (x1 - x3)) * y1 + x1 * x3 / ((x2 - x1) *
        (x2 - x3)) * y2 + x1 * x2 / ((x3 - x1) * (x3 - x2)) * y3
