SeriesSum(X: Double; Power: Double; Step: Double; Coefficients: Array): Double;
SeriesSum(X: double; Power: double; @Step: double; Coefficients: System.Array): double;
X is the value of the power series variable.
Power is the index of power of X for the first member of the power series.
Step is the step, by which the index of the Power power is increased for each next member of the power series.
Coefficients is the set of factors by the corresponding powers of X.
The SeriesSum method returns the sum of the power series.
The sum of the power series is calculated by the formula:
To execute the example, add a link to the MathFin system assembly.
Sub UserProc;
Var
a: Array[1..5] Of Double;
d: Double;
Begin
a[1] := 2.1;
a[2] := 6.3;
a[3] := 3.2;
a[4] := 8.8;
a[5] := 4.5;
d := Math.SeriesSum(10, 1, 1, a);
Debug.WriteLine(d);
End Sub UserProc;
After executing the example the console window displays the sum of the power series.
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
a: Array[1..5] Of Double;
d: Double;
SSum: Prognoz.Platform.Interop.MathFin.MathClass;
Begin
SSum := New Prognoz.Platform.Interop.MathFin.MathClass();
a[1] := 2.1;
a[2] := 6.3;
a[3] := 3.2;
a[4] := 8.8;
a[5] := 4.5;
d := SSum.SeriesSum(10, 1, 1, a);
System.Diagnostics.Debug.WriteLine(d);
End Sub;
See also: