# Group 1: initialize G:=6.6726e-11: m1:=5.975e24: m2:=7.36e22: R1:=6.378e6: R2:=3.84e8: R3:=1.74e6: R4:=R2-R1-R3: de:=diff(r(t),t,t)=-G*m1/(r(t)+R1)^2+G*m2/(R2-R1-r(t))^2: # Group 2: Search for flight time T. v0:=11200: T:=162800: ic:=r(0)=0,D(r)(0)=v0: p:=dsolve({de,ic},r(t),type=numeric,method=lsode); Y:=t->rhs(p(t)[2]): plot({'Y(t)',R4},t=0..T,0..R4); Y(T)-R4; # Plot done. Change v0, T and re-execute group 2, until # the plotted curve reaches the upper right corner or # Y(T)-R4 is approximately zero. # Group 3: Solve for flight time Tstar. T1:=T-200: T2:=T: # If T is close enough to the flight time to the moon, # then fsolve() prints a precise answer for the flight time. Tstar:=fsolve('Y(x)'=R4,x,T1..T2); # Answer check: Y(Tstar)-R4 should be approximately zero. Y(Tstar)-R4;