def run_mec_cos(k, lam1, lam2, n = 1000):
    resp, costp, xp, yp, thp = run_mec_cos_pos(k*.5, lam1*.25, lam2*.25, n)
    resm, costm, xm, ym, thm = run_mec_cos_pos(k*.5, lam1*-.25, lam2*.25, n)
    cost = (costp + costm) * .5
    x, y = xp + xm, yp - ym
    th = thp + thm
    sth, cth = .5 * sin(thm), .5 * cos(thm)
    x, y = x * cth - y * sth, x * sth + y * cth
    result = []
    for i in range(1, n):
        xt, yt = resm[n - 1 - i]
        result.append((-xt * cth - yt * sth, -xt * sth + yt * cth))
    for i in range(n):
        xt, yt = resp[i]
        result.append((xt * cth - yt * sth, xt * sth + yt * cth))
    return result, cost, x, y, th
dataset/ETHPy150Open google/roboto/third_party/spiro/curves/mecsolve.py/run_mec_cos/swapped operands of `-`