# Does anyone know...

• 02-09-2005
MyDestiny
Does anyone know...
This is my first programming class... so... that is why I am asking a lot of questions.... :D

If I have 3 forces...i, j, and k - but, I need to find the direction of just i... how do I got about doing that?

I dont have any angles - just those three forces...

does anyone know how to insert a C++ statement that would calculate the angle of just one force?

Thanks again.

MyDestiny
• 02-09-2005
Kaelin
Are we talking vector momentum?

The C++ behind it is very simple - it's the math that could be tricky (if even that).

I think we need a little more info. Like, what code do you have so far? What does each variable represent? Like, is i a vector, a magnitude, or what?
• 02-09-2005
MyDestiny
Wait... I think I got confused... let me explain what I need...

I have 3 components for Force F1 - i, j, and k

I calculated the magnitude of i, j, and k

Now, I need to calculate the direction of i, j and k.

Did that help?
• 02-09-2005
Kaelin
So F1 is the total net force acting on an object, where i, j, and k represent the various "sub-forces" acting on it - like friction, etc?

I'm not really sure if you mean there are three sources of the "push" such as three people pushing a block from various angles, or if the variables represent certain components of a single push coming from one source
• 02-09-2005
AH_Tze
i, j, and k are unit vectors. Any vector can be broken down into unit vector components.

I think you should work out some psuedo-code, and set up the problem (ie, what data type are i, j, k). It's not at all clear where the C++ problem is.

If you're not sure how to calculate the resultant vector from components, you need to check your physics book. If you are sure, write it down in logical steps and attempt to code it.
• 02-09-2005
DougDbug
Before you can write the code, you have to know how to solve the problem (the algorithm). So at this point, it's either a math (or physics) problem. Do you have the prerequisites for this course? :D

Quote:

I have 3 components for Force F1 - i, j, and k... Now, I need to calculate the direction of i, j and k.
What? Maybe you should post the actual problem.

If i, j, & k, are "components" of a vector, then they are precisely in directions X, Y, and Z. ...All 90 degreess apart... I suspect you're supposed to calculate the direction of F1. (?) I don't remember exactly how to do that... and I've forgotton what a 3-dimensional vector expressed as magnitude and direction "looks like"... but you'll need two angles.
• 02-09-2005
7stud
You mean I can't just plug numbers into C++ and come up with a unifying theory of all forces throughout the cosmos? What a jip.