numpy.pv(rate,nper,pmt,fv=0,when='end')[source]¶Compute the present value.
| Parameters: |
|
|---|---|
| Returns: |
|
Notes
The present value is computed by solving the equation:
fv+pv*(1+rate)**nper+pmt*(1+rate*when)/rate*((1+rate)**nper-1)=0
or, whenrate=0:
fv+pv+pmt*nper=0
forpv, which is then returned.
References
| [WRW] | Wheeler, D. A., E. Rathke, and R. Weir (Eds.) (2009, May).Open Document Format for Office Applications (OpenDocument)v1.2,Part 2: Recalculated Formula (OpenFormula) Format - Annotated Version,Pre-Draft 12. Organization for the Advancement of Structured InformationStandards (OASIS). Billerica, MA, USA. [ODT Document].Available:http://www.oasis-open.org/committees/documents.php?wg_abbrev=office-formulaOpenDocument-formula-20090508.odt |
Examples
What is the present value (e.g., the initial investment)of an investment that needs to total $15692.93after 10 years of saving $100 every month? Assume theinterest rate is 5% (annually) compounded monthly.
>>>np.pv(0.05/12,10*12,-100,15692.93)-100.00067131625819
By convention, the negative sign represents cash flow out(i.e., money not available today). Thus, to end up with$15,692.93 in 10 years saving $100 a month at 5% annualinterest, one’s initial deposit should also be $100.
If any input is array_like,pv returns an array of equal shape.Let’s compare different interest rates in the example above:
>>>a=np.array((0.05,0.04,0.03))/12>>>np.pv(a,10*12,-100,15692.93)array([ -100.00067132, -649.26771385, -1273.78633713])
So, to end up with the same $15692.93 under the same $100 per month“savings plan,” for annual interest rates of 4% and 3%, one wouldneed initial investments of $649.27 and $1273.79, respectively.