I need to solve the Lambert problem, however, I have a custom gravity model.

My ODE of motion is:

def ode_solve(y):
    r=sqrt(y[1]**2 + y[2]**2 + y[3]**2)

    dy[1] = y[4]
    dy[2] = y[5]
    dy[3] = y[6]
    dy[4] = -y[1]*n/r
    dy[5] = -y[2]*n/r
    dy[6] = -y[3]*n/r

    return dy

For the Earth I used the izzo.lambert(Earth.k, r0, r, tof) function from poliastro package on Python. However, the function requires the gravitational parameter (Earth or Sun), and I can't customize it.

Is there a way to solve the Lambert problem for custom gravity on Python?

  • $\begingroup$ I've never used Julia, it's my allergy to curly braces that gets me stuck every time I try. If you get this working in Julia it would be really wonderful if you post a supplemental answer with that. $\endgroup$
    – uhoh
    May 21, 2019 at 15:44
  • $\begingroup$ I've pinged the author of poliastro here, there may be a solution using poliastro. You can also think about going to the Github site and asking there as well. Here's the orbit integrator example pastebin.com/sp3DnuCB If I put it inside a BVP solver I'll post a real answer. $\endgroup$
    – uhoh
    May 21, 2019 at 16:08
  • $\begingroup$ ping received :) I am open to dedicate it some time (it's not straightforward) but I'd like @Leeloo to clarify whether this is homework, and if that's the case for which University (if possible) or if the statement can be shared. $\endgroup$ May 22, 2019 at 6:19
  • $\begingroup$ @astrojuanlu Thanks for your support! This is a case for my research. I would share the papers later $\endgroup$
    – Leeloo
    May 22, 2019 at 6:37
  • $\begingroup$ Awesome.......! $\endgroup$ May 22, 2019 at 8:46

1 Answer 1


Summarizing some answers from the poliastro issue:

The Lambert problem is nothing more than the two body boundary value problem under the assumption of Newtonian dynamics and spherical gravity. Therefore, to solve a case with a different gravity field, you would need to write the equations of motion and use a boundary-value problem solver. I don't know of any ways to adapt existing Lambert algorithms to custom gravity models, because they are already written with that assumption in mind, and you would have to basically unroll all the equations.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.