up previous next
ScalarProduct

scalar product

Syntax
ScalarProduct(L, M):OBJECT

where each of L and M is of type VECTOR 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