# How do I calculate the time it would take for a space craft launching from earth to reach another planet?

I am making a matlab program the my final project for my programming class in college. I have chosen this problem, but I am bashing my head against the wall trying to figure out the equations and how they interact with each other.

I have the user play with the thrust and the payload to carry to the other planet. The user also decides what planet to go to and what type of orbit to use (elliptical or parabolic).

I know I have to usde the rocket equation, escape velocities have to be claculated, and time formula, but I still haven't figured out what to do.

-

There is no single possible travel duration between two planets at a fixed epoch. You can chose a trajectory according to different criteria and then you can compute the transfer orbit that satisfies your constraints. Once you know the time t1 you would like to launch at and the time t2 at which you would like to reach your destination, you solve the Lambert problem for t1, t2, r1, r2 where r1 is the position of the origin planet at t1 and r2 is the position of the destination planet at t2. Lambert problem is basically a boundary value problem for the equations of motion of the spacecraft in the central gravitational field of the Sun.

As the solution to your Lambert problem, you find the trajectory of the spacecraft in terms of its position r and velocity v as functions of time t. This allows you to compute the delta-v required for launch at the origin planet and the delta-v required for breaking at the destination planet:

$$\Delta{v_L} = |v_s(t_1)-v_{p_1}(t_1)|$$ $$\Delta{v_B} = |v_s(t_2)-v_{p_2}(t_2)|$$

where ΔvL is the delta-v required for launch, ΔvB is the delta-v required for breaking, vs(t) is spacecraft velocity at epoch t, vp(t) is velocity of planet p at epoch t, p1 is the origin planet and p2 is the destination planet. All velocities are relative to the Sun. If your mission involves only a fly-by as opposed to entering an orbit around the destination planet or landing on its surface, you do not need to consider ΔvB.

It may turn out that one or both of these delta-vs is infeasible or too expensive with your propulsion system. For this reason, real missions are designed using optimization algorithms which solve Lambert problem repeatedly for different possible dates t1 and t2. This way your propulsion system comes into the problem imposing constraints on admissible launch windows.

One particular case which is easy to solve is Hohmann transfer. This is a very energy efficient direct trajectory between two circular orbits that takes 180 degrees around the Sun. In this case travel time is

$$\Delta{t} = \pi \sqrt{\frac{(r_1+r_2)^3}{8GM}}$$

where G is the gravitational constant and M is the mass of the Sun.

The above assumed your propulsion used chemical engines that fire very briefly, but providing a very high delta-v (often modelled as instantaneous change in velocity). There are alternatives including low-thrust propulsion systems, like ion engines and solar sails. Designing trajectories with these propulsion systems requires solving more general equations of motions than those in the Lambert problem.

Real missions also often take advantage of Gravity Assist Maneuvers and Deep Space Maneuvers which require more complex computations as well as optimization algorithms, such as Differential Evolution or Particle Swarm Optimization and search space reduction algorithms like Gravity Assist Space Pruning.

To directly answer your question: unless you specify which trajectory you have selected for your mission out of infinite many direct and indirect paths from one planet to the other, there is no simple formula for the travel time. Moreover, travel time is a variable that you have certain freedom to adjust as the mission is planned. In order to verify whether a given travel time along a direct transfer trajectory using chemical propulsion is feasible you should solve the Lambert problem for your parameters and determine whether the delta-vs required fall within your capabilities.

-
Nice, but I always want to say "Boo! Do it 'space cadet' style like Robert Heinlein intended, flip turn in the middle and all!". We now return you to your regularly scheduled real-life. –  dmckee Dec 9 '11 at 4:21