financeaccounting

pv

Available under GPL (Free) and Commercial licence
get a GPL licence
COST (GBP)
this unit 2.00
sub units 0.00
add a commercial licence to your cart
0
viewed 1977 times and licensed 4 times
www.codecogs.com/d-ox/finance/accounting/pv.php
Controller: CodeCogs    Contact Controller

Interface

#include <codecogs/finance/accounting/pv.h>

using namespace Finance::Accounting;

double pv (double rate, int n, double p, double vn, PaymentPoint when=pp_EndOfPeriod)
Return the present value of an investment.

Function Documentation

Pv Calculator

  

Add calculator to your site or email
 
doublepvdoublerate
intn
doublep
doublevn
PaymentPointwhen = pp_EndOfPeriod )
This function calculates the present value, v_0, for a sequence of n future payouts p followed by a final payment v_n:

If rate = 0,
(1)
\displaystyle v_0 + p\,n + v_n = 0
If rate > 0 and payments are received at the start of each period,
(2)
\displaystyle v_0(1+rate)^n + p_1(1+rate)^{n} + p_2(1+rate)^{n-1} + ... + p_{n-1}(1+rate) + v_n = 0
while for payments received at the end of each period
(3)
\displaystyle v_0(1+rate)^n + p_1(1+rate)^{n-1} + p_2(1+rate)^{n-2} + ... + p_{n}(1+rate) + v_n = 0

Further information available when you purchase a licence.

The code also uses an enumerated type PaymentPoint, using the following values:
Example:
A lady wins a $10 million lottery. The money is to be paid out at the end of each year in $500,000 payments for 20 years. The cu rrent treasury bill rate of 6% is used as the discount rate.
#include <stdio.h>  
#include <codecogs/finance/accounting/pv.h>
 
int main(int argc, char *argv[])  
{
  double d = Finance::Accounting::pv(0.06, 20, 500000, 0, Finance::Accounts::pp_EndOfPeriod);
  printf("The present value of the $10 million prize is: %7.2f\n", d);
  return 0;
}
Output:
The present value of the $10 million prize is: 5734960.61
Parameters:
rateis the interest rate - assumed constant.
nis the number of periods over which to calculate.
pare the payouts from the investment made either at the start or end of each period (as defined by when).
vnThe future value of the investment.
whenThe point in each period when the payment is made, either pp_StartOfPeriod or pp_EndOfPeriod.
References:
www.vni.com/products/imsl/jmsl/v30/api/com/imsl/finance/Finance.html
Authors:
James Warren (May 2005)
Source Code:
Register

- To get code register with CodeCogs. Already a Member, then Login.


Last Modified: 18 Oct 07 @ 17:07     Page Rendered: 2008-05-08 09:45:48

Page Comments

  You must login to leave a messge


Valid CSS!   Valid XHTML 1.0 Transitional