Force components between two bodies

Click For Summary

Discussion Overview

The discussion revolves around calculating the components of the gravitational force between two bodies, specifically the Earth and the Sun, within the context of an n-body simulator. Participants explore methods to determine these components without initially knowing the angle between the bodies.

Discussion Character

  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant expresses confusion about finding the force components without knowing the angle, referencing the use of trigonometric functions.
  • Another participant asserts that if the locations of the bodies are known, the angle can be determined through the coordinate system.
  • A further contribution suggests that many programming languages provide built-in functions to calculate the angle between two points, and outlines a method to derive sine and cosine values using the distance formula.
  • The original poster acknowledges a realization that they can find the angle using the known positions of the bodies.

Areas of Agreement / Disagreement

Participants generally agree that the angle can be determined from the positions of the bodies, but there is no consensus on the best method to calculate the force components without knowing the angle initially.

doymand
Messages
2
Reaction score
0
I am making an n-body simulator, but I'm stuck. How can I find the components of the Force acting between two bodies such as the Earth and the Sun. I know it's-

F * Cos(theta) and F * Sin(theta) but if I don't know the angle how can I find the components?

I'm using the diagram on this website but I'm still baffled.
http://www.cs.princeton.edu/courses/archive/spr01/cs126/assignments/nbody.html
 
Physics news on Phys.org
if I don't know the angle how can I find the components?
You can't.

If you can encode the locations of each body, then you know the angle.
Exploit your coordinate system.
 
I don't know what language you're using, but a lot of them have an easy,built in method of putting two points into a method/function, and getting out the angle between them. Things like Java should have a class for that, it might me contained in the regular "Math" class but I'm not sure.

You could also find the sines and cosines of the angles YOURSELF with your coordinates easily. Find the distance between your two points using the pythagorean theorem/distance formula, call it d
Say the difference in height is h, and the difference in width is w
(d2 = h2+w2)

sinθ = h/d
cosθ = w/d
 
Thanks, in my search for a complex answer I forgot that I knew the positions of both of them and could easily find the angle.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K