The science
The craft starts in a circular Earth parking orbit of radius r1 = R_E + h with speed v_c = sqrt(mu/r1). An impulsive trans-lunar injection (TLI) adds Δv along the velocity, giving v1 = v_c + Δv. The new orbit follows from the vis-viva equation and conservation of energy:
v^2 = mu (2/r - 1/a), eps = v1^2/2 - mu/r1 = -mu/(2a), h = r1 v1, p = h^2/mu, e = p/r1 - 1.
Position in time comes from Kepler's equation M = n t = E - e sin E (solved by Newton iteration) and tan(nu/2) = sqrt((1+e)/(1-e)) tan(E/2). The craft meets the Moon's orbit radius D = 384 400 km at true anomaly cos nu = (p/D - 1)/e.
Patched conics. At the Moon the craft's velocity relative to the Moon is v_inf = sqrt(v_r^2 + (v_t - v_Moon)^2), with v_Moon = sqrt(mu/D). Inside the Moon's sphere of influence (about 66 100 km) the Moon's gravity dominates: periapsis speed v_p = sqrt(v_inf^2 + 2 mu_M / r_p), and the capture burn into a circular orbit there is v_p - sqrt(mu_M / r_p).
Timing. The Moon moves at 2 pi / 27.32 d. A launch timing error of d_phi puts the Moon d_phi away from the craft's arrival point, so the miss distance is the chord between them. Inside the sphere of influence a real mission fixes the remainder with a mid-course correction; this lab assumes it does.
Honest simplifications. Planar motion, circular Moon orbit, impulsive burns, no Sun, no Earth oblateness, no gravity losses, no free-return geometry. Earth and Moon are drawn about 13 times too large so they stay visible; the trajectory itself is to scale. Real missions differ by tens of m/s.
Independent check. The two-body equations are integrated numerically with RK4 (20 s steps) and compared with the closed-form arrival radius, energy drift and Kepler timing: