Formula for simulating orbital motion (2D)

In summary, the conversation discusses the goal of creating a program to simulate an object orbiting a fixed point. The person is looking for a formula to calculate the distance traveled for any given time using only certain variables. They have attempted to merge two formulas but are unsure if it will work. Another person mentions the Kepler problem and the need to use both components in solving the motion. The first person plans to use the Pythagorean theorem to find the x and y components of acceleration, but the second person points out that the acceleration is not constant and the direction also changes. The first person acknowledges this and suggests estimating the distance traveled given varying acceleration.
  • #1
Zaiks
3
0
Hello. I'm new on this forum and I hope I'm posting this in the right place. This is not for a homework assignment but a spare-time project I'm working on.

Homework Statement


The goal with this project is to make a simple program that simulates an object that orbits a single fixed point. This behavior will be drawn on a 2D canvas, for instance in a web browser. The program will draw the object's position for each frame. This program looks somewhat like what I'm trying to accomplish, but it lacks an "algebraic" formula, so the orbit here is unstable. Since I want the orbit to be stable, I can't just keep adding to the speed and acceleration variables, since this would give noticeable rounding errors over time.

What I need is a formula to find the distance traveled for any given time with only these variables:

pi - Initial position
ti - Initial time
vi - Initial velocity (speed along x and y axis)
ri - Initial radius (which gives the acceleration)
tf - Final time

The problem is that if the orbit is not circular, the radius will change over time, and so will the acceleration. I'll probably need to use derivatives. Once I have this formula working for a one-dimensional scenario (i.e. a vertical drop), I'll be able to solve for horizontal and vertical displacement.

Homework Equations


I'm trying to keep things simple for now, just so I can understand the concept.
[itex]F = ma[/itex]. Assuming [itex]m = 1[/itex] gives [itex]F = a[/itex]
[itex]F = Gm1m2/r^2[/itex] simplifies to [itex]a = 1/r^2[/itex] (assuming G = m1 = m2 = 1).
[itex]a = Δd/t^2[/itex]
[itex]Δd = vi*t + at^2/2[/itex]

The Attempt at a Solution


I was thinking of just substituting [itex]a[/itex] with [itex]1/r^2[/itex], like this:
[itex]Δd = vi*t + (1/r^2) * t^2/2 =[/itex]
[itex]Δd = vi*t + t^2/2r^2[/itex]

But this somehow feels wrong.

Another thing that came to mind is that the functions Δd(a) and Δa(r) look very similar. I've been refreshing my calculus skills lately but I feel like I'm in way over my head here. :rolleyes:

Any helpful input is much appreciated.
 
Last edited:
Physics news on Phys.org
  • #2
You cannot separate the two components.
This setup is known as Kepler problem, and there are formulas you can use.
 
  • #3
Thank you for your reply.
mfb said:
You cannot separate the two components.
This setup is known as Kepler problem, and there are formulas you can use.

Which components are you referring to? As far as I can see I am only trying to merge two formulas, and it seems very doable. It would help me if you could explain why this will not work.

I'm making some statements here; if any of them are wrong please tell me:
- The average velocity of a moving object can tell us how far it has moved in a certain time frame, given constant acceleration.
- If acceleration is not constant, the average acceleration should give the same result, that is, how far an object has moved (in a time frame).
- In a scenario with two objects orbiting each other, the acceleration will change with the radius (the distance between their centers of mass, by inverse square law).
- Given the above, if I know the initial and final radius in a time frame, I could use that to calculate the average acceleration, and with that find the distance moved (either as a vector, or by calculating separately for the x and y axis).I read your link on the Kepler problem but I don't see how it directly relates to what I'm trying to do. The formulas presented on the wiki can be tedious to understand. I will look into it though. I want to know how formulas work before I use them in my program.
 
  • #4
Which components are you referring to?
The two coordinates. You cannot solve the motion independently for both (apart from some trivial examples where the motion is 1-dimensional), as the radius (which influences the gravitational acceleration) depends on both at the same time.

