IMath.SumSq

Fore Syntax

SumSq(Values: Array): Double;

Fore.NET Syntax

SumSq(Values: System.Array): double;

Parameters

Values. Array of real numbers.

Description

The SumSq method returns the sum of squares of arguments.

Comments

If an array of real numbers contains gaps, the function returns error.

The function works correctly with both one-dimension and two-dimension arrays.

Fore Example

To execute the example, add a link to the MathFin system assembly.

Sub UserProc;
Var
    r: Double;
    Arr: Array[4Of Double;
Begin
    Arr[0] := -5;
    Arr[1] := 15.08;
    Arr[2] := 30.12;
    Arr[3] := 5.94;
    r := Math.SumSq(Arr);
    Debug.WriteLine(r);
End Sub UserProc;

After executing the example the console window displays the sum of array element squares equal to 1194.9044.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.MathFin;

Public Shared Sub Main(Params: StartParams);
Var
    r: double;
    Math: MathClass = New MathClass();
    Arr: Array[4Of double;
Begin
    Arr[0] := -5;
    Arr[1] := 15.08;
    Arr[2] := 30.12;
    Arr[3] := 5.94;
    r := Math.SumSq(Arr);
    System.Diagnostics.Debug.WriteLine(r);
End Sub;

See also:

IMath