Dot Product: Difference between revisions

Updated the page. TODO: update the explanation.
(Created page with "Calculates the dot product of the two input vectors, and outputs a number. /uploads/Dot Product1.png == Details == The Dot Product is a way of multiplying two vectors together, and is written as A · B. We can calculate it algebraically this way: A · B = Ax × Bx + Ay × By + Az × Bz We multiply the x's, multiply the y's, multiply the z's, and then sum them all together. For more advanced readers, it can also be calculated thi...")
 
(Updated the page. TODO: update the explanation.)
Line 1: Line 1:
Calculates the dot product of the two input vectors, and outputs a [[number]].
{{Block
 
|image=Dot Product.png
[[width=336px,alt=Dot Product|/uploads/Dot Product1.png]]
|type=s
|folder=math
|input1={{Port|v}}
|input2={{Port|v}}
|output1={{Port|n|Dot Product}}
}}
Calculates the dot product of the two input [[vector]]s.


== Details ==
== Details ==


The Dot Product is a way of multiplying two vectors together, and is written as A · B.
The Dot Product is a way of multiplying two vectors together, and is written as <code>A · B.</code>


We can calculate it algebraically this way:
We can calculate it algebraically this way:


A · B = Ax × Bx + Ay × By + Az × Bz
<code>A · B = Ax × Bx + Ay × By + Az × Bz</code>


We multiply the x's, multiply the y's, multiply the z's, and then sum them all together.
We multiply the x's, multiply the y's, multiply the z's, and then sum them all together.
Line 15: Line 21:
For more advanced readers, it can also be calculated this way:
For more advanced readers, it can also be calculated this way:


A · B = \|A\| × \|B\| × cos(θ)
<code>A · B = |A| × |B| × cos(θ)</code>


Where \|A\| is the magnitude (length) of vector A, \|B\| is the magnitude (length) of vector B, and θ is the angle between A and B.
Where |A| is the magnitude (length) of vector A, |B| is the magnitude (length) of vector B, and θ is the angle between A and B.


So we multiply the length of A times the length of B, then multiply by the [[Cos|cosine]] of the angle between A and B.
So we multiply the length of A times the length of B, then multiply by the [[Cos|cosine]] of the angle between A and B.