< Day Day Up > |
I'm sure for many years you have been multiplying scalars by other scalars. Remember, a scalar quantity is just an ordinary number. Let's turn our attention to a scalar times a vector. If you think about a vector expressed in polar coordinates, all you have is a magnitude and a direction. When you multiply a scalar by that vector, all you're really doing is changing the magnitude by scaling it up or down. If the scalar value is a whole number, the magnitude gets larger. Likewise, if the scalar is a fraction less than 1, the magnitude gets smaller.
Example 4.10: Scalar * Vector in Polar CoordinatesCalculate 5A if vector A = 3ft @ 22. Solution5A = 5(3ft @ 22) = 15ft @ 22 If you're trying to visualize the effect scalar multiplication has on a vector, take a look at Figure 4.17. Figure 4.17. 2 * vector A.
Remember that vectors are often represented by arrows with a length that corresponds to the magnitude, and the way the vector is pointing indicates the direction. As you can see, vector 2A is twice as long as A, but it still points in the exact same direction. If you're already set up to program a vector and it's in Cartesian coordinates, you can still perform scalar multiplication without converting back to polar coordinates. Simply multiply each component by the scalar value, and that will have the same effect.
Example 4.11: Scalar * Vector in Cartesian CoordinatesCalculate A if vector . Solution
Quite often in programming, you'll hear the term normalization used. It's really just a fancy word for scaling the magnitude of a vector down to 1. Quite often, a vector is used to simply establish a direction. In fact, and are perfect examples of that. The is really just a vector that's one unit long in the positive x direction. Likewise, the is a vector with a magnitude of 1 in the positive y direction. In future sections, you'll see applications where a vector with length 1 is used to establish a direction. Normalizing a vector in polar coordinates is very simple. Just change the magnitude to 1 and leave the direction the same. However, in the context of programming, the vector will most likely be in Cartesian coordinates before you need to normalize it. In this case you must first calculate the magnitude of the vector and then divide each component by the magnitude. Essentially, you are performing a scalar multiplication by 1 over the magnitude.
This process happens even more frequently in 3D.
NOTE The symbol for a normalized vector is the cap. For example, when A has a magnitude of 1, it can be written as . Example 4.12: Normalizing a VectorNormalize vector A = [5 0 12]. Solution
NOTE To check yourself, you can always calculate . It should always equal 1 if you normalized correctly. As you can see, scalar multiplication has the effect of scaling a vector's magnitude up or down. The direction always stays the same; only the magnitude changes. Also, the process of normalization is a great example of a scalar times a vector. The next natural question to ask is, "How do I multiply two vectors?" This question is not answered quite as easily, but it is addressed in the next two sections. Self-Assessment
|
< Day Day Up > |