numpy.pv() in Python
numpy.fv(rate, nper, pmt, fv, when = ‘end’) : This financial function helps user to compute future values.
Parameters :
rate : [array_like] Rate of interest as decimal (not per cent) per period
nper : [array_like] total compounding periods
pmt : [array_like] fixed payment
fv : [array_like, optional] future value. Default = 0.0
when : at the beginning (when = {‘begin’, 1}) or the end (when = {‘end’, 0}) of each period. Default is {‘end’, 0}
Return :
present value as per given parameters.
Equation being solved :
fv + pv*(1 + rate)**nper + pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) = 0
or when rate == 0
fv + pv + pmt * nper = 0
Code 1 : Working
## Python program explaining pv() function import numpy as np ''' Question : What is the present value (e.g., the initial investment) of an investment that needs to total $15692.93 after 10 years of saving $100 every month? Assume the interest rate is 5% (annually) compounded monthly. ''' # rate np pmt fv Solution = np.pv(0.05/12, 10*12, -100, 15692.93) print("present value (fv) : ", Solution) |
Output :
present value (fv) : -100.000671316
Reference :
https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.pv.html
Recommended Posts:
- Python | Merge Python key values to list
- Python | Convert list to Python array
- Reading Python File-Like Objects from C | Python
- Python | Index of Non-Zero elements in Python list
- Important differences between Python 2.x and Python 3.x with examples
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Add Logging to a Python Script
- Python | Sort Python Dictionaries by Key or Value
- Python | Add Logging to Python Libraries
- Python | Visualizing O(n) using Python
- JavaScript vs Python : Can Python Overtop JavaScript by 2020?
- pow() in Python
- Any & All in Python
- set add() in python
- chr() in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



