Npv(Rate: Double; Values: Array): Double;
Npv(Rate: double; Values: System.Array): double;
Parameters | Description | Constraints |
Rate | Discount rate for one period. | Cannot be equal to 0 |
Values | An array of arguments, representing costs and profits. | It is required to use an array of the Double. |
The Npv method returns net present value of an investment, using a discount rate as well as the values of future payments (negative values) and inpayments (positive values).
It is considered that an investment, the value of which is calculated by the Npv function, starts one period before the first monetary payment of Values and ends with the last payment in the list. The Npv function calculations are based on future payments. If the first payment is in the beginning of the first period, the first value should be added to the result of the Npv function, but not included in the list of arguments.
Npv is calculated using the following formula:
Where n – the quantity of numbers in the Values argument.
To execute the example, add a link to the MathFin system assembly.
Sub UserProc;
Var
r: Double;
Arr: Array[3] Of Double;
Begin
Arr[0] := -1;
Arr[1] := 1.5;
Arr[2] := 2.5;
r := Finance.Npv(0.15, Arr);
Debug.WriteLine(r);
End Sub UserProc;
After executing the example the console window displays the value of net present value of investment equal to 1.9084.
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;
Finance: FinanceClass = New FinanceClass();
Arr: Array[3] Of Double;
Begin
Arr[0] := -1;
Arr[1] := 1.5;
Arr[2] := 2.5;
r := Finance.Npv(0.15, Arr);
System.Diagnostics.Debug.WriteLine(r);
End Sub;
See also: