A vector has length 4 and orientation 150°. Represent the vector as a column matrix
The 2D matrix is ( -3.464, 2.0 )T .
The steps in this calculation are:
Be cautious about plugging into these formulae and expecting correct answers, especially when programming in C or Java. Math libraries for a programming language can do unexpected things if you are not careful.
There are three places to be especially cautious:
Now would be a good time think about radians. Usually in professional circles, angles are expressed in radians. Angles are measured counter-clockwise from the positive x axis (or sometimes a negative angle is measured clockwise from the positive x axis.
Say that you have the length
and angle
of a vector.
Fill in the blanks so that vector[0]
gets the x component
and vector[1]
gets the y component of the vector.
#include <math.h> double length, angle; /* length and angle of a vector */ double vector[2]; /* elements of the vector */ . . . length = some value angle = some number of degrees vector[0] = vector[1] =
(Assume that the symbol for pi is M_PI
.
Unfortunately, different compilers use different symbols for PI and
define it in different header files.
You should use the symbol appropriate for your system
rather than define PI on your own.)
(If you don't know C, just pretend this is Java.)