Python Intermediate #5 - Resolving a force or velocity into x and y components

In this post, we will resolve a velocity into its x and y components.  In the figure below, we have an initial velocity, V, on an angle, a, from the horizontal.

This lesson will be used in a later post to determine how far an object will travel based on those two parameters.  For now, however, the resolution of the components will be examined.


The x component of the velocity can be computed by multiplying the velocity, V, by the cosine of a.  The y component of the velocity can be computed by multiplying the velocity, V, by the cosine of (90 - a). 

The Python code for computing the x and y components is shown below.  The code has been commented using the # symbol.  This # symbol does not affect the computations, but it helps to document the code for future reference.


For angles less than 45 degrees, the x component will be greater than the y component:


For an angle of 45 degrees, the x and y components will be the same:


For angles greater than 45 degrees, the y component will be greater than the x component:




Comments