IMath.SumXMY2

Syntax

SumXMY2(X: Array; Y: Array): Double;

Parameters

X. Array of real numbers.

Y. Array of real numbers.

Description

The SumXMY2 method returns the sum of squares of differences of the corresponding values in two arrays.

Comments

The X and Y arrays must be equal in size.

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

Example

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

Sub UserProc;
Var
    r: Double;
    X: Array[7Of Double;
    Y: Array[7Of Double;
Begin
    X[0] := 2; Y[0] := 6;
    X[1] := 3; Y[0] := 5;
    X[2] := 9; Y[0] := 11;
    X[3] := 1; Y[0] := 7;
    X[4] := 8; Y[0] := 6;
    X[5] := 7; Y[0] := 4;
    X[6] := 5; Y[0] := 4;
    r := Math.SumXMY2(X, Y);
    Debug.WriteLine(r);
End Sub UserProc;

After executing the example the console window displays the sum of squares of differences equal to 233.

See also:

IMath