up previous next

ScalarProduct

Syntax

ScalarProduct(L, M):OBJECT

where each of L and M is of type VECTOR or LIST
    

Summary

scalar product

Description

This function returns the sum of the product of the components of L and M; precisely:

ScalarProduct(L,M) = Sum([L[I]*M[I]|I In 1..Min(Len(L),Len(M))])).

Thus, the function works even if the lengths of L and M are different. 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
-------------------------------
ScalarProduct([1,2,3],[5,0]);
5
-------------------------------
Use R ::= Q[x,y];
ScalarProduct([Ideal(x,y),Ideal(x^2-xy)],[x^2,y]);
Ideal(x^3, x^2y, x^2y - xy^2)
-------------------------------
        
    

See Also