2 Write a program in Mathcad or Smath to calculate the angle
2. Write a program in Mathcad or Smath to calculate the angle between two vectors of the same dimension (make sure they are the same dimension, if not tell the user they can’t do what they want). Use definition of dot product
Solution
Let A = a1i+a2j+a3k be a vector
and B = b1i+b2j+b3k be another vector.
Find the dot product of A and B
A.B = a1b1+a2b2+a3b3
A.B = |A||B| cos t where t is the angle between the two vectors
Hence we find that cost = (a1b1+a2b2+a3b3)/|A||B|
where |A| = (a12+a22+a32)1/2
and |B| = (b12+b22+b32)1/2
Hence angle t = cos inverse of (a1b1+a2b2+a3b3)/ (a12+a22+a32)1/2 (b12+b22+b32)1/2