- The average velocity of a moving object can tell us how far it has moved in a certain time frame, given constant acceleration.
Right. But acceleration in an orbit is not constant.
- If acceleration is not constant, the average acceleration should give the same result, that is, how far an object has moved (in a time frame).
This is wrong. Consider two different objects, both start at x=0 and t=0.
A accelerates with 10m/s^2 for one second, and keeps its velocity of 10m/s for 9 seconds afterwards. Final velocity: 10m/s. Average acceleration: 1m/s^2. Total distance travelled: 95m.
B keeps motionless for 9 seconds, and accelerates with 10m/s^2 afterwards. Final velocity: 10m/s. Average acceleration: 1m/s^2. Total distance travelled: 5m.
- In a scenario with two objects orbiting each other, the acceleration will change with the radius (the distance between their centers of mass, by inverse square law).
Not just with the radius, as the direction of acceleration changes as well.
 
  • #5
mfb said:
The two coordinates. You cannot solve the motion independently for both (apart from some trivial examples where the motion is 1-dimensional), as the radius (which influences the gravitational acceleration) depends on both at the same time.

Ah. I forgot to mention I will be using the Pythagorean theorem to find the x and y components, since a vector with an angle can also be represented using only its x and y components. Ex: An object moving 5 units with a positive 60 degree angle relative to the x-axis will have moved 4 units in the y-direction and 3 in the x-direction. This concept works for movement and velocity, and it should for acceleration as well.

mfb said:
Right. But acceleration in an orbit is not constant.

True.

mfb said:
This is wrong. Consider two different objects, both start at x=0 and t=0.
A accelerates with 10m/s^2 for one second, and keeps its velocity of 10m/s for 9 seconds afterwards. Final velocity: 10m/s. Average acceleration: 1m/s^2. Total distance travelled: 95m.
B keeps motionless for 9 seconds, and accelerates with 10m/s^2 afterwards. Final velocity: 10m/s. Average acceleration: 1m/s^2. Total distance travelled: 5m.
[...]
Not just with the radius, as the direction of acceleration changes as well.

You're right, thanks for correcting me. It should be possible, though, to estimate how far an object has moved given varying acceleration as long as it can be expressed as a function. If I were to graph your example with velocity along the y-axis and time along the x-axis, the area between the graph and the x-axis would equal the distance traveled. This concept wouldn't change even if the graph function was exponential (integration is required to find the area though). The relationship between radius and acceleration is fixed, so this should be graphable somehow.

Imagine this scenario:
In a 2D coordinate system, a projectile accelerates towards a point (0,0). At time t = 0, its initial position is (2,-10). The initial velocity is (6, 2) units/time in the x- and y-directions respectively. The initial radius is given by the position. The initial acceleration is given by the radius. The direction of the acceleration will change over time, but it will always point towards (0,0). Given these initial conditions, at any final time, there is only one possible position the projectile may be in. So there must exist a formula that correctly graphs this path.
 
  • #6
If you know the acceleration as function of time, you can calculate the position, sure. But you have no easy way to determine this, as acceleration depends on position, and those influence each other all the time.
As I posted, there are solutions, but they (and their derivation) are not as easy as you might hope.
 

FAQ: Formula for simulating orbital motion (2D)

1. What is the formula for simulating orbital motion in 2D?

The formula for simulating orbital motion in 2D is F = G * (m1 * m2)/r^2, where F represents the force of gravity, G is the gravitational constant, m1 and m2 are the masses of the two objects, and r is the distance between them.

2. How does this formula account for the motion of objects in orbit?

This formula takes into account the principles of Newton's Law of Universal Gravitation, which states that two objects with mass are attracted to each other by a gravitational force. In the case of orbital motion, this force keeps the objects in a stable circular or elliptical path around each other.

3. What are the units of measurement for the variables in this formula?

The units of measurement for each variable are as follows: F (force) in Newtons (N), G (gravitational constant) in Newtons-meter squared per kilogram squared (Nm^2/kg^2), m1 and m2 (masses) in kilograms (kg), and r (distance) in meters (m).

4. Can this formula be used for any type of orbit?

Yes, this formula can be used for any type of orbit as long as the objects are considered point masses and their masses and distances are known. However, for more complex orbits, additional factors and equations may need to be taken into consideration.

5. How accurate is this formula in simulating orbital motion in real life?

This formula is a simplified version of the actual mathematical equations used to model orbital motion. While it provides a good approximation of the motion, there may be slight deviations from the actual orbit due to factors such as the influence of other celestial bodies or the shape of the objects involved.

Back
Top