Vector.Product Method

Overload List

#SignatureDescription
1function Product: Double;Elements product.
└ indexed: function Product(Index: Integer; Len: Integer): Double;
2procedure Product(out X: TCplx);Calculate the product of all calling object complex elements.
└ indexed: procedure Product(out X: TCplx; Index: Integer; Len: Integer);
3procedure Product(out X: Double);Calculate the product of all calling object elements.
└ indexed: procedure Product(out X: Double; Index: Integer; Len: Integer);

Overload 1: function Product: Double;

Elements product.

Returns: Double - the product of all calling object elements.

Remarks:

Formula:

X=k=0V.Length1V[k]X = \prod _{k=0} ^{\text{V.Length}-1} \text{V}[k]

An exception is raised if calling object Vector.Complex property is true.

Examples
var a: Vector;
    c: double;
begin
    a.SetIt(False,[1,2,3,4]);
    c := a.Product; // c= 24
end;
var
    a: Vector;
    result: double;
begin
    a := [1.0, 2.0, 3.0, 4.0];
    result := a.Product;
    if Abs(result - 24.0) > 1e-10 then
        raise Exception.Create('Vector.Product: expected 24.0, got ' + result.ToString);
end;
See Also: Vector.Productc

Indexed: function Product(Index: Integer; Len: Integer): Double;

Returns the product for calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1IndexIntegerstart index
2LenIntegerelement count

Returns: Double

Remarks:

An exception is raised if array borders are overrun or underrun.

Overload 2: procedure Product(out X: TCplx);

Calculate the product of all calling object complex elements.

#NameTypeDescription
1XTCplx

Result: stored in self (calling object)

Remarks:

Store the result in complex variable X.

Indexed: procedure Product(out X: TCplx; Index: Integer; Len: Integer);

Calculate the product for calling object complex elements [Index]..[Index+Len-1].

#NameTypeDescription
1XTCplx
2IndexIntegerstart index
3LenIntegerelement count

Result: stored in self (calling object)

Remarks:

Store the result in complex variable X. An exception is raised if array borders are overrun or underrun.

Overload 3: procedure Product(out X: Double);

Calculate the product of all calling object elements.

#NameTypeDescription
1XDouble

Result: stored in self (calling object)

Remarks:

Store the result in real variable X.

Indexed: procedure Product(out X: Double; Index: Integer; Len: Integer);

Calculate the product for calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1XDouble
2IndexIntegerstart index
3LenIntegerelement count

Result: stored in self (calling object)

Remarks:

Store the result in real variable X. An exception is raised if array borders are overrun or underrun.