dot product

L

LesHurley

Is there a built in function in excel 2003 for the dot product of two vectors? One can calculate it using multiple functions. If both vectors are oriented either by row or by column one can use {=sum(v1*v2)}. If one is oriented by row and the other by column one can calculate {=sum(v1*transpose(v2)}. But these can become a bit confusing. Why not a function {=dot(v1,v2)} without worrying about orientation?
Thanks for your help
 
M

Myrna Larson

Sounds from your first example that you've missed SUMPRODUCT.

However, it requires that both arguments be the shame shape. If they aren't,
you need to use TRANSPOSE *and* array enter it:

=SUMPRODUCT(A1:B1,TRANSPOSE(C1:C2))

You need CTRL+SHIFT+ENTER here.

Is there a built in function in excel 2003 for the dot product of two
vectors? One can calculate it using multiple functions. If both vectors are
oriented either by row or by column one can use {=sum(v1*v2)}. If one is
oriented by row and the other by column one can calculate
{=sum(v1*transpose(v2)}. But these can become a bit confusing. Why not a
function {=dot(v1,v2)} without worrying about orientation?
 
D

Dana DeLouis

If I am not mistaken, another option might be:

=MMULT(A1:C1,E1:E3)

Dana DeLouis
 
L

LesHurley

No; That would return a 3x3 matrix. The dot product (or inner product as some call it) is just a number.
 
L

LesHurley

You are right myrna, I didn't know about SUMPRODUCT but it amounts to the same thing. Microsoft gives all the necessary tools for working with matricies; why not an easy way to calculate the dot product of two vectors, the result of which is just a number? But thanks for your suggestion.
 
D

Dana DeLouis

If I am not mistaken, make sure the Horizontal array goes first, then the
Vertical array. You get a 3*3 if the other way around. Hope I said this
right. :>)

HTH
Dana DeLouis

LesHurley said:
No; That would return a 3x3 matrix. The dot product (or inner product as
some call it) is just a number.
 
D

Dana DeLouis

Just to mention, both the following return 70.
Note however that the second array uses ";" to indicate a verticle array
(U.S. version anyway)

=MMULT({1,2,3,4},{5;6;7;8})

=SUMPRODUCT({1,2,3,4},{5,6,7,8})

Both return 70.

As a check with another program...

Dot[{1,2,3,4},{5,6,7,8}]
70

HTH :>)
Dana DeLouis
 
Top