Force components between two bodies

AI Thread Summary
To find the force components between two bodies, such as the Earth and the Sun, it's essential to determine the angle between them. By encoding the locations of each body, the angle can be calculated using the coordinates. Many programming languages offer built-in functions to compute the angle from two points. Alternatively, the sine and cosine of the angle can be derived using the distance formula and the differences in height and width. Understanding these concepts allows for accurate calculations in an n-body simulator.
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.
 
I think it's easist first to watch a short vidio clip I find these videos very relaxing to watch .. I got to thinking is this being done in the most efficient way? The sand has to be suspended in the water to move it to the outlet ... The faster the water , the more turbulance and the sand stays suspended, so it seems to me the rule of thumb is the hose be aimed towards the outlet at all times .. Many times the workers hit the sand directly which will greatly reduce the water...
Back
Top