def METHOD_NAME(fun, f0, g0, alpha=2):
    t0 = 0
    t1 = alpha
    minf = f0
    alpha = 0
    NF = 0
    [f1, g1] = fun(t1)
    print("t1:", t1, "f1:", f1)
    NF += 1
    if minf > f1:
        alpha = t1
        minf = f1
        print("alpha:", alpha, "f:", minf)
    k = 0
    while k < 2:
        k += 1
        t = g1 - (f1 - f0)/(t1 - t0)
        t2 = t1 - 0.5*(t1 - t0)*g1/t
        if t2 < 0:
            break
        [f, g] = fun(t2)
        print("t2:", t2, "f2:", f)
        NF += 1
        if minf > f:
            alpha = t2
            minf = f
            print("alpha:", alpha, "f:", minf)
        t0 = t1
        f0 = f1
        g0 = g1
        t1 = t2
        f1 = f
        g1 = g
    return alpha, NF