Vector division-inverse operation of Scalar Multiplication

Source: Internet
Author: User
Tags modulus

I. Question proposal

We know that an n-dimensional vector A and a scalar K can perform scalar multiplication to obtain vector B --
B = Ka

So, if we only know the vectors a and B of the two collinearity, how can we find K --
K = B/a =?

Ii. Solution

We can take (dot product) ""--
K = B/
= (B. a)/(A.)
= (B. a)/(| A | ^ 2)
= (B1 * A1 + B2 * A2 + B3 * A3 +... + BN * an)/(A1 * A1 + A2 * A2 + A3 * A3 +... + an *)

Iii. geometric interpretation and promotion to non-linear Vectors

First, let's recall the ry of the dot product of the vector.Algorithm--
A. B = | A | * | B | * Cos (th)
Note: TH is the angle between two vectors.

Divide the formula above by | A | (modulus of vector A) to obtain the modulus of projection of vector B on vector --
| Prj (B) A | = | A | * | B | * Cos (th)/| A | = | B | * Cos (th)

Divide the projection modulus by | A |, which is the ratio of the projection modulus to the total length --
K = | prj (B) A |/| A | = (| B |/| A |) * Cos (th)

It is obvious for a linear vector that is the scalar K value previously sought.
For non-linear vectors, It is the correlation K value of the projection vector.

That is to say, the Division has a value (unless a is a zero vector) regardless of the collinearity ).
This feature is often useful. For example, when writing a graphic editing system, you need to calculate which part of the line segment is the click position. Because the number of coordinates clicked by the mouse is a rational number (scale), and the slope of the line segment may be an irrational number, this will cause the two vectors to be non-linear. The division algorithm in this article can handle this situation steadily. In addition, the projection vector is more in line with the general operation habits.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.