當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


Python numpy.pv()用法及代碼示例


numpy.fv(rate,nper,pmt,fv,當=“結束”時):此財務函數可幫助用戶計算未來價值。

參數:

  • rate : [數組]每個周期的利率為十進製(不是百分比)
    nper : [數組]總複利期
    pmt : [數組]固定付款
    fv : [數組,可選]未來值。默認值= 0.0
    when : 在每個期間的開始(當= {'開始',1}時)或結束(當= {'結束',0}時)。默認值為{‘end’,0}

返回:

present value as per given parameters.

求解方程:

fv + pv*(1 + rate)**nper +
pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) = 0

或當費率== 0

fv + pv + pmt * nper = 0

代碼1:工作

## 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)

輸出:

present value (fv) :  -100.000671316

參考:



相關用法


注:本文由純淨天空篩選整理自Mohit Gupta_OMG 大神的英文原創作品 numpy.pv() in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。