SumXMY2(X: Array; Y: Array): Double;
SumXMY2(X: System.Array; Y: System.Array): double;
X. Array of real numbers.
Y. Array of real numbers.
The SumXMY2 method returns the sum of squares of differences 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.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.
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();
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.SumXMY2(X, Y);
System.Diagnostics.Debug.WriteLine(r);
End Sub;
See also: