def run_mec_cos_pos(k, lam1, lam2, n = 1000):
    cost = 0
    th = 0
    x = 0
    y = 0
    dt = 1.0 / n
    result = [(0, 0)]
    for i in range(n):
        k1 = lam1 * cos(th) + lam2 * sin(th)

        cost += dt * k * k
        x += dt * cos(th)
        y += dt * sin(th)
        th += dt * k

        k += dt * k1
        result.append((x, y))
    return result, cost, x, y, th
dataset/ETHPy150Open google/roboto/third_party/spiro/curves/mecsolve.py/run_mec_cos_pos/original