Trajectory in gravitational field

In summary, the conversation discusses finding the equations for orbital motion in Unity game engine, specifically the equations for r and phi in terms of time. The experts suggest using polar or spherical coordinates and integrating the differential equations of motion numerically. They also mention the energy conservation law and using a mechanics FAQ for guidance. It is also suggested to use numerical methods for solving the differential equations. The conversation concludes with the mention of using Sage or Python for solving the equations.
  • #1
GhostLoveScore
149
9
So, I'm attempting to programm orbit in Unity game engine. So I need equation that shows r and phi depending on time.

Equation for gravitational potential is

U(r)=-k/r+M^2/(2*μ*r^2). Force is -1*derivation of U(r) by r. So I get lots of stupid stuff.

If anybody could help me to integrate this equation to get r(t) I would be grateful.
 
Physics news on Phys.org
  • #2
It doesn't work that way. You should integrate the differential equations of motion numerically.
 
  • #3
Can you please explain, what differential equations? Is it m*d^2(x)/dt^2=gravitational force + centrifugal force?
 
  • #4
If you use polar coordinates [itex] (\rho,\varphi) [/itex], then the equations are:

[itex] \rho^3\ddot \rho+GM \rho=R^4 \omega^2[/itex]
and
[itex] \rho^2 \dot\varphi=R^2 \omega [/itex]

where [itex] R [/itex] is the initial distance from the centre of force and [itex] \omega [/itex] is the initial angular speed.
 
  • #5
Actually I'm using spherical coordinate system
 
  • #6
GhostLoveScore said:
Actually I'm using spherical coordinate system

Well, there is absolutely no difference. Because the orbits of an inverse-square field lie on a plane and so the problem is two dimensional and spherical coordinates reduce to polar coordinates in two dimensions.
 
  • #7
Don't forget that
[tex]M=\mu r^2 \dot{\varphi}=\text{const}.[/tex]
Then you can use the energy-conservation Law
[tex]\frac{\mu}{2} \dot{r}^2 +U(r)=E=\text{const}[/tex]
substitute
[tex]\dot{r}=\frac{\mathrm{d}r}{\mathrm{d} \varphi} \dot \varphi=\frac{\mathrm{d}r}{\mathrm{d} \varphi} \frac{M}{\mu r^2}.[/tex]
With this you get a differential equation for the orbit in terms of polar coordinates [itex]r=r(\varphi)[/itex].

To integrate it, just substitute
[tex]s=\frac{1}{r}[/tex]
into this differential equation.

You find the calculation in my mechanics FAQ (which is, however, in German, but with a lot of equations, so that you should be able to follow the arguments with the above given summary).

http://theory.gsi.de/~vanhees/faq/mech/node42.html
 
  • #8
Thanks guys, that will help.

vanhees71 - in the end I get r=r(phi), but I need r=r(t) and phi=phi(t).

From shyan's equation I get

d[itex]\varphi[/itex]/dt=R^2*[itex]\omega[/itex]/ρ^2. I don't know how to get dρ/dt
 
Last edited:
  • #9
The equations I gave are already proper for being integrated numerically. You don't need to change them. You only need to learn about some methods of numerically solving differential equations.
 
  • #10
OK, I will look into that. Few years ago we were solving it in Sage (python).
 

1. What is meant by trajectory in a gravitational field?

Trajectory in a gravitational field refers to the path followed by an object as it moves under the influence of gravity. This path is determined by the object's initial velocity and the gravitational force exerted by a larger object, such as a planet or star.

2. How does gravity affect the trajectory of an object?

Gravity is the force that causes objects to be attracted to each other. In the case of trajectory, gravity affects the path of an object by pulling it towards the center of the larger object. This results in a curved path rather than a straight line.

3. What factors influence the trajectory of an object in a gravitational field?

The trajectory of an object in a gravitational field is influenced by several factors, including the object's initial velocity, the strength of the gravitational force, and the mass and distance of the larger object exerting the force. Other factors like air resistance and the shape of the object may also play a role.

4. How does the shape of an object affect its trajectory in a gravitational field?

The shape of an object can affect its trajectory in a gravitational field by altering the distribution of mass and the amount of air resistance it experiences. Objects with a larger surface area, such as a parachute, will experience more air resistance and have a slower, more curved trajectory compared to a smaller, more streamlined object.

5. Can an object's trajectory in a gravitational field be predicted?

Yes, an object's trajectory in a gravitational field can be predicted using mathematical equations, such as Newton's laws of motion and the law of universal gravitation. These equations take into account the initial conditions and influencing factors to accurately predict the path of an object over time.

Similar threads

Replies
3
Views
759
Replies
1
Views
791
Replies
3
Views
496
Replies
11
Views
2K
Replies
8
Views
2K
  • Introductory Physics Homework Help
Replies
15
Views
358
Replies
21
Views
5K
Replies
2
Views
1K
Replies
1
Views
6K
Back
Top