up previous next
ScalarProduct    --    scalar product


Syntax
ScalarProduct(L, M): OBJECT
  where each of L and M is of type MODULEELEM or LIST

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

See Also