努比。Python中的pv()

努比。fv(比率、净现值、pmt、fv、时间=‘结束’): 此财务功能帮助用户计算未来价值。

null

参数:

费率: [array_-like]每段时间的小数利率(非百分比) nper: [array_like]总复利周期 pmt: [array_like]固定支付 fv: [类似数组,可选]未来值。默认值=0.0 什么时候: 在每个周期的开始(当={‘begin’,1})或结束(当={‘end’,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

参考: https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.pv.html

© 版权声明
THE END
喜欢就支持一下吧
点赞5 分享