• Support PF! Buy your school textbooks, materials and every day products Here!

Split gravitational force into x, y, and z componenets

  • Thread starter RossH
  • Start date
  • #1
75
0
Hi. I'm not really all that knowledgeable about physics, so I'm sorry if the answer to this is obvious.

Homework Statement


I am writing a program for a computer science class in which I am doing an n-body simulation in 3-dimensional space. Currently, I have figured out the gravitational force along the hypotenuse between two bodies. Now I have to split these up into the x, y, and z components, and this is where I am having trouble.

Homework Equations


Force between two objects (force_t)=G*m1*m2/r^2
Typically, force_x=force_t*cos(angle between x-axis and hypotenuse)
force_y=force_t*sin(angle between x-axis and hypotenuse)

The Attempt at a Solution



So, I can figure out my triangle. I know that my two bodies are located at (x1, y1, z1) and (x2, y2, z2), so I have my triangle. And I am fairly certain that the above equations will hold for x and y, even though I'm in three dimensions, but I'm just not sure what the corresponding equation for the z component will be. My thought was that the combination of the three forces has to equal the total force, so perhaps I solve for the z component algebraically using the pythagorean theorem, but I have no way to check whether or not this is true.

Anyway, any help would be appreciated. Thanks!
 

Answers and Replies

  • #2
SteamKing
Staff Emeritus
Science Advisor
Homework Helper
12,798
1,666
How much vector mechanics have you studied?
 
  • #3
75
0
How much vector mechanics have you studied?
None. I've had a little linear algebra if that's related. I'm a computer science major with a minor in math.
 
  • #4
SteamKing
Staff Emeritus
Science Advisor
Homework Helper
12,798
1,666
It's difficult to explain so much in a forum like this. Have you sought assistance from someone studying physics?
 
  • #5
75
0
It's difficult to explain so much in a forum like this. Have you sought assistance from someone studying physics?
That's a good idea. I'll look into it. Do you know of any site that explains this? I've been googling for a site that explains the math in-depth, but have had no success.
 
  • #6
254
0
If I am not mistaking I think you can just orient the coordinate system so the force is along one axis. I dont know any CS though.
 
  • #7
75
0
If I am not mistaking I think you can just orient the coordinate system so the force is along one axis. I dont know any CS though.
That would be problematic because in the libraries that I am using to write this program I have a static coordinate system, and the forces and direction of forces are dynamic, since I'm doing an n-body simulation. Unless you know of a way that I can recalculate the coordinate system? The programming isn't a problem; it's just the math that's giving me grief.
 
  • #8
75
0
Here's how I think I might be able to solve it (keep in mind that this is based on a decent amount of math but only one year of high-school level physics).

I am trying to split up a force vector in a 3-dimensional space into three components, and I definitely have enough information to solve for all triangle side lengths with no trouble.

I already know how to solve for the force in 2-dimensions. Fx=cos(theta)*F_total and Fy=sin(theta)*F_total, where theta is the angle of incidence with the x-axis.

Therefore, I can split this into two triangles. One will be a triangle in the x-y plane and one will be a triangle in the x-y-z space. The hypotenuse of the triangle in the x-y plane will be one leg of the triangle in x-y-z space.

To picture this: a square room. One triangle is made by the line from one corner on the floor of the room to the corner farthest from it on the ceiling. Another triangle is the half of the room that is on the floor, connecting to the third side of the first triangle.


Then, I can easily solve for the leg lengths of the second triangle. Therefore, if I use the typical math described above to find the force on each of the legs of the original triangle, I can use this information to find the force in one direction and then a second force, which will be the combination of the x-y force.

I can use x-y force with the second triangle described above and split it up into its components to find the individual forces that are in this triangle.

I think that this should work, but obviously I have no means to test it. Does this sound alright to you? Obviously it's rough. Sorry, I couldn't find a good picture online to describe what I mean by two triangles.
 

Related Threads on Split gravitational force into x, y, and z componenets

  • Last Post
Replies
0
Views
3K
Replies
1
Views
1K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
7
Views
1K
Replies
6
Views
850
Replies
14
Views
2K
Replies
5
Views
587
  • Last Post
Replies
12
Views
2K
  • Last Post
Replies
6
Views
9K
Top