def solve_clothoid(th0, th1, verbose = False):
    k0 = th0 + th1

    # initial guess
    k1 = 6 * (th1 - th0)
    error = (th1 - th0) - compute_dth(k0, k1)
    if verbose:
        print k0, k1, error

    k1_old, error_old = k1, error
    # second guess based on d(dth)/dk1 ~ 1/6
    k1 += 6 * error
    error = (th1 - th0) - compute_dth(k0, k1)
    if verbose:
        print k0, k1, error

    # secant method
    for i in range(10):
        if abs(error) < 1e-9: break
        k1_old, error_old, k1 = k1, error, k1 + (k1_old - k1) * (error - error_old) / error
        error = (th1 - th0) - compute_dth(k0, k1)
        if verbose:
            print k0, k1, error

    return k0, k1
dataset/ETHPy150Open google/roboto/third_party/spiro/curves/clothoid.py/solve_clothoid/swapped operands of `/`