- #1

- 9

- 1

var num = 1

num = num + 2

num = num * 3

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter cnblock
- Start date

- #1

- 9

- 1

var num = 1

num = num + 2

num = num * 3

- #2

Baluncore

Science Advisor

- 8,955

- 3,542

Start here; https://en.wikipedia.org/wiki/Gravitational_field#Classical_mechanics

https://en.wikipedia.org/wiki/N-body_simulation

Or find any book on Orbital or Celestial Mechanics.

If you want our real Solar system predictive computations...

Beginners programming guide here; Astronomical algorithms, by Meeus J. Willmann-Bell, 1991.

See also; SLALIB, find code here by following https://en.wikipedia.org/wiki/Starlink_Project

- #3

- 9

- 1

- #4

Baluncore

Science Advisor

- 8,955

- 3,542

No, divided by the distance between those two masses squared.all divided by the radius of my circle squared.

- #5

Baluncore

Science Advisor

- 8,955

- 3,542

You will need to do vector arithmetic on x and y components.

Define a particle as an object. It has mass m, position px and py, and velocity vx and vy vectors.

For each time step you must;

1. Sum all the force components fx and fy of gravitational forces on each particle, due to all other particles using the force = G.m1.m2 / r2 equation.

2. Use that force and the particle mass to update the particle velocity component vector.

3. Work out the new position of each particle based on last position and velocity.

4. Redraw the screen.

Setup a couple of particles with mass, position and velocity. See if you can simulate one particle orbiting another on the screen.

Share:

- Replies
- 2

- Views
- 3K