# How do I calculate how something should stay in position under gravity?

Excuse me if this too simple a question - I'm not a regular (consciously) user of physics.

I have a ship in space and it is under the effect of three moons. The ship can rotate and thrust to move within the 2D world. My problem is: how do I maintain the ship's position if I know some details about the moons?

Here is what I've gotten so far (see the edit for a revised example):

$F$ = $F_1$ + $F_2$ + $F_3$ is the total forces of all three moons; $\small M_1,M_2,M_3$, exertet on the object, $S$.

Then $F_1 = G \times m_{M_{1}} \times m_{S} / R^2$ where $R = \text{distance}(S, M_1)$.

Once I find $F$ I want to find my acceleration, so I use the formula $a = F / m_S$. With $a$, I want to find my new velocity, so I use the formula $V_f = V_i + a \times t$.

I then find my new position using $P_n = P_o + V_f$.

Two questions:

1. Is this correct up until this point?
2. From this new position, how do I determine the amount of thrust (a scalar) to apply? Is it the length of $V_f$? And how do I determine the new angle, if I have the current rotation of the ship?

EDIT:

If the above is too hard to understand, here is a revised version that may follow a bit better.

Given a spaceship's angle $\theta$, position $[x_s,y_s]$, mass $m_s$, and initial velocity $v_s$ and three moons with mass $m_i$ and position [$x_i, y_i]$ exerting a gravitational force on the ship.

How do I find the necessary velocity and angle of the ship to counter act the moons and maintain position?

• What is the ship's initial velocity and position? Does it start at rest? – Ataraxia Apr 13 '13 at 4:35
• @ZettaSuro No, it may start moving and at a position other than (0,0). – sdasdadas Apr 13 '13 at 4:47

How do I find the necessary velocity and angle of the ship to counter act the moons and maintain position?

Velocity doesn't matter. Acceleration does. It will need to accelerate in a direction opposite the net force exerted on it by the three planets:

$$\vec{F_{net}}=\vec{F_1}+\vec{F_2}+\vec{F_3}$$

The net force is just the sum of these three forces. Therefore, the aircraft will have to exert its own force that is opposite that force:

$$\vec{F_{thrust}}+\vec{F_{net}}=0$$ $$\vec{F_{thrust}}=-\vec{F_{net}}$$

The angle at which this force applies is entirely dependent on the direction of the net force, but it should be at a 180 degree angle from the net force:

$$\theta=arctan(F_{thrust,y}/F_{thrust,x})$$

Don't forget that if the x component is negative, then add 180 degrees to the result you get from the arctan function!