def run_elastica(sm, sp, k0, lam1, lam2, n = 100):
    xykm, thm, costm = run_elastica_half(-sm, k0, -lam1, lam2, n)
    xykp, thp, costp = run_elastica_half(sp, k0, lam1, lam2, n)
    xyk = []
    for i in range(1, len(xykm)):
	x, y, k = xykm[i]
	xyk.append((-x, y, k))
    xyk.reverse()
    xyk.extend(xykp)
    x = xyk[-1][0] - xyk[0][0]
    y = xyk[-1][1] - xyk[0][1]
    th = thm + thp
    sth, cth = sin(thm), cos(thm)
    x, y = x * cth - y * sth, x * sth + y * cth
    result = []
    maxk = 0
    for xt, yt, kt in xyk:
        maxk = max(maxk, kt)
        result.append((xt, yt, kt))
    cost = costm + costp
    return result, cost, x, y, th
dataset/ETHPy150Open google/roboto/third_party/spiro/curves/mecsolve.py/run_elastica/original