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

  Use R ::= QQ[x,y];
  ScalarProduct([ideal(x,y), ideal(x^2-xy)],[x^2,y]);
ideal(x^3, x^2y, x^2y - xy^2)
-------------------------------

See Also