![]() |
VOOZH | about |
A Vector Quantity is a Quantity which possesses both magnitude as well as direction. Here, magnitude is simply the amount or size of the quantity and direction is where the quantity is headed. For example, consider the statement "Go 20 miles north". In the above statement 20 is the magnitude and North is the direction. 👁 Image
Examples:
Input : Store and display vector with components 3, 4, 5. Output : 3i + 4j + 5k Input : Dot Product for V1 = (1, 3, 5), V2 = (2, 3, 0) Output : 11 where i, j, k are unit vectors in x, y and z directions respectively.
In General a Vector is represented as:
V = Xi + Yj + Zk Where, X, Y and Z are the magnitude of the vector V in the directions i , j and k respectively.
Various operations that can be performed on Vectors:
v = v1 . v2 = magnitude(v1)*magnitude(v2)*Cos(θ) Where, θ is the angle between the vectors v1 and v2.
Below is the implementation of above operations using class in C++:
V1 = 3i + 4j + 2k V2 = 6i + 3j + 9k V1 + V2 = 9i + 7j + 11k Dot Product is : 48Cross Product is : 30i -15j -15k