# Math, KSP Calculators Questions

## Recommended Posts

I'm very new to the community, but very thankful already to all of the great posts, mods, and calculators. I particularly like the calculators that folks have developed, and I'm wondering if anyone has more detailed knowledge about the actual mathematics. It seems the calculators are using approximations, which is understandable since the math gets tough quickly without them. Specifically, I've been looking at planetary phase angles. Olex's (https://ksp.olex.biz/) calculator and KSP wiki (https://wiki.kerbalspaceprogram.com/wiki/Time) both report that the optimal phase angle for transfer is 44.36 degrees. I can derive this value, but I don't think it's technically correct, and that it could vary, say, between 38-53 degrees. Can anyone discuss this?

-Also, I apologize if I'm posting in the wrong place.

##### Share on other sites

Hi and welcome, @ScrapIron,

Wow, I'm impressed, you certainly are a very smart person (much smarter than me anyway)

Guys coming to my mind immediately here are definitely @sarbian , @Jim DiGriz and the other folks developing MJ, see this thread

##### Share on other sites

Lambert solvers.

In the simplest case, neglecting the planetary orbits and only looking at the heliocentric problem you have three orbits and two unknowns.  One is the coast to your departure time, which is determined by the departure planet's orbit.  The last is the coast to the arrival time, which is determined by the arrival planets orbit.  To figure out the transfer orbit from the departure position and time to the arrival position and time you use a Lambert problem solver.

MechJeb actually has two.  I think this one is Battin's method:

This one is Gooding's Method:

I think the Gooding one is robust enough now that the former could be deleted, although I haven't fully tested the multi-revolution behavior of the Gooding Solver yet.

Anyway.

Now given the departure and arrival times you can solve the problem for how much delta V it costs for the departure burn and for the arrival burn (unless you're not going to match orbits and are going to do an impactor or a flyby).

The problem then becomes searching for departure and arrival times which minimize the cost of the transfer orbit.  You can brute force search that and that is what produces a porkchop plot.  Or you can turn it into a minimization problem and use off-the-shelf algorithms to find the minimum value.  Newton's method is the Calculus 101 tool that can be used to solve that problem, but since derivative information is difficult to obtain for the problem, its better to use some kind of quasi-Newtonian solver like Levenburg-Marquardt.  For finding global solutions to the optimization problem that is harder and is the domain of simulated annealing or basin hopping algorithms.

Edited by Jim DiGriz

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.