|
Problem:
Find a unit vector that points in the direction of the vector,
|
|
Solution:
First define i and j, |
> i := vector([1,0]); j := vector([0,1]);
i := [1, 0] j := [0, 1]
then define v in terms of i and j, |
> v := (1/2)*i + (1/4)*j;
v := 1/2 i + 1/4 j
The answer is obtained by dividing v by its length, |
> Sol := evalm(v/sqrt(dotprod(v,v)));
[ 1/2 1/2] Sol := [2/5 5 , 1/5 5 ]
This can also be written as, |
> [2,1]/'sqrt(5)';
[2, 1] ------- sqrt(5)
which is approximatly, |
> evalf(%);
[.8944271912, .4472135956]