IMath.Average

Fore Syntax

Average(Values: Array): Double;

Fore.NET Syntax

Average(Values: System.Array): double;

Parameters

Values. Array of real numbers.

Description

The Average method returns arithmetic average of its 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[5Of Double;
Begin
    Arr[0]:=10.6;
    Arr[1]:=7;
    Arr[2] := 9.1;
    Arr[3]:=27.25;
    Arr[4]:=2;
    r := Math.Average(Arr);
    Debug.WriteLine(r);
End Sub UserProc;

After executing the example the console window displays the arithmetic average of arguments equal to 11.19.

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[5Of double;
Begin
    Arr[0] := 10.6;
    Arr[1] := 7;
    Arr[2] := 9.1;
    Arr[3] := 27.25;
    Arr[4] := 2;
    r := Math.Average(Arr);
    System.Diagnostics.Debug.WriteLine(r);

End Sub;

See also:

IMath