pasteurisiert
10/5/2019 - 5:10 PM

latex_sympy

import sympy as sy
from IPython.display import display, Math
sy.init_session(quiet=True)

m1, m2, u1, u2, v1, v2, E = sy.symbols('m_1, m_2, u_1, u_2, v_1, v_2, E_crash')

eq1 = m1*u1 + m2*u2 - m1*v1 - m2*v2
eq2 = m1/2*u1**2 + m2/2*u2**2 - m1/2*v1**2 - m2/2*v2**2 - E

u, v = sy.solve((eq1,eq2), (v1,v2))

vs = [latex(sy.simplify(v[0])), latex(sy.simplify(v[1]))]

display(Math(r'v_1 =' + vs[0]))
display(Math(r'v_2 =' + vs[1]))