Answers for "dot product r"

R
19

dot product

Let a be the direction vector <a1, a2, a3>
Let b be the direction vector <b1, b2, b3>

Dot Product (final answer is a scalar):
a • b = <a1, a2, a3> • <b1, b2, b3> = (a1)(b1) + (a2)(b2) + (a3)(b3) or
a • b = ||a||||b||cosθ, where θ is the angle between the two vectors,
						||a|| is the magnitude of a, and
                        ||b|| is the magnitude of b

If a • b = 0, the angle between the two vectors is π rad (90°)
			  meaning the two vectors are orthogonal (perpendicular).

If vector "dot-products" with itself:
a • a = ||a||^2, where ||a|| is the length of a.
Posted by: Guest on April-05-2021
0

r dot product

a = c(1,2)
b = c(0,1)

# Perform the dot product
a%*%b
Posted by: Guest on December-30-2020

Browse Popular Code Answers by Language