SumX2MY2(X: Array; Y: Array): Double;
X. Array of real numbers.
Y. Array of real numbers.
The SumX2MY2 method returns the sum of differences between squares of the corresponding values in two arrays.
The X and Y arrays must be equal in size.
The function works correctly with both one-dimension and two-dimension arrays.
To execute the example, add a link to the MathFin system assembly.
Sub UserProc;
Var
r: Double;
X: Array[7] Of Double;
Y: Array[7] Of 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.SumX2MY2(X, Y);
Debug.WriteLine(r);
End Sub UserProc;
After executing the example the console window displays the sum of square differences equal to 217.
See also: