Simulating orbital gravity with a prediction of trajectory (Multiple attractors)

Hello fellow programmers,
I saw this post about simulating orbital gravity : http://www.java-gaming.org/topics/orbital-mechanics-keplers/35771/msg/339215/view.html#msg339215
I’m trying myself to predict more-than-two-body attractions and I don’t really know which data structure I should use to achieve this result, I wanted to know which method you used at the time.
I also tought of only using scalar (something like a ‘gravity’ tension) in a grid.

tl;dr:I’m trying to predict the trajectory of a body with multiple attractors (a static one and multiple moving ones)

Just run the simulation, why would you need to predict anything?

predicting is simulating. anyway, if you want to try discreet instead of continuous … leapfrog integration is a very good choice. it is orbit stable and reversible.

Maybe this will be of use: https://youtu.be/OAcXnzRNiCY

OAcXnzRNiCY

Sorry, I mean predicting future positions depending on the present ship velocity and position much like what you would see in Kerbal Space Program:

The player would than see how moving his ship alter his orbit.
The difference being that I would like the ship to get attracted by many bodies (The Earth And Asteroids if they are big and/or close enough).
I know that I won’t be able to make exact predictions but approximate ones should be enough.

Hope I’m more clear now and thanks for the quick replies.

Yeah, so simulate it.

I assume that what you’re looking for is: given the data of a body, figure out what its position will be after N seconds given that it is attracted by these K other bodies. This is actually an unsolved mathematical problem: https://en.wikipedia.org/wiki/N-body_problem

[quote]To this purpose the two-body problem has been completely solved and is discussed below; as is the famous restricted 3-Body Problem.
[/quote]
The only real way of “solving” this with more than 2/3 bodies is to simulate the whole thing. There are no known formulas or algorithms that don’t involve integrating with a certain time step (AKA simulating).