up previous next
ScalarProduct    --    scalar product


Syntax
ScalarProduct(L: LIST, M: LIST): INT, RAT, or RINGELEM

Description
This function returns the sum of the product of the components of L and M; precisely (len(L)=len(M)):

ScalarProduct(L, M) = sum([ L[I]*M[I] | I in 1..len(L) ]).

The function works whenever the product of the components of L and M are defined (see Algebraic Operators).

Example
/**/  ScalarProduct([1,2,3], [5,0,-1]);
2

/**/  use QQ[x,y,z];
/**/  ScalarProduct([x,y,z], [5,0,-1]);
5*x -z

See Also