- #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.

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:

p

t

v

r

t

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.

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]

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.

Any helpful input is much appreciated.

## 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:

p

_{i}- Initial positiont

_{i}- Initial timev

_{i}- Initial velocity (speed along x and y axis)r

_{i}- Initial radius (which gives the acceleration)t

_{f}- Final timeThe 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.

Any helpful input is much appreciated.

Last edited: